October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
Bash

How to Take Screenshots with gnome-screenshot in Bash

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use gnome-screenshot --file="$HOME/Pictures/capture.png" for a predictable whole-screen capture from Bash. Add --window for the active window, --area for a mouse-selected region, --delay=5 to wait, --include-pointer to show the pointer, or --clipboard to send the image to the clipboard.

Quick answer: the Bash commands

The Debian manual for gnome-screenshot documents three capture targets: the entire screen (the default), the currently active window, and a user-selected area. Always pass an explicit, quoted destination when scripting so spaces in directory or file names do not break the command.

# Whole screen
output="$HOME/Pictures/capture.png"
gnome-screenshot --file="$output"

# Active window
gnome-screenshot --window --file="$output"

# Select an area with the mouse
gnome-screenshot --area --file="$output"

# Put the capture on the clipboard
gnome-screenshot --clipboard

# Wait five seconds, then capture
gnome-screenshot --delay=5 --file="$output"

# Include the pointer
gnome-screenshot --include-pointer --file="$output"

These option names and behaviors are documented for Debian package source version 41.0-3. Your distribution may ship a different release, omit the binary, or expose different options, so begin with gnome-screenshot --help on the machine where the script will run.

Before you script: verify the local command

Check whether it is installed

Run:

command -v gnome-screenshot
gnome-screenshot --help

If the first command prints a path and the second prints usage information, the executable is available to your shell. If the command is missing, install the package using your distribution’s normal package manager, then repeat both checks. Package names and repositories vary, and the cited documentation does not establish a cross-distribution installation command.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents

Use an explicit output directory

Create a directory and quote the variable in the capture command:

set -euo pipefail
out_dir="$HOME/Pictures/bash-captures"
mkdir -p "$out_dir"
out_file="$out_dir/$(date +%Y%m%d-%H%M%S).png"
gnome-screenshot --file="$out_file"
printf 'Saved %sn' "$out_file"

The quoted assignments and argument protect paths containing spaces. Supplying --file also avoids confusing the graphical GNOME save location with the CLI’s behavior.

Choose what to capture

Need Command What happens
Entire screen gnome-screenshot --file="$output" Captures the whole screen; this is the default target.
Focused window gnome-screenshot --window --file="$output" Captures the current active window.
Rectangular selection gnome-screenshot --area --file="$output" Starts an interactive selection so you can drag over an area.
Clipboard only gnome-screenshot --clipboard Sends the capture to the clipboard instead of naming a file.

Whole-screen capture

Use the default target when you need everything visible across the screen. An explicit file path makes the result discoverable by later Bash commands, backup jobs, or upload steps.

Active-window capture

--window selects the current active window at capture time. Arrange focus first if you are running the command manually. In an unattended script, do not assume a particular window will remain focused; the option is tied to the active window rather than a window title or process identifier.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Area selection

--area opens the documented user-driven selection flow. You drag to define the region and release to capture it. The Debian documentation consulted does not establish numeric-coordinate arguments or a fully unattended area-selection mode, so do not build a cron job that expects --area to choose coordinates by itself.

Control timing and pointer visibility

Delay a capture

--delay=SECONDS postpones the grab. This is useful when you need to open a menu, move a window, or hide the terminal before the image is taken:

Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
gnome-screenshot --delay=5 --file="$HOME/Pictures/menu.png"

The value is expressed in seconds. Keep the destination explicit; the delay changes when the image is captured, not where it is saved.

Include the pointer

Add --include-pointer when the cursor position is part of the explanation or demonstration:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
gnome-screenshot --include-pointer --file="$HOME/Pictures/with-pointer.png"

Leave the option out when you want a cleaner image without the pointer.

Interactive settings

--interactive opens a dialog for choosing options. It is convenient for a one-off desktop capture, but a dialog and human choices make it less suitable for unattended Bash automation. For scripts, specify the target, destination, and timing directly.

Save to a file or copy to the clipboard

File output

The --file=FILENAME option writes directly to the path you provide:

file="$HOME/Pictures/release-review.png"
gnome-screenshot --file="$file"

Use a filename extension that matches the image format your local build produces, and verify the resulting file with your normal image viewer or file tools. The cited manual defines the file option but does not promise a distribution-wide default filename or format conversion policy.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.

Clipboard output

Use:

gnome-screenshot --clipboard

This sends the grab to the clipboard rather than creating a named output file. If a later step needs a durable artifact, use --file instead; a clipboard item is not a path that another Bash process can open.

Practical Bash recipes

Timestamped whole-screen images

#!/usr/bin/env bash
set -euo pipefail

