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

The right Linux screenshot command depends on your display session and the result you need. For an interactive region, run flameshot gui. For an X11 root-screen capture with ImageMagick, run magick import -window root screen.png. For a small, scriptable capture, run scrot screenshot.png. These commands are not interchangeable: ImageMagick’s import is documented for an X server, while Wayland capture normally depends on a desktop screenshot portal and its permissions.

Choose the command before you capture

Use this quick decision guide:

Need Best starting point Important limitation
Select an area and annotate it interactively flameshot gui Requires a working desktop capture backend; Wayland needs the appropriate portal and permission.
Capture one monitor or every monitor flameshot screen or flameshot full Monitor numbering and portal behavior vary by session.
Capture the X11 root window magick import -window root screen.png import is an X-server workflow, not a Wayland-native method.
Keep a simple command in a script scrot screenshot.png Package versions and availability differ by distribution.

First identify whether the session is X11 or Wayland:

echo "$XDG_SESSION_TYPE"

x11 indicates an X session; wayland indicates Wayland. An empty or unexpected value means you should also check your desktop’s session settings or login screen. The session check matters because a command that reads an X server cannot automatically capture a Wayland desktop.

Flameshot: interactive, monitor, and full-desktop captures

Flameshot is the most flexible choice when a person needs to draw a rectangle, annotate it, copy it, or choose another action immediately after capture. Its command-line interface provides gui, screen, and full subcommands.

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.

Select a region

flameshot gui

A selection interface appears. Drag over the area, then use Flameshot’s controls to save, copy, annotate, or perform another enabled action.

Save an interactive capture to a directory

mkdir -p "$HOME/Pictures"
flameshot gui --path "$HOME/Pictures"

The path option chooses the destination directory. Confirm that the directory exists and that your user can write to it.

Copy the selected image to the clipboard

flameshot gui --clipboard

This is useful when the next step is pasting into a chat, issue tracker, or image editor rather than creating a file.

Wait before showing the selection

flameshot gui --delay 2000

The delay is in milliseconds, so 2000 waits two seconds. Use a delay when you need to open a menu or arrange a transient UI before selecting the region.

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

Capture a particular monitor

flameshot screen --number 0 --path "$HOME/Pictures"

The --number value selects a monitor according to Flameshot’s numbering. Without a number, the command targets the screen containing the cursor. Check the resulting image if your desktop orders monitors differently than expected.

Capture all monitors

flameshot full --path "$HOME/Pictures"

This produces one capture spanning all monitors. If you instead need one file per monitor, run flameshot screen for each monitor number.

Useful automation outputs

Flameshot also documents options for a specified region, the last selected region, raw PNG output to standard output, geometry reporting, pinning, accepting a selection immediately, and uploading. Upload is a data transfer: do not enable --upload for confidential screens unless you have deliberately chosen the destination and understand what is transmitted. Raw output and geometry reporting are useful when another program will consume the image or coordinates instead of a human.

ImageMagick import: an X11 command-line route

ImageMagick’s import utility captures some or all of an X server screen and writes an image. It can capture a clicked window or a selected area interactively.

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

Capture an interactive area or window

magick import screenshot.png

After you run the command, select the window or region as requested by ImageMagick, then inspect screenshot.png.

Capture the complete X11 root screen

magick import -window root screen.png

The root window represents the X11 desktop surface. This is a straightforward choice for a single X display, but it does not provide a Wayland-native permission flow.

Send the capture to the clipboard

magick import clipboard:

Clipboard integration depends on the desktop and ImageMagick build. If the command succeeds but another application cannot paste the image, test a file output first and verify that your clipboard service is running.

scrot: a small command for scripts

scrot is a command-line screen-capture utility documented by Debian. It uses imlib2 and can save formats including JPG, PNG, and GIF. It also documents window and rectangular-area capture, delays, quality controls, and scriptable operation.

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

Save a basic screenshot

scrot screenshot.png

Use an absolute path in automation so the output location does not depend on the script’s current directory:

scrot "$HOME/Pictures/desktop-$(date +%Y%m%d-%H%M%S).png"

Check the generated file

test -s "$HOME/Pictures/desktop-$(date +%Y%m%d-%H%M%S).png"

For a real script, assign the filename once rather than evaluating the timestamp twice:

out="$HOME/Pictures/desktop-$(date +%Y%m%d-%H%M%S).png"
scrot "$out" || { printf 'capture failedn' >&2; exit 1; }
printf 'saved %sn' "$out"

Because scrot’s documentation is distribution-specific, install the package supplied by your distribution and check its local help for option names and format support.

X11 versus Wayland: why the same command may fail

X11

On X11, ImageMagick import can read the X server, and scrot is commonly used for X-based capture. Flameshot can also work through a screenshot portal; on a minimal X11 window manager without a usable portal backend, Flameshot documents a legacy native X11 capture setting. That legacy option applies only to X11.

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

Wayland

Wayland intentionally restricts arbitrary screen reading. Flameshot’s current guidance uses XDG Desktop Portal capture in version 14 and later. GNOME and KDE desktops typically provide a screenshot-capable backend, while other compositors, including Hyprland, require the corresponding portal implementation and configuration. Flameshot’s Wayland guidance also documents granting the requested screenshot permission, including a GNOME-specific permission step.

Do not assume that installing an X11 utility solves a Wayland problem. Verify all of the following:

  • echo "$XDG_SESSION_TYPE" reports wayland.
  • The portal package appropriate for your desktop or compositor is installed and running.
  • Your desktop allows the screenshot request when prompted.
  • You are testing from the same graphical session as the target desktop, not a text-only SSH shell.

