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

The best Linux screenshot command depends on your display session. Use scrot or maim on X11, and grim with slurp on Wayland. ImageMagick’s import is useful when capture belongs in an X11 image-processing pipeline, while Flameshot offers both CLI and interactive workflows but may require desktop-portal configuration. First identify whether your session is X11 or Wayland; no single command is native to every Linux desktop.

Check whether you are running X11 or Wayland

Open a terminal and run:

echo "$XDG_SESSION_TYPE"

The result is normally x11 or wayland. You can also inspect the desktop session with:

loginctl show-session "$XDG_SESSION_ID" -p Type

Choose an X11 utility for an X server. Wayland compositors restrict direct screen access, so a Wayland-native utility or a desktop portal is required. Package names and versions differ by distribution; use your distribution’s current package source rather than copying an installation command intended for another release.

Quick comparison

Tool Session Best for Selection and output Important dependency or caveat
scrot X11 Small, scriptable file captures Desktop, window and rectangle; image files Needs access to an X server
maim X11 Region selection and Unix pipelines Window or region; file or stdout, including clipboard pipelines Interactive selection commonly uses slop
grim Wayland Compositor-native screenshots All outputs, one output or fixed/selected region; file or stdout Requires a compositor implementing the capture protocol; pair with slurp for selection
ImageMagick import X11 Capture followed by ImageMagick processing Root window, selected window or interactive area X-server-specific and interactive by design
Flameshot Desktop-dependent CLI commands plus annotation-oriented interaction Full screen, screen or GUI; path, clipboard, delay and raw PNG options Wayland portal and compositor setup can affect capture
gscreenshot Multiple backends One frontend over installed screenshot programs Depends on selected backend Functionality depends on installed tools and setup

scrot: the compact X11 choice

scrot is a straightforward X-server capture utility. It supports several image formats, quality settings, delays, selected windows and rectangular areas, plus script hooks. It is a good default when you need a command that writes a file and your session is X11.

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

Capture the complete desktop

scrot "$HOME/Pictures/screenshot-%Y%m%d-%H%M%S.png"

The filename pattern is expanded with the capture time. Create the destination directory first if it does not exist:

mkdir -p "$HOME/Pictures"

Capture a window or rectangle

# Select a window interactively
scrot -s "$HOME/Pictures/window.png"

# Select a rectangular region interactively
scrot -s -b "$HOME/Pictures/region.png"

Exact option behavior can vary with the installed scrot version, so check man scrot for your package’s switches. Use a delay when you need to open a menu or move the pointer before the capture:

scrot -d 5 "$HOME/Pictures/delayed.png"

When scrot is the right fit

  • You are on X11 and want a minimal dependency footprint.
  • Your script needs a predictable file rather than an interactive editor.
  • You need basic format, quality, delay or window/area controls.

Do not treat scrot as a native Wayland capture tool. Under Wayland, an X11 compatibility layer may be present, but that does not make direct X-server capture equivalent to compositor-native capture.

maim: X11 screenshots that flow through Unix pipes

maim captures the desktop and encodes PNG, JPEG, BMP or WebP. Its documented default is to write image data to standard output, which makes it particularly useful for piping bytes into another command. It also supports predetermined window or region capture and interactive selection, commonly with slop.

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

Write a complete desktop image

mkdir -p "$HOME/Pictures"
maim "$HOME/Pictures/desktop.png"

Select a region or window

# Interactive region selection (slop must be installed)
maim -s "$HOME/Pictures/region.png"

# Interactive window selection, where supported by your maim build
maim -i "$(xdotool selectwindow)" "$HOME/Pictures/window.png"

The second example uses xdotool, an additional X11 utility. If your workflow already has a window ID, pass that ID directly instead of invoking a selector.

Copy a screenshot to an X11 clipboard

maim -s | xclip -selection clipboard -t image/png

This is the pattern documented by the project: maim emits encoded image data and xclip places it on the clipboard. A pipeline is often cleaner than creating a temporary file when another process can consume the bytes immediately.

