How to Take a Screenshot in Linux (Ubuntu)

This page originally had 7 ways to take a screenshot in Linux. It keeps growing and now there are more than 7. If you know of other useful ways to take a screenshot in Linux, leave a comment below...


There are several ways to take a screenshot Linux in general. I'm going to use Ubuntu as an example, but most of these will work on any Linux distro. If you aren't using GNOME, then the GNOME-specific items won't work.

I'll start with the common ways to take screenshots in Linux, and then show you a nice shell script for taking custom screenshots in GNOME with just one click of the mouse. The shell script will also work in other windows managers like KDE, but you will have to figure out how to make the custom application launcher for it.

How to Take a Screenshot in Ubuntu (GNOME)

One way to take a screenshot in Ubuntu is to go to the main menu: Applications —> Accessories —> Take Screenshot.

Taking a screenshot with GNOME in Ubuntu

How to Take a Screenshot in Linux With the PrintScreen Button

You can also take a screenshot of the entire screen by pushing the "Print Screen" (PrtSc) button on your keyboard. To get a screenshot of only the active window, use Alt-PrtSc. This is easier than using the GNOME "Take Screenshot" tool. You can also control this GNOME screenshot tool from the terminal as described in a newer Linux screenshot tutorial.

To get more control over your screenshots, check out the other options below.

How to Take a Screenshot in Linux With the Terminal (ImageMagick)

My favorite way of taking screenshots is with ImageMagick in the terminal. If you need a delay before taking the screenshot (for example, to get a screenshot of a menu that would disappear if you took a screenshot with GNOME) ImageMagick is the best way.

First, make sure you have ImageMagic installed: type import -version in the terminal. If ImageMagick is installed, you will see the ImageMagick version number. I don't think Ubuntu comes with ImageMagick. To install ImageMagick in Ubuntu (or any Debian-based distro), just type sudo apt-get install imagemagick.

To take a screenshot in the terminal with ImageMagick, type the following line into a terminal and then click-and-drag the mouse over a section of the screen:

import MyScreenshot.png

GNOME will beep once when the screenshot begins, and once again when the screenshot is complete. Then type eog MyScreenshot.png in the terminal to view your screenshot. "eog" is the command to start Eye of GNOME.

To capture the entire screen after a delay (so you can open some menus or whatever), type sleep 10; import -window root MyScreenshot2.png. The first part of that line, sleep 10; will give you a 10 second delay before the screenshot begins. The next part, import -window root, tells ImageMagick to import the "root" window — that is, the entire screen. The last part MyScreenshot2.png is the name of your screenshot.

Another example of taking a screenshot in Linux with the terminal

The following command will wait for 15 seconds, take a screenshot, and then open the screenshot in the GIMP for editing:

sleep 15; import -window root MyScreenshot3.png; gimp MyScreenshot3.png;

You can also manipulate the screenshot with ImageMagick as you take it. For example, the following line will take a screenshot and resize the image to a width of 500 pixels:

import -window root -resize 500 AnotherScreenshot.png

For more information on how to take screenshots in the terminal with ImageMagick, type man imagemagick in the terminal. You can also type import -help to get a list of options for the import command.

How to Take a Screenshot in Linux With the Terminal (scrot)

Another way to take a screenshot from the terminal is with scrot. I learned about this at UbuntuForums.org.

To install scrot (on Ubuntu) type:

sudo aptitude install scrot

To take a screenshot in Linux from the terminal with scrot type:

scrot MyScreenshot.png

To get a screenshot and immediately open it in the GIMP, type:

scrot -q 85 -d 5 screenshot.png && gimp screenshot.png &

The -q option sets the quality. The -d sets the delay. The && means that if the first command is true, then execute the second. The final & means to run the commands in the background so that you can still use that terminal for other commands.

For more information about using scrot, read the man pages by typing the following in the terminal:

man scrot

How to Take a Screenshot in Linux With the Terminal (gnome-panel-screenshot)

As described in my newer Linux screenshot tutorial, you can also take a screenshot from the Linux terminal in GNOME with the following command:

gnome-panel-screenshot

You can also add a delay:

gnome-panel-screenshot --delay 5

