scrot
Take screenshots from the command line
TLDR
Capture a screenshot and save it to the current directory with the current date as the filename
Capture a screenshot and save it as capture.png
Capture a screenshot interactively
Capture a screenshot interactively without exiting on keyboard input, press
Capture a screenshot interactively delimiting the region with a colored line
Capture a screenshot from the currently focused window
Display a countdown of 10 seconds before taking a screenshot
SYNOPSIS
scrot [OPTIONS] [FILE]
PARAMETERS
-s, --select
Interactively select a rectangular area of the screen with the mouse to capture.
-u, --focused
Capture the currently focused window.
-b, --border
Include the window's border when capturing a focused window (used with -u).
-m, --monitor NUM
Select a specific monitor to capture. NUM refers to the monitor index.
-d, --delay SECONDS
Wait for the specified number of SECONDS before taking the screenshot. Useful for setting up the screen.
-c, --count
Display a countdown in the terminal while waiting for the delay.
-z, --compression PERCENT
-q, --quality PERCENT
Set the JPEG compression/quality level (0-100). Higher values mean better quality but larger files.
-e, --exec COMMAND
Execute a specified COMMAND after the screenshot is taken. The filename of the screenshot is passed as a string to the command.
-t, --thumb PERCENT|SIZE
Create a thumbnail of the screenshot. PERCENT scales the original image (e.g., 50), or SIZE specifies the maximum dimension in pixels (e.g., 200px).
-h, --help
Display a help message and exit.
-v, --version
Display version information and exit.
--display DISPLAY
Specify the X display to connect to.
--overwrite
Overwrite the target file if it already exists without prompting.
DESCRIPTION
scrot (SCReenshOT) is a simple, command-line utility designed for taking screenshots on X Window System environments. Unlike more feature-rich GUI screenshot tools, scrot prioritizes minimalism and efficiency, making it an excellent choice for scripting, automation, or users who prefer command-line workflows and lightweight desktop environments. It can capture the entire screen, a specific window, or a user-selected rectangular area. scrot supports various image formats, including JPEG and PNG, and offers basic options for quality, delay, and execution of post-capture commands. Its straightforward design and minimal dependencies make it a popular tool for users looking for fast and reliable screen capturing without bloat.
CAVEATS
scrot is specifically designed for the X Window System. It does not natively support Wayland, which is a newer display server protocol. Users on Wayland environments will typically need to use other tools like grim, swaygrab, or gnome-screenshot (which often has Wayland compatibility) or rely on Xwayland compatibility layers, which might not always provide optimal results. Its simplicity means it lacks advanced features like annotation, direct editing, or cloud integration, which are common in more comprehensive GUI screenshot applications.
FILENAME FORMATTING
By default, scrot generates filenames based on the current date and time. Users can customize the filename using various format specifiers passed directly to the command as an argument. Common specifiers include:
%Y (year), %m (month), %d (day), %H (hour), %M (minute), %S (second), %F (full date), %T (full time), %s (unix timestamp), $n (hostname), $i (image width), $h (image height), $f (image format). For example, scrot '%Y-%m-%d-$wx$h.png'
would save a file like 2023-10-27-1920x1080.png
.
SCRIPTING AND AUTOMATION
Due to its command-line nature, scrot is exceptionally well-suited for integration into shell scripts. This allows users to automate tasks like taking timed screenshots, capturing specific window states, or processing screenshots with other command-line tools (e.g., uploading to a server using curl after capture via the -e option). Its ability to be chained with other commands makes it a powerful component in more complex automated workflows.
HISTORY
scrot emerged as a lightweight and efficient screen capture tool, particularly popular among users of minimalist window managers such as Openbox, Fluxbox, and i3wm. Its development was driven by the need for a simple command-line solution that integrated seamlessly into scripts and offered quick, unburdened screen capture without the overhead of larger graphical applications. It fills a niche for users who prioritize speed and simplicity, reflecting a common philosophy in the Linux ecosystem of providing small, single-purpose utilities that can be combined to achieve more complex tasks. While its core functionality has remained consistent, its enduring popularity underscores its effectiveness in the specific niche it serves.
SEE ALSO
import(1), gnome-screenshot(1), spectacle(1), grim(1)