How To Take screenshots From The Linux Terminal With Scrot
Linux has dozens of screenshotting tools. These tools have different features and allow users to quickly take pictures of what they see on their desktop, save it in different formats, and share it with friends. The trouble is, most of these screenshot tools are bloated GUIs that don’t always work. If you’re tired of GUI screenshot tools that don’t always do their job, the Scrot screenshot tool may be just what you need. It lets you take screenshots from the Linux terminal and saves you the trouble of going through a GUI.
Install Scrot
The Scrot tool is pretty well-known, and many people use it to take screenshots, especially on lightweight desktop environments like LXQt, or with tiling window managers like AwesomeWM, i3, and others. To install the software, open up a terminal window and follow the command instructions that correspond with your Linux operating system.
Note: you need to be running Ubuntu, Debian, Arch Linux, Fedora, or OpenSUSE to run Scrot. If you’re not on one of these Linux distributions, you may need to compile from source.
Ubuntu
sudo apt install scrot
Debian
sudo apt-get install scrot
Arch Linux
sudo pacman -S scrot
Fedora
sudo dnf install scrot -y
OpenSUSE
sudo zypper install scrot
Generic Linux
The Scrot screenshotting tool is one of the best terminal applications that can take screenshots of what’s happening on the Linux desktop. As a result, many distributions — even obscure ones distribute it in their software sources. That said, if you’re not able to find an installable package, building the code from source is the next best thing.
For whatever reason, the website that hosts the downloadable packages for Scrot is down. Luckily, thanks to Archive.org, it’s possible to download the code regardless. In a terminal, use the wget command and grab the Scrot sources.
wget https://web.archive.org/web/20060716123357if_/https://linuxbrit.co.uk:80/downloads/scrot-0.8.tar.gz
Extract the Scrot source code to your Linux PC using the tar command.
tar -xvzf scrot-0.8.tar.gz
Move into the code folder with CD and read the README file using cat.
cd scrot-0.8 cat README
The README file outlines how to build the code, but doesn’t include any information about the dependencies you’ll likely need for a successful build environment. Start the build by running the configure script. This script will scan your Linux PC for the correct dependencies. If you’re missing any, it’ll tell you what to install.
./configure
The configure command will only finish if you’ve got all of the dependencies up and running. If the configure script finishes, build the Scrot software.
make
The make command will compile everything rather quickly, as Scrot isn’t a large piece of software. When the process is complete, finish up by installing it into the system.
su -c "make install"
Using Scrot
Scrot is a terminal application, so to take a screenshot, you’ll need to have quick access to a terminal. Open up a terminal and use the following command to take a screenshot of what’s on your screen.
scrot
If you run the command above, your screenshot will end up in /home/username/. The screenshot is instant, and you’ll get no feedback about the screenshot you just took. Want something a little more user-friendly? Try the “c” switch. Adding the “c” switch to scrot will print out a countdown timer. The timer feature is helpful, as it makes the user more aware of when the screenshot happens.
scrot -c
Want to improve the countdown in Scrot further? Try out the “d” switch. It lets users specify (in seconds) when Scrot should take the shot.
Note: replace X with your desired number.
scrot -cd X
The Scrot screenshot tool lets users take a screenshot of the current window in focus by way of the “z” switch. To use it, do:
scrot -cd X -z
Or, if you prefer not to use a timer, try the following command.
scrot -z
An incredibly useful feature that a lot of screenshotting tools on Linux have is their ability to take screenshots of individual rectangular areas of the desktop. The Scrot screenshot feature also has this ability, and it’s accessible via the “s” switch.
scrot -cd X -s
To take a screenshot of a particular region without a countdown do:
scrot -s
Save Scrot Options
The Scrot screenshot tool has a lot of options, switches, and features. If you’re a newbie, these different options may be hard to remember. While it’s quite easy to use the “h” switch, it’s much better to save the help instructions to a text file for later.
To save the Scrot options for later, you’ll need to run the “h” switch option through the redirect command.
scrot -h >> ~/Documents/scrot-options.txt
At any time, you can open up the Scrot document file you’ve saved for later by launching the file manager, clicking on “Documents” and looking for “scrot-options.txt.”