Scrot: A Command Line Tool to Take Desktop/Server Screenshots Automatically in Linux

Scrot is a command-line tool in Linux that enables users to capture desktop or server screenshots automatically. By executing simple commands, users can take screenshots of their entire desktop or specific regions with precise control. Scrot offers various options for capturing screenshots, such as setting a delay before capture, selecting the output file format, and specifying the storage location. With its simplicity and flexibility, Scrot streamlines the process of taking screenshots in Linux, whether for documentation, troubleshooting, or sharing visual information.

Features

  • Full desktop capture Take screenshots of the entire screen

  • Region selection Capture specific areas interactively

  • Delay functionality Add time delays before capturing

  • Multiple formats Support for PNG, JPEG, and other image formats

  • Automatic naming Timestamped filenames for organization

Capture the Entire Desktop

The simplest way to use Scrot is capturing the complete desktop. This command captures the entire screen content and saves it as an image file in the current directory with a timestamped filename.

Basic Full Screen Capture

scrot

Capture with Custom Filename

scrot desktop_screenshot.png

Capture with Quality Settings

scrot -q 75 screenshot_%Y%m%d_%H%M%S.jpg

The %Y%m%d_%H%M%S format creates timestamps like 20241201_143022 for easy organization.

Capture a Specific Region

Scrot can capture specific regions of the screen using the -s (select) option. This enters interactive selection mode where you can click and drag to define the area to capture.

Interactive Region Selection

scrot -s region_screenshot.png

Window Selection

scrot -u window_screenshot.png

The -u option captures the currently focused window, while -s allows manual selection of any rectangular area on the screen.

Add a Delay Before Capturing

The delay functionality allows you to prepare your screen or navigate to a specific application before the screenshot is taken. Use the -d option followed by the number of seconds to wait.

Delay Examples

# Wait 5 seconds before capturing
scrot -d 5 delayed_screenshot.png

# Combine delay with region selection
scrot -d 3 -s delayed_region.png

# Delay with window capture
scrot -d 2 -u delayed_window.png

Common Use Cases

Use Case Command Description
System monitoring scrot -d 1 system_%H%M.png Automated periodic screenshots
Documentation scrot -s -q 90 guide_step1.png High-quality region captures
Bug reporting scrot -u error_window.png Capture specific application windows
Server monitoring scrot /var/log/screenshots/server_%Y%m%d.png Save to specific directories

Advanced Options

# Capture with border (adds 5px border)
scrot -b -s bordered_screenshot.png

# Multiple screenshots with countdown
scrot -c -d 3 countdown_screenshot.png

# Execute command after capture
scrot -e 'echo "Screenshot saved as $f"' screenshot.png

# Combine multiple options
scrot -d 2 -s -q 85 -e 'xdg-open $f' interactive_capture.png

Conclusion

Scrot is a powerful and versatile command-line screenshot tool that simplifies screen capture tasks in Linux environments. Its combination of full desktop capture, region selection, delay functionality, and automation features makes it ideal for system administration, documentation, and troubleshooting workflows. The tool's lightweight nature and extensive command-line options provide efficient screenshot capabilities directly from the terminal.

Updated on: 2026-03-17T09:01:39+05:30

495 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements