There are a lot ways to take screenshot in Linux. scrot is a very useful command-line tool for taking screenshots.
scrot is pre-installed in most Linux distributions. When it is not installed, just run the basic installation command in your terminal.
$ sudo apt-get install scrot
How do you use scrot to take screenshot? scrot takes screenshots quickly and silently.
Take a screenshot of the whole desktop
Open a terminal and type scrot then hit Enter.
The image captured will be stored in the current directory and its name by default will be in the format:
Also you can specify your choice name and image type by using this command:
$ scrot ~/Photos/unixmen.jpg
The above command will capture the full desktop and save it in Photos folder with name unixmen and image type jpg.
Take a screenshot of selected desktop area
scrot also a feature that enable you to take sscreenshot of any selected area of the screen. It is just awesome.
Type the command below in the terminal and hit Enter:
$ scrot -s
After hitting enter, drag the mouse over the area to capture and release the button.
To take a screenshot of the whole screen with scrot after a specific time, you need to add the “-d” (delay) argument to the scrot command with the time in seconds. So to take a screenshot in 7 seconds, here is the format:
$ scrot -d 7 unixmen.jpg
This will capture the whole screen after exactly 7 seconds and save it in the Home folder with name unixmen.jpg.
You can also use the parameter “-c” in addition to “-d” to print countdown to screenshot in the terminal. Example:
$ scrot -d 7 -c unixmen.jpg
This starts counting down from 8.. 7.. 6.. 5.. 4.. 3.. 2.. 1.. 0.. (as shown below) immediately it reaches 0 a screenshot is taken, named unixmen.jpg located in the Home folder.
Adding “-q” to the command also sets the quality of the image captured.
Capture and edit
You can also take a screenshot, open and edit it on the go using GIMP by combining two commands. Use the format below:
$ scrot -q 90 -d 7 unixmen.png && gimp unixmen.png &
The above command is made up of two commands. One for taking the screenshot with scrot (scrot -q 90 -d 7 unixmen.png) and the other for opening the newly created screenshot image on GIMP (gimp unixmen.png).
The && is the AND logic operator which tells the terminal “If the first command is true, then perform the second one”. The & at the end means the commands will be run in the background so that the terminal can be used for other commands if needed.
For more information about scrot, type the command below to read the man page:
$ man scrot