There are many Linux applications dedicated to taking screenshots. However, you minght want to use the command line to do this, either because you want to build an automated script, or because you have a terminal screen handy.
This will allow you to select a rectangle using your mouse. The moment you let go of your left mouse button, a screenshot with the contents of that rectangle will be saved in the current directory.
And then there’s scrot.
scrot -d 4 screenshot.png
This will take a screenshot of your entire desktop, with a delay of 4 seconds between launching the command and saving the screenshot.png file. Use
scrot -c -d 4 screenshot.png
to also display a countdown in the console. Use
scrot -q 80 -c -d 4 screenshot.jpg
to save a JPG file with a quality of 80%.
You can also use special strings with scrot, as to produce filenames that contain the date and size of the screenshot:
scrot ‘%Y-%m-%d_$wx$h.png’ -e ‘mv $f ~/Desktop/Pictures/’
The command above will produce a file named 2010-11-28_2560x1024.png on my system and move that file to to a folder called Pictures, residing on my desktop.
I use import quite a lot, in combination with OpenOffice.org, to prepare end user manuals for programs I build. However, as of today, I had no way to capture images of drop down boxes while displaying available options, as import is modeless. Now, with scrot, I can do it at last.
Thanks for the tip!
xwd | convert xwd:- screenshot_$(date +%Y%m%d_%H%M%S).png
Import will grab everything when called.
You can capture the entire screen with
$ import -window root screenshot.png
If you want the menus, just run
$ sleep 5 && import -window root screenshot_with_menus.png
When you said “Take screenshots from the command line in Linux” is it safe to assume this can only be done in a GUI interface. Or, can it be done on a headless/TUI system also.