Last updated on November 23, 2020 by Dan Nanni
There are various flavors of Linux screenshot utilities, including desktop-specific screenshot programs (e.g.,
KSnapshot for KDE,
gnome-screenshot for GNOME,
Screenshooter for Xfce), or general screenshot utilities (e.g., Shutter).
One of unique screenshot utilities is
scrot (short for "SCReen shOT"), which is a command-line screenshot utility. While its interface is minimalistic,
scrot is as powerful as other dedicated GUI-based screen capture tools feature-wise. For example,
scrot supports delayed screenshot, adjustable quality/size, command line pipelining, etc. If you are one of those command line junkies,
scrot is a useful tool to add to your arsenal. In this tutorial, I will describe how to take a screenshot from the command line with
scroton Debian, Ubuntu or Linux Mint:
$ sudo apt-get install scrot
scrot on Fedora:
$ sudo yum install scrot
scrot on CentOS, you can build it from its source by first enabling Repoforge and using the following commands.
$ sudo yum install giblib-devel $ wget http://linuxbrit.co.uk/downloads/scrot-0.8.tar.gz $ tar xvfvz scrot-0.8.tar.gz $ cd scrot-0.8 $ ./configure $ make $ sudo make install
In the rest of the tutorial, I will describe how to use
scrot to take screenshots in various ways.
It is easy to screen-capture the entire desktop. Simply run
scrot command without any argument, and it will save a screenshot of the entire desktop as a (date-stamped) .png file in the current directory.
You can also specify a destination folder and image file name.
$ scrot ~/Pictures/my_desktop.png
scrot allows you to choose a specific window or define a rectangular region in your desktop to take a screenshot of. For that, use the following command.
$ scrot -s
After running this command, go ahead and click on any window or draw a rectangle with your mouse, which will trigger screen capture of the selected window/region.
Sometimes the chosen region or window may be partially blocked by other windows of the desktop. In that case, you need some time to clear the area before taking a shot. That is when delayed screenshot can help you, as described next.
Delayed capture can be useful under various circumstances. Right before taking a shot, you may want to move windows around, activate a menu, or trigger a certain event (e.g., notification), etc. With
-d N option, we can delay a screenshot process by
$ scrot -s -d 5
You can adjust the image quality of a screenshot in the range of
100 (the higher the better quality). Default quality is
$ scrot -q 50
You can adjust the size of a screenshot in the range of
100 (the higher the bigger). To reduce screenshot size to
10% of the original:
$ scrot -t 10
scrot allows you to send a saved screenshot image to any arbitrary command as an input. This option can be useful when you want to do any post-processing on a screenshot image. The filename/path of a screenshot is stored as
$ scrot -e 'mv $f ~/screenshots'
Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.