How to use scrot - a command line tool to take screenshot

How to use scrot
There are many ways to take screenshots. In distros like Ubuntu, Mint or Fedora, the tool is either gnome-screenshot or mate-screenshot. You can also use more complicated tools like shutter or GIMP. They are good at what they do. But I myself always want to take screenshots quickly and silently , thats why scrot - a command line tool - is always my favorite.

Scrot is most likely not pre-installed in all distros but installing scrot is easy since it is available in every repository. You hence just need to open the terminal and type the basic installing command to install scrot.

How to use scrot

Using scrot is very easy. Since it is just a script, the best way is to hit Alt + F2 then type the command to take screenshot. Of course, other tools like gnome-screenshot can be used in the command line as well but typing "scrot" is much easier than "gnome-screenshot", thats why I always prefer scrot. You can also assign scrot to the printscreen key as well, just edit it in the keyboard shortcut settings.

The basic command with scrot is:

This command will take the screenshot of your whole desktop. By default, the file name will have the following format: "date-time_screen-resolution_scrot.png" ( like 2013-03-27-202325_1366x768_scrot.png). The file will be stored in your current directory, usually the home folder.

But if you want to change the file extension and the folder, you can just tell scrot. For example:
 scrot ~/Pictures/example.jpg  
Scrot allows you to take more than simple screenshots. To take screenshot of a part of the screen, just hit Alt + F2 then run the following command:
 scrot -s  

After you hit enter, drag the cursor to draw out the area for your screenshot.

To take screenshot in delay with scrot, the option you can use is "-d". For example, to take a screenshot after 5 seconds, the command is:
 scrot -d 5  

An option you can use together with "-d" is "-c", which means countdown. When you run the command in the terminal using both these options, you will see scrot counting to zero before taking the sreenshot like in the image below:

How to use scrot command

Some other useful option you can use is  "-t" - to take the thumbnail of the screen with a percentage by which you want to compress it. Another option is "-q" meaning the quality of the screenshot (75% is the default value).
linux tips and tricks