Choose maim over scrot when

  • Your next step reads standard input.
  • You want region selection integrated with slop.
  • You need PNG, JPEG, BMP or WebP output from an X11 command.

grim and slurp: the Wayland baseline

grim is designed to grab images from a Wayland compositor. Its README shows commands for all outputs, a named output, fixed regions and selected regions. slurp supplies the interactive geometry selector.

Capture all outputs

grim "$HOME/Pictures/all-outputs.png"

Capture a selected output

grim -o DP-1 "$HOME/Pictures/monitor.png"

Replace DP-1 with an output name reported by your compositor or desktop tools. Output naming is compositor and hardware dependent.

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

Capture a fixed or interactively selected region

# Fixed geometry (example coordinates)
grim -g "100,100 1200x800" "$HOME/Pictures/fixed.png"

# Select a region with slurp
grim -g "$(slurp)" "$HOME/Pictures/region.png"

Copy directly to a Wayland clipboard

grim - | wl-copy

This requires wl-copy from the wl-clipboard package. For a selected region in the clipboard:

grim -g "$(slurp)" - | wl-copy

Capture support depends on the compositor implementing the protocol grim uses. The project’s GitHub repository was archived on 2022-03-30 after development moved to SourceHut, so check your distribution’s current package and the project’s current hosting before assuming the archived repository reflects active maintenance.

ImageMagick import: capture and process in one X11 workflow

ImageMagick documents import as a tool for capturing some or all of an X server screen. It can select a window or area interactively, or capture the root window. Use it when ImageMagick is already part of your pipeline.

# Capture the root window
magick import -window root "$HOME/Pictures/screen.png"

# Select a window or area interactively
magick import "$HOME/Pictures/selection.png"

You can hand the result to another ImageMagick operation without changing tools:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
magick import png:- | magick - -resize 50% "$HOME/Pictures/half-size.png"

The command is X-server-specific. It is not a Wayland-native replacement for grim.

Flameshot: CLI commands with desktop integration

Flameshot’s command-line options include gui, screen and full. Depending on the command, you can specify an output path, clipboard behavior, delay, region and raw PNG output.

Common command forms

# Open the interactive capture interface
flameshot gui

# Capture a screen and save it
flameshot screen -p "$HOME/Pictures/screen.png"

# Capture the full desktop
flameshot full -p "$HOME/Pictures/full.png"

# Put a full capture on the clipboard
flameshot full -c

Run flameshot --help on your installed version because option names and combinations are version-sensitive. Flameshot can be convenient when you want annotations or an interactive workflow, but its CLI does not remove desktop integration requirements.

Wayland permissions and portals

Flameshot’s Wayland help describes capture-permission and portal setup problems in some GNOME environments. If a command opens but produces no image, follow that guide for your compositor and portal implementation. Do not assume a command that works under KDE or one GNOME release will work identically elsewhere.

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

gscreenshot: a backend-selecting frontend

gscreenshot can combine backends such as scrot, ImageMagick, grim, xdg-desktop-portal and slurp. Its usefulness is integration rather than a new capture protocol: the installed backend and desktop setup determine what actually works. Treat it as a convenience frontend, not evidence that every backend is available on every Linux desktop.

Choose by the task you need to automate

Capture a region

  • X11: maim -s output.png with slop, or scrot’s selection mode.
  • Wayland: grim -g "$(slurp)" output.png.

Capture a specific window

  • X11: scrot’s window-selection mode or maim with a window ID.
  • Wayland: use compositor-supported output or region selection; window capture is not uniformly exposed by every compositor.

Capture all outputs

Use grim output.png on Wayland. On X11, use scrot, maim or magick import -window root, remembering that the root window’s geometry reflects your X server layout.

Copy a screenshot to the clipboard

  • Wayland: grim - | wl-copy.
  • X11: maim -s | xclip -selection clipboard -t image/png.
  • Flameshot: use its clipboard option when your desktop integration is configured.