How to Take a Screenshot With the GIMP

To take a screenshot with the GIMP, find the following menu option: File —> Acquire —> Screen Shot. You will then be offered some options for the screenshot such as length of delay and whether you want to take a screenshot of the entire screen, or just a window.

Taking a screenshot with the GIMP

How to Take a Screenshot of a Web Page With Firefox

I use two different Firefox extensions to take screenshots of web pages, depending on what kind of screenshot I need.

Snapper Firefox Screenshot Extension

If I just need to take a screenshot of a section of a web page, I use a Firefox extension called Snapper.

UPDATE: There is no longer a Snapper extension for Firefox and the Screengrab Extension mentioned below contains all of it's functionality.

ScreenGrab Firefox Extension

A great Firefox extension for taking screenshots is called ScreenGrab. ScreenGrab will take screenshots of entire web pages — even the parts that run off the screen.

To take a screenshot of a web page in Firefox with ScreenGrab, just right click on a web page and choose: ScreenGrab! —> Save document as image. Give the extension a few seconds to startup and take the screenshot. When ScreenGrab is done it will open a save dialog box where you can choose a filename for your screenshot.

How to Take a Screenshot in GNOME With One Click

[This can be modified to work in KDE or any other windows manager also.]

[UPDATE: I learned of another one-click Linux screenshot method that might work better for you than this shell script. Read through the shell script and try it out if you would like because the shell script is more customizable. But also see the new screenshot tutorial.]

The shell script for taking one-click screenshots is below. Copy and paste it into your favorite text editor and save it somewhere in your home directory as screenshot-import.sh. Then run the following command on it in the terminal to make it executable: chmod +x screenshot-import.sh.

Then right-click on your GNOME Panel — that is the panel that runs across the top of your screen in GNOME (e.g., Ubuntu). Choose Add to Panel as shown in the image below:

Add to Panel for making a screenshot

Then click on the button that says Custom Application Launcher. You will then see the following window:

Create custom application launcher

Fill out the information as shown. Choose an icon (see below for a custom icon). Click on "Browse" and navigate to the place where you saved the shell script below. Do not check the box that says "Run in terminal".

After you have set up the custom application launcher for the screenshot-import.sh script you will be able to quickly take a screenshot of part of the screen by clicking on the new launcher in the GNOME panel, and then clicking-and-dragging the mouse over a section of the screen. The shell script will save the screenshot to the desktop.

Here is an optional custom icon for this application launcher. Just download the eye.xpm file to your desktop and then copy it to your pixmaps directory like this:

sudo cp eye.xpm /usr/share/pixmaps/

Then right click on your new application launcher in the GNOME panel, click on Properties, and then choose this icon.

(As with any code snippet that you find on the Web, use at your own risk.)

Note that it will save the screenshots to ~/Desktop/. Read through the script and try to understand what it is doing before you use it.

#!/bin/bash
#
# http://tips.webdesign10.com
#
# Use this script at your own risk
# 
# Takes a screenshot with ImageMagick.
# Link to this file from the GNOME panel
# Do NOT check the box "run in terminal"
# Remember to chmod +x this file
# Screenshot will save to ~/Desktop/

# The name of your file
screenshot='screenshot';

# Creates an unusual filename based on nanoseconds so that
# you don't accidentally overwrite another screenshot.
# The `backticks` tell the script to run another command (date).
# Type 'man date' in the terminal for more info
nano=`date '+%d%b%y-%N'`;

# Adds the file extension
extension='.png';

# Generate a filename for this screenshot
file="$HOME/Desktop/$screenshot-$nano$extension";

# Use ImageMagick to take the screenshot
# Saves to ~/Desktop
import $file;

How to Edit Screenshots With the GIMP

Another article describes how to edit your screenshots with the GIMP.

AttachmentSize
eye.xpm1.26 KB
Average: 4.1 (17 votes)

Comments

very good tools overview

Excellent review of the methods that can be used to get screenshots on Linux with Gnome (but not limited to Gnome). Since I needed only parts of the screen in the capture, I used the "import filename.png" command while adding the delay with sleep 10; as described above. It solved my problem!

