May 13, 2020

Scrot useful options

When I wrote this post about installing KVM and virt-manager, screenshotting the windows that I was seeing was the easiest way to describe the steps to follow. On linux, one of the most used tools for that is scrot.

As I used it in a few ways, I wanted to have a little reference, for the next times I have to use it.

Basic commands

The simple command will let you screenshot the whole desktop you’re currently on If you have multiple screens, this will capture only the current screen. To capture multiple screens, use the -m option.

scrot

To capture only the selected window, with the window border

scrot -u -b

Running this will ask you to select an area to screenshot

scrot -s

Saving to a specific place just requires the name of the file

scrot ~/Images/Screenshot-$(date +%F-%R).png

Tip: Create keybindings for those commands. It will be much easier if you want to screenshot a specific window.

Screenshoting menus

This may be KDE specific, but the keybinding I created did not launch the command while opening a menu (File, for example). To solve this, I added a delay of 2 seconds with the -d option, which gave me time to open the dialog

scrot -u -b -d 2 ~/Images/Screenshot-$(date +%F-%R).png

A work in progress

This list of commands may grow, or change with new uses I find of scrot. For now, this is good enough for me, and will probably let me avoid searhing through the man page for a bit.

Copyright Marin Gilles 2019-2022