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.