The explanations about using gnome-screenshot-panel were very useful too; I would probably use that tip for other screen captures.

Thank you very much for these very complete explanations and for explaining in detail the steps required.

PS Unfortunately, I don't know of any other method that can be used for this task... The ones that you already described seem more than enough - anyone should find the right tool for their screenshot needs.

Also ksnapshot

ksnapshot is another excellent screen capture program. It runs in Gnome. Maybe KDE needs to be installed to run it?

Webmaster Tips's picture

Taking a Screenshot in Linux with ksnapshot

Thanks for pointing that one out. I have ksnapshot installed, but forgot to mention it. It runs in GNOME, but I do have KDE installed also.

Is it possible to take a

Is it possible to take a screenshot in the REAL terminal?

use xwd to screen a terminal

use xwd to screen a terminal window.

xwd > screen.xwd

use convert to convert to other format.

convert screen.xwd screen.png

you can pipe the commands or use the -root switch to cap the whole screen if your using term in a gui. i.e. xwd -root > screen.xwd

Which methods can I use, to

Which methods can I use, to make a screenshot that includes the mouse? When I used the Print-button (Ubuntu), it wasn't on the pic.

Webmaster Tips's picture

Taking a screenshot of the mouse pointer

I'm not sure how to do that, except using a workaround with Wink. Just set Wink to take one screenshot (i.e., by pressing the Pause key). Then export as HTML. Your screenshot will be in the exported directory. Here is a screenshot of the mouse pointer captured with Wink:

Taking a screenshot of the mouse pointer in Linux

how to take desktop

how to take desktop screenshots in perticular intervel like every 5 min

Webmaster Tips's picture

How to take a screen shot every 5 minutes

You can write a simple shell script to automate the process.

For example, try something like this in the terminal:

for((i=0;i<12;i++))
do
import -window root screenshot_$i.png
sleep 5m
done

It will take a screenshot 12 times — once every 5 minutes. It will beep twice for every screenshot — once when the screenshot starts and once when it finishes.

such a long script...

Wow, such a long script for something that can fit easily on one line:
import $HOME/Desktop/screenshot-$(date '+%d%b%y-%N').png

I prefer to use the following format:
import -window root ~/screenshot-$(date +%F)--$(date +%T).png

Anyway, the Fox toolkit contains a utility called "shutterbug" which is a nice little screen capture utility.
http://www.fox-toolkit.org/

why stop at 12? this will

why stop at 12? this will take a screen shot every 5 minutes and put it at ~/screenshot.png or if you specify an argument (doesn't matter what it is) it will also append date as per the article -- creating a new file each time.

#! /bin/bash
#file: screenshot.sh

if [ $1 ]; then
appenddate=_$(date +%d%b%y-%N)
fi

while [ 1 -eq 1 ]; do
import -window root ~/screenshot$appenddate.png
sleep 5m
done

why stop at 12?

this will take a screen shot every 5 minutes and put it at ~/screenshot.png or if you specify an argument (doesn't matter what it is) it will also append date as per the article -- creating a new file each time.

#! /bin/bash
#file: screenshot.sh

if [ $1 ]; then
appenddate=_$(date +%d%b%y-%N)
fi

while [ 1 -eq 1 ]; do
import -window root ~/screenshot$appenddate.png
sleep 5m
done

Screen Tool

There is also another screenshot tool now: Screen Tool (http://www.tuckdesign.com/products#stool). It works under Qt and with static build should work under any distro. What is so different with this tool?

  • You can edit screenshot right away
  • This is only Linux screen capturing software that allows user to send edited screenshot through skype directly (no need to save-find-open-send)

But, (there is always "but") it is not free, but price of 10 euros is not too much for this kind of tool! Demo version is free to download.

Screenshot - Linux

http://www.tuckdesign.com/products#stool

Link above worked for me. Easy, simple and good....

Here's another really useful

Here's another really useful program: http://shutter-project.org/

Takes screenshots of a specific window, section, subsection of a window, site... apply effects / annotate and upload ;)

ScreenStamp!

ScreenStamp! was released today.

http://www.screenstamp.co.uk

Syndicate content