Reliability, performance and cost considerations

No authoritative documentation in this comparison provides benchmark figures, so claims about one tool being faster or producing better image quality would be speculation. In practice, reliability is dominated by session type, compositor protocol support, installed helper programs and portal permissions.

  • For repeatable scripts: prefer fixed geometry, explicit output paths and a known format. Avoid interactive selectors in unattended jobs.
  • For pipelines: use maim or grim stdout output and feed it directly to clipboard, storage or an image processor.
  • For multi-monitor setups: identify output names and test each output; scaling and compositor layout can change coordinates.
  • For delayed captures: use a delay only when needed, because it makes automation slower and can capture a changed screen.
  • For unattended services: verify the process has access to the display environment and authorization; a shell launched outside the graphical session may not.

These utilities are local software rather than metered hosted services. Their practical cost is package installation and maintenance, plus any dependencies such as slurp, slop, wl-clipboard, xclip or portal components.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting common failures

“Cannot open display” or an empty image

Check echo "$XDG_SESSION_TYPE", DISPLAY and, for Wayland, WAYLAND_DISPLAY. An X11 command cannot directly capture a Wayland compositor, and a process started without the graphical session’s environment may lack authorization.

slurp or slop is not found

Install the helper from your distribution’s package source, or use fixed geometry. slurp belongs with grim on Wayland; slop is commonly used for interactive X11 selection with maim.

Clipboard output disappears immediately

Ensure wl-copy or xclip is installed and that the command runs inside the corresponding Wayland or X11 session. Some clipboard implementations require a live process to serve data; test by pasting immediately into a graphical application.

Flameshot captures nothing on Wayland

Follow the official Wayland troubleshooting guide. Portal permissions, desktop-specific setup and compositor support are common causes; switching commands alone may not fix a missing portal configuration.

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.

Only one monitor is captured

Use grim without an output selector for all outputs, or verify the X11 root-window geometry. On Wayland, inspect the output name before passing -o; names such as DP-1 are examples, not universal values.

A script works interactively but fails from cron or a service

Graphical capture requires the display socket and authorization of the logged-in desktop. Run the script from the user session, pass the required environment explicitly, and log stderr. Wayland portals may also require an interactive desktop request.

Or skip the browser setup

If what you really need is a screenshot of a public website rather than your Linux desktop, ScreenshotNeo returns a PNG, JPEG, WebP or PDF from one HTTP request. It accepts cookie and consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups and chat widgets before capture; bot checks, blank pages, timeouts, failed loads and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info and capture_pdf tools for Claude, Cursor and other MCP clients.

See the complete parameter reference in the ScreenshotNeo documentation. A one-call cURL example:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Python

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 includes full-page lazy-image loading, CSS-selector element capture, device presets, custom viewport and retina scale, PDF controls, custom CSS and JavaScript, click and wait actions, request blocking, headers, cookies, user agent, authorization, timezone, geolocation, transparent backgrounds, resizing, chosen cache TTLs, signed links, asynchronous webhooks, bulk capture of up to 100 URLs per call, a usage API and an OpenAPI specification. Its parameter names are compatible with those used by other screenshot APIs, which can simplify migration.

The Free plan includes 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 screenshots; every feature is available on every plan, and yearly billing provides two months free. Sign up for the free ScreenshotNeo plan to start without a card.

Frequently Asked Questions

Can I use grim on every Wayland desktop?

No. Grim depends on the compositor implementing the capture protocol it uses. Verify support for your compositor and distribution package.

Which command is best for an unattended screenshot job?

Use a non-interactive command with fixed geometry and an explicit output path, then test it inside the same graphical session that will run the job.

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

Why does an X11 screenshot command sometimes work inside a Wayland session?

An XWayland compatibility server may expose X11 applications, but that is not the same as native compositor capture and does not guarantee complete-desktop or multi-output behavior.

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.