终端截屏(scrot / gnome-screenshot)

用 scrot 或 gnome-screenshot 把全屏、窗口或选区截成带时间戳的 PNG 文件。

Linux桌面scrot 截屏截图图片低风险
运行 `scrot '%Y-%m-%d-%H%M%S_$wx$h.png' -e 'mv $f ~/Pictures/'` 即可保存一张带时间戳的全屏截图。

01命令

命令
$ scrot '%Y-%m-%d-%H%M%S_$wx$h.png' -e 'mv $f ~/Pictures/'

02作用说明

格式化文件名包含日期、时间和分辨率;`-s` 可以点击选择窗口,`-d 5` 延迟五秒(方便打开菜单),`-u` 只截当前活动窗口。在 GNOME 上也可以用 `gnome-screenshot -f 文件.png` 和 `gnome-screenshot -a`(区域截图),无需安装 scrot。注意 GNOME 的 Wayland 会话下 scrot 属于 XWayland 客户端,可能截不到其他窗口,此时应使用桌面自带的 Print Screen 界面或 wlroots 桌面的 grim。

03风险

风险低风险
使用条件scrot (install with apt/dnf/pacman). GNOME also ships gnome-screenshot; Wayland users can use `grim` (wlroots) or GNOME's built-in Print Screen UI. Select a window interactively with `scrot -s`.
!注意: scrot 是 X11 工具;在 GNOME Wayland 会话中它只能截取 XWayland 能看到的画面,此时应改用桌面自带的截图工具。

04撤销

✓无需撤销——该命令不会改变持久状态。

05来源

  • gnome-screenshot(1) - Linux manual page
    Ubuntu Manpages · technical · 2026-09-17
    依据: gnome-screenshot captures the screen, a window or an area on GNOME desktops and saves it to a file or the clipboard.
  • scrot(1) - Linux manual page
    Ubuntu Manpages · technical · 2026-09-17
    依据: scrot captures the screen using imlib2, supports filename format specifiers like date, size and window ID, selection with -s, delay with -d, and -e to run a command on the result.

最后验证: 2026-09-18 · 分类: 系统与设置