There are great tools on the Linux desktop for taking screen captures, such as KSnapshot and Shutter. Even the simple utility that comes with the GNOME desktop does a pretty good job of capturing screens. But what if you rarely need to take screen captures? Or you use a Linux distribution without a built-in capture tool, or an older computer with limited resources?
Turn to the command line and a little utility called Scrot. It does a fine job of taking simple screen captures, and it includes a few features that might surprise you.
Getting started with Scrot
Many Linux distributions come with Scrot already installed—to check, type
which scrot. If it isn't there, you can install Scrot using your distro's package manager. If you're willing to compile the code, grab it from GitHub.
To take a screen capture, crack open a terminal window and type
scrot [filename], where
[filename] is the name of file to which you want to save the image (for example,
desktop.png). If you don't include a name for the file, Scrot will create one for you, such as
2017-09-24-185009_1687x938_scrot.png. (That filename isn't as descriptive it could be, is it? That's why it's better to add one to the command.)
Running Scrot with no options takes a screen capture of your entire desktop. If you don't want to do that, Scrot lets you focus on smaller portions of your screen.
Taking a screen capture of a single window
Tell Scrot to take a screen capture of a single window by typing
scrot -u [filename].
-u option tells Scrot to grab the window currently in focus. That's usually the terminal window you're working in, which might not be the one you want.
To grab another window on your desktop, type
scrot -s [filename].
-s option lets you do one of two things:
- select an open window, or
- draw a rectangle around a window or a portion of a window to capture it.
You can also set a delay, which gives you a little more time to select the window you want to capture. To do that, type
scrot -u -d [num] [filename].
-d option tells Scrot to wait before grabbing the window, and
[num] is the number of seconds to wait. Specifying
-d 5 (wait five seconds) should give you enough time to choose a window.
More useful options
Scrot offers a number of additional features (most of which I never use). The ones I find most useful include:
-balso grabs the window's border
-tgrabs a window and creates a thumbnail of it. This can be useful when you're posting screen captures online.
-ccreates a countdown in your terminal when you use the
To learn about Scrot's other options, check out the its documentation by typing
man scrot in a terminal window, or read it online. Then start snapping images of your screen.
It's basic, but Scrot gets the job done nicely.