Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

What command(s) can I use in the terminal that's equivalent to the PrtSc (Print Screen) button?

I am running Ubuntu gnome.

share|improve this question
    
Are you using gnome or KDE or something else? It kind of depends of what desktop environment you are using. –  Braiam Feb 14 at 4:09
    
@Braiam take a look at his answer. –  Avinash Raj Feb 14 at 9:16
    
@AvinashRaj are you aware that Unity use gnome-screenshot too? –  Braiam Feb 14 at 14:17
    
i think gnome-screenshot is the default tool on unity for taking screenshots. –  Avinash Raj Feb 14 at 14:19

5 Answers 5

You can use import tool available in the ImageMagick package (you need to install this if its already not available on your system).

Run the following command in a shell:

import screenshot.png

and select the window you want to capture or select a region by pressing the left mouse button and dragging.

import is a actually a very powerful command which can be used in many ways to > capture the screen. For example, to capture the entire screen and after some delay and resizing it, use the following command:

import -window root -resize 400×300 -delay 200 screenshot.png

To see all the options available with import command, go to ImageMagick’s website.

Source and more info.

Another way to take a screenshot from the terminal is with scrot

To install scrot type:

sudo apt-get install scrot

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

scrot MyScreenshot.png

Some more options with scrot are here:

scrot -b -d 5 '%Y:%m:%d:%H:%M:%S.png' -e 'mv $f ~/Desktop/'

In this example,

  • -b specifies including the window borders
  • -d specifies a delay of five seconds
  • '%Y:%m:%d:%H:%M:%S.png' will save the screenshot with a name based on the current date and time and with the format specified, .png in this case
  • -e 'mv $f ~/Desktop/' tells scrot to save the screenshot to the Desktop
share|improve this answer
1  
+1 for your answer. It helped me. Thanks :) –  devav2 Sep 29 '12 at 15:45
    
You are welcome –  user61928 Oct 1 '12 at 5:11
up vote 25 down vote accepted

Found this option here and other options are also listed.

Open terminal by pressing Ctrl + Alt + T and type

gnome-screenshot

use gnome-screenshot -d xx to delay the action.

To delay the screenshot action by 10s

gnome-screenshot -d 10

or

sleep 10;gnome-screenshot
share|improve this answer
1  
gnome-screenshot --help will give you plenty of options. –  somethis Jul 11 '13 at 5:00

You can use shutter program to take screenshot from terminal.Run the below commands in terminal to install shutter,

sudo add-apt-repository ppa:shutter/ppa
sudo apt-get update
sudo apt-get install shutter

To take a screenshot of active window,

shutter -a -o shot.png -e

To take a screenshot of whole display,

shutter -f -o shot.png -e

The screenshots taken are stored in the home directory.

For more options run shutter --help command,

Usage:
    shutter [options]

Options:
    Example 1
            shutter -a -p=myprofile --min_at_startup

    Example 2
            shutter -s=100,100,300,300 -e

    Example 3
            shutter --window=.*firefox.*

    Example 4
            shutter --web=http://shutter-project.org/ -e

  Capture Mode Options:
    -s, --select=[X,Y,WIDTH,HEIGHT]
            Capture an area of the screen. Providing X,Y,WIDTH,HEIGHT is
            optional.

    -f, --full
            Capture the entire screen.

    -w, --window=[NAME_PATTERN]
            Select a window to capture. Providing a NAME_PATTERN (Perl-style
            regex) ist optional.

    -a, --active
            Capture the current active window.

    --section
            Capture a section. You will be able to select any child window
            by moving the mouse over it.

    -m, --menu
            Capture a menu.

    -t, --tooltip
            Capture a tooltip.

    --web=[URL]
            Capture a webpage. Providing an URL ist optional.

    -r, --redo
            Redo last screenshot.

  Settings Options:
    -p, --profile=NAME
            Load a specific profile on startup.

    -o, --output=FILENAME
            Specify a filename to save the screenshot to (overwrites any
            profile-related setting).

            Supported image formats: You can save to any popular image
            format (e.g. jpeg, png, gif, bmp). Additionally it is possible
            to save to pdf, ps or svg.

            Please note: There are several wildcards available, like

             %Y = year
             %m = month
             %d = day
             %T = time
             $w = width
             $h = height
             $name = multi-purpose (e.g. window title)
             $nb_name = like $name but without blanks in resulting strings
             $profile = name of current profile
             $R = random char (e.g. $RRRR = ag4r)
             %NN = counter

            The string is interpretted by strftime. See "man strftime" for
            more examples.

            As an example: shutter -f -e -o './%y-%m-%d_$w_$h.png' would
            create a file named '11-10-28_1280_800.png' in the current
            directory.

  Application Options:
    -h, --help
            Prints a brief help message and exits.

    -v, --version
            Prints version information.

    -d, --debug
            Prints a lot of debugging information to STDOUT.

    --clear_cache
            Clears cache, e.g. installed plugins, at startup.

    --min_at_startup
            Starts Shutter minimized to tray.

    --disable_systray
            Disables systray icon.

    -e, --exit_after_capture
            Exit after the first capture has been made. This is useful when
            using Shutter in scripts.
share|improve this answer

A simple way to save the active window is to press Alt+PrtScr at the same time. This will take a shot of this window and ask you if you want to save it. If you answer 'Yes', it will save it for you in your Pictures folder and you can use it like any other file.

share|improve this answer
5  
The OP wanted to use a command within and while in the terminal to take a screenshot. –  Peachy Oct 5 '12 at 4:30

I'm using ubuntu 13.10 and I have a script that I just wrote which may be helpful. I see this questions been answered but my solution requires no additional installs.

#!/bin/bash
curDate=$(date)
imgExtension=".png"
imgName=$curDate$imgExtension
imgDirectory="/path/to/desires/save/directory/"
imgSavePath=$imgDirectory$imgName
gnome-screenshot --file="$imgSavePath"

This code will save the screenshot without popping up the dialogue window. It uses the current time for a file name to avoid any duplicate filename issues.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.