How to take a screenshot from the command line on Linux There are various flavors of Linux screenshot utilities, including ...
How to take a screenshot from the command line on Linux
Install Scrot on Linux
To install Scrot on Debian, Ubuntu or Linux Mint:To install Scrot on Fedora:$ sudo apt-get install scrot
To install Scrot on CentOS, you can build it from its source as follows.$ sudo yum install scrot
First enable Repoforge on CentOS, and use 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
Take Screenshots with Scrot
In the rest of the tutorial, I will describe how to use Scrot to take screenshots in various ways.1. Take a screenshot of the entire desktop
Screen-capturing the entire desktop is easy. 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
$ scrot ~/Pictures/my_desktop.png
2. Take a screenshot of a particular window or a rectangular region
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.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.$ scrot -s
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.
3. Take a delayed screenshot
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 N seconds.$ scrot -s -d 5
4. Adjust quality of a screenshot
You can adjust the image quality of a screenshot in the range of 1 to 100 (the higher the better quality). Default quality is 75.$ scrot -q 50
5. Adjust the size of a screenshot
You can adjust the size of a screenshot in the range of 1 to 100 (the higher the bigger). To reduce screenshot size to 10% of the original:$ scrot -t 10
6. Pipeline a captured screenshot to another command
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 "$f" string.source$ scrot -e 'mv $f ~/screenshots'
COMMENTS