Exact package names and portal setup vary by distribution and compositor. If Flameshot reports a portal error, consult your distribution’s package names and the compositor’s portal requirements rather than enabling the X11 legacy mode; that mode is ignored on Wayland.

Save files, copy pixels, and automate safely

Use predictable paths

Create the destination before capturing:

install -d -m 700 "$HOME/Pictures/captures"
flameshot full --path "$HOME/Pictures/captures"

Restricting a private capture directory can prevent other local users from reading sensitive screenshots. Choose permissions appropriate to your system’s sharing model.

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

Capture from a scheduled or remote script

A graphical capture still needs access to the graphical session. A cron job, system service, or SSH shell may lack DISPLAY, WAYLAND_DISPLAY, XDG_RUNTIME_DIR, or the session’s authorization. Run the command inside the logged-in desktop session, or explicitly pass the required environment and authorization only when you understand the security implications.

Keep upload separate from capture

Save locally first, inspect the file, and then transfer it with a tool and destination you selected. Flameshot’s upload option is not equivalent to a local save; it sends screen content elsewhere.

Or skip the browser setup

If what you really need is a screenshot of a website—not the Linux desktop—ScreenshotNeo returns a clean PNG, JPEG, WebP, or PDF from one HTTP request. It accepts cookie or consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed; the response identifies the result with X-Page-Verdict and X-Billed headers.

Read the full parameter reference in the ScreenshotNeo documentation. This cURL call captures Stripe as WebP:

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

Equivalent Python:

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

Equivalent 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}`);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
require('fs').writeFileSync('shot.webp', Buffer.from(await res.arrayBuffer()));

ScreenshotNeo also offers full-page captures with lazy images loaded, CSS-element capture, dark mode, 12 device presets or custom viewports, retina scale, PDF paper and page controls, custom CSS and JavaScript, clicks, waits, ad/tracker/request blocking, headers, cookies, user agents, Authorization, timezone and geolocation, transparent backgrounds, resizing, chosen-TTL caching, signed image links, asynchronous jobs with signed webhooks, bulk capture of up to 100 URLs per call, a usage API, an OpenAPI specification, and compatible parameter names used by other screenshot APIs. Its MCP server exposes take_screenshot, get_page_info, and capture_pdf to Claude, Cursor, and other MCP clients.

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

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 X11 capture

Cause: the command is running outside the graphical X session, or DISPLAY and authorization are unavailable.

Fix: run it from a terminal inside the desktop session, check echo "$DISPLAY", and test a simple X11 application. Do not copy another user’s authorization credentials casually.

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

Flameshot says no screenshot portal is available

Cause: the required XDG Desktop Portal backend is missing, not running, or mismatched with GNOME, KDE, or your compositor.

Fix: install and enable the backend intended for that desktop, log out and back in if required, and retry. On a minimal X11 setup, use Flameshot’s documented legacy native X11 option; it will not help on Wayland.

Wayland permission is denied

Cause: the desktop has not granted the screenshot request or the compositor’s portal integration is incomplete.

Fix: accept the permission prompt, verify the desktop-specific portal, and review the compositor’s screenshot configuration. Requirements are not uniform across distributions.

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

The wrong monitor or a combined image appears

Cause: monitor numbering differs from your assumption, or full intentionally captures all monitors.

Fix: try flameshot screen --number 0, then other numbers, or use gui to select the visible region.

The file is missing or zero bytes

Cause: the destination directory does not exist, is not writable, or the capture exited with an error.

Fix: create the directory with install -d, use an absolute filename, check the command’s exit status, and verify with test -s file.png.

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

A screenshot contains a menu that disappeared

Cause: the interface closed before selection.

Fix: use flameshot gui --delay 2000 or another suitable delay, then open the menu during the delay.

A website capture shows a consent wall or blank page

Cause: desktop screenshot tools capture what is on your monitor; they do not render a remote website independently.

Fix: use a browser or an API designed for webpage rendering. ScreenshotNeo’s verdict headers distinguish failed loads and other non-billable outcomes.

Practical selection checklist

  • Need a person-controlled rectangle or annotations: choose Flameshot.
  • Need an X11 root-window or clipboard operation: choose ImageMagick import.
  • Need a compact script and a named image file: choose scrot, after checking your distribution’s package and help output.
  • Running Wayland: verify portal backend and permission before changing commands.
  • Capturing a remote webpage rather than your Linux desktop: use a webpage screenshot API instead of desktop capture.
  • Sending an image anywhere: treat upload as an explicit disclosure and inspect sensitive content first.

Frequently Asked Questions

Can I take a screenshot without a graphical desktop running?

These utilities capture a desktop session, X server, or Wayland compositor. In a text-only environment there is no screen surface for them to read; use a webpage rendering service for a remote URL or start the intended graphical session.

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.

Which command captures only the active window?

ImageMagick’s interactive magick import screenshot.png lets you select a window or region. Flameshot’s gui mode can likewise be used to select the visible window bounds manually.

Why does my screenshot include multiple monitors?

flameshot full is defined to capture all monitors together. Use flameshot screen --number N for one monitor or select the desired area with flameshot gui.

Are screenshots from these commands automatically uploaded?

Local file and clipboard commands do not inherently upload an image. Upload occurs only when you explicitly use a transfer feature such as Flameshot’s documented --upload option.

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.

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