Talking about screenshot apps, there are a lot of them. There’s Shutter, GIMP, Kazam and many more. But there’s a problem, most of these applications use a graphical user interface(GUI). But what if you are more of a command-line person?
Fortunately for you, there’s scrot, a terminal-based app that can take screenshots on Ubuntu. Scrot is a open source screenshot capturing tool that uses the
imlib2 library to acquire and save images.
It’s an flexible and powerful command line utility for taking screen shots of your Desktop, Terminal or a Specific Window manually or automatically by Cron job. Scrot allows substantial degree of flexibility by specifying parameters on command line including the ability to invoke a third-party utility to manipulate the resulting screenshot.
It supports multiple image formats (PNG, JPG, GIF, etc), which you can specify while taking screen shots by using the tool.
Key Features of Scrot
- Free and Open-Source
- Installation is extremely straightforward
- Can take screenshots easily
- Optimize the quality of the screenshots
- Can take screenshots automatically with the help of cron
Installing Scrot from Ubuntu apt repository
Scrot is included in Ubuntu 20.04. Follow the step by step guide to install the application.
Type the following command to update the apt sources.
$ sudo apt update
Now execute this command to install the Scrot package.
$ sudo apt install scrot
With the help of
&& you can write both the commands in a single line. Something like this:
$ sudo apt update && sudo apt install scrot
At this step, you have successfully installed Scrot on Ubuntu 20.04 system.
How to Use scrot to Capture Screenshots
As I said, Scrot can capture a specific window, entire desktop or a terminal. With the help of scrot you can also take screen shots of a shell/terminal of a system that doesn’t have a Graphical User Interface(GUI) support.
1. Take a Screenshot of the Desktop
Type the following command to take screenshot of entire Desktop with specific name. Here we named the file as
$ scrot desktop.jpg
Note: By default, scrot saves the screenshots in your current working directory.
2. Capture the Current Window
If you want to capture a screenshot of whatever that is on focus on your screen now, be it an app, a browser window, or something else, you can use this command.
$ scrot -u current_window.jpg
3. Save Screenshot at a specific Directory
If you want to save your screenshots at a specific directory location, you simply have to change your directory or mention the complete directory path. Here is an example.
$ scrot mydata/test.jpg
4. Adjusting the Image Quality
With the help of option
-q you can specify the quality level of the image between 1 and 100.
The default image level is set to 75, and the image output will be different depending upon the file format you specify. The following command will capture an image at 90% the quality of the original high quality screen.
$ scrot -q 90 mydata/testing.jpg
5. Include window border in screenshots
-u command line option we discussed earlier doesn’t include the window border in screenshots.
However, you can include the border of the window if you want. This feature can be accessed using the
-b option (in conjunction with the
-u option of course).
$ scrot -ub testing.jpg
6. Delay in taking screenshots
You can introduce a time delay while taking screenshots. For this, you have to assign a numeric value to the
-d command line option.
$ scrot --delay [NUM]
Here is an example:
$ scrot --delay 5 testing.jpg
The above command will wait for 5 seconds before taking the screenshot.
7. Countdown before screenshot
The tool also allows you to display countdown while using delay option. This feature can be accessed using the
-c command line option.
$ scrot –delay [NUM] -c
$ scrot -d 5 -c mysnap.jpg
I hope that now you have a good understanding of How to install Scrot on Ubuntu 20.04 LTS Focal Fossa.
If anyone does have any questions about what we covered in this guide then feel free to ask in the comment section below and I will do my best to answer those.