Scrot: Linux command-line screen grabs made simple

Scrot is a basic, flexible tool that offers a number of handy options for taking screen captures from the Linux command line.
333 readers like this.
Penguins on beach

Original photo by Rikki Endsley. CC BY-SA 4.0

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].

The -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].

The -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].

The -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:

  • -b also grabs the window's border
  • -t grabs a window and creates a thumbnail of it. This can be useful when you're posting screen captures online.
  • -c creates a countdown in your terminal when you use the -d option.

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.

Tags
That idiot Scott Nesbitt ...
I'm a long-time user of free/open source software, and write various things for both fun and profit. I don't take myself all that seriously and I do all of my own stunts.

8 Comments

Scrot is still useful but is now unmaintainable. I would recommend Maim as its replacement!

Would you be interested in writing an article about Maim for Opensource.com? If so, you can find out how to do that here.

In reply to by oldgaro (not verified)

Scrot is used in Raspian Pixel and it works great.

Its nice, but quite clunky, I think because of the way society is living in the "touchscreen/point-and-click" mentality? not many will find this useful. But I still love it.

True, but then again a tool like Scrot isn't for everyone. Is that a bad thing? No. It's just the way it is. You like it or you don't. You use it or you don't. I don't use Scrot often, but I'm grateful for it when I need it.

In reply to by Eddie G. (not verified)

What about Shift+PrintScreen ? It do the same

What about it? There's more than one way to do the deed. And Shift+PrintScreen might not be a viable option - for example, on my Chromebook (which runs GalliumOS) there's no PrintScreen key on the keyboard.

In reply to by Lalo_uy

Unfortunately, scrot doesn't work under Wayland. Neither does Shutter, more's the pity.

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.