folder="$HOME/Pictures/gnome-captures"
mkdir -p "$folder"
name="capture-$(date +%Y-%m-%d_%H-%M-%S).png"
gnome-screenshot --file="$folder/$name"
printf 'Created %sn' "$folder/$name"

This pattern keeps captures in one directory and generates a distinct name from the current date and time. If two invocations happen within the same timestamp resolution, choose a naming scheme appropriate to your workflow.

Delayed capture after arranging the desktop

#!/usr/bin/env bash
set -euo pipefail

destination="$HOME/Pictures/after-arrangement.png"
gnome-screenshot --delay=8 --file="$destination"
printf 'Saved %sn' "$destination"

Start the script, arrange the desktop during the delay, and let the utility capture the whole screen.

Capture the focused window with the pointer visible

window_file="$HOME/Pictures/focused-window.png"
gnome-screenshot --window --include-pointer --file="$window_file"

Focus the intended window before running this command. The utility does not select a window by application name in the documented options.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Automation limits and desktop context

GNOME’s graphical screenshot help describes a desktop interface that saves screenshots in the user’s Pictures/Screenshots folder and copies them to the clipboard. That is UI documentation, not proof that every CLI release uses that folder by default. Scripts should therefore pass --file and an absolute or fully expanded destination.

GNOME’s shortcut reference lists Print to launch the screenshot tool, Alt+Print for the focused window, and Shift+Print for the entire screen. Those shortcuts are a useful desktop fallback, but the shortcut page does not claim that they invoke this executable with the same flags.

Rank #4
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
  • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
  • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
  • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
  • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient

GNOME Terminal documentation establishes that terminal commands can launch command-line and graphical programs. It provides workflow context, not additional semantics for gnome-screenshot.

Wayland, distributions, and version differences

The verified option reference is Debian’s unstable manual and package source for version 41.0-3. It is not a compatibility matrix for all Linux distributions, GNOME releases, or display sessions. Test the exact environment used by your script:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
printf 'Executable: '
command -v gnome-screenshot
gnome-screenshot --help

If a flag is rejected, follow the local help output rather than assuming Debian’s option set applies unchanged.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting

gnome-screenshot: command not found

The executable is not on PATH or is not installed. Confirm with command -v gnome-screenshot, install the package supplied by your distribution, and run --help again.

The image is saved somewhere unexpected

Do not rely on a graphical default folder. Add --file with a quoted path, create the parent directory with mkdir -p, and print the path after capture.

A path containing spaces fails

Quote both the variable assignment and the option value, for example output="$HOME/Pictures/Project Screens/capture.png" followed by gnome-screenshot --file="$output".

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
  • 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
  • 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.

The active-window image shows the wrong window

--window uses whichever window is active when the grab occurs. Focus the intended window immediately before running the command, and avoid treating the option as a title- or process-based selector.

The area command waits for input

That is the documented interactive behavior of --area. It requires a user selection; the supplied option reference does not document coordinate arguments for unattended selection. Use whole-screen or active-window capture for non-interactive jobs.

The pointer is missing

Add --include-pointer. Without that flag, the pointer is not requested in the command.

A script uses a flag that works on another machine

Compare gnome-screenshot --help and the installed package version on both systems. The cited Debian 41.0-3 documentation may not match your distribution’s build.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Or skip the browser setup

If you need screenshots of web pages rather than the local GNOME desktop, ScreenshotNeo provides a website screenshot API and MCP server. One GET request returns a PNG, JPEG, WebP, or PDF, without installing or driving a local browser.

See the ScreenshotNeo API documentation for all parameters. A minimal Bash-compatible cURL call is:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

The same request in Python is:

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

ScreenshotNeo accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be disabled. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing result. Its MCP server exposes take_screenshot, get_page_info, and capture_pdf to Claude, Cursor, and other MCP clients. Every plan includes its features; 1,000 screenshots per month are free with no card, Starter is $5 for 3,000, Growth $15 for 15,000, Pro $39 for 60,000, Scale $99 for 250,000, and Business $249 for 1,000,000. Yearly billing gives two months free. Create a free ScreenshotNeo account to start with the 1,000 no-card screenshots.

Frequently Asked Questions

Do GNOME’s Print-key shortcuts guarantee the same file location as the Bash command?

No. The shortcut reference documents which key combinations launch screenshot actions, while the CLI manual documents command options. Use an explicit --file path when a script needs a known location.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Is the Debian 41.0-3 option set a promise for every Linux installation?

No. It is the version context for the cited Debian manual and source. Check gnome-screenshot --help on the distribution and desktop session where your script will run.

Can the documented --area option select a rectangle from numeric coordinates?

The cited documentation describes a user-drawn selection and does not establish a coordinate-based or unattended area interface.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Read next

Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.