One of these features is the ability to capture screenshots of your desktop, windows, or selected areas. Screenshots are useful for many purposes, such as documenting your work, sharing your screen with others, or creating tutorials and guides.
In this article, we will explore some of the most common GUI and CLI ways to capture screenshots in Linux and explain how to use them.
Capture Screenshot in Linux (GUI)
Many Linux distributions come with a default GUI screenshot tool with the desktop environment they use. These can be accessed from the applications menu or by using keyboard shortcuts.
Some of the most popular GUI screenshot tools are:
1. Shutter
Shutter is an advanced screenshot utility that works with any Linux desktop environment.
It has many features that make it stand out from other screenshot tools:
- Edit screenshots with various tools and filters
- Add annotations and shapes
- Create profiles for different settings
- Capture web pages and widgets
- Organize screenshots in a session
You can launch Shutter from the applications menu or use one of the keyboard shortcuts given below:
- PrtScn: Screenshot of the entire screen.
- Alt + PrtScn: Screenshot of the active window only.
- Shift + PrtScn: Screenshot specific area of the screen selected by the mouse.
Captured screenshot images are then viewed in shutter and can be edited further.
2. Gnome Screenshot
Gnome Screenshot is the default screenshot tool for Linux distributions running Gnome as desktop environment, such as Ubuntu, Fedora, Debian, and others. It is the simple and easy-to-use.
The keyboard shortcuts used in Gnome screenshot utility are exactly the same. Captured screenshot are saved to the ./Pictures
directory by default.
You can also open the GNOME Screenshot utility from the applications menu and choose your screenshot type, add a delay, and select your effects from there.
It can also be accessed using command line with gnome-screenshot
command.
3. KDE Spectacle
KDE Spectacle is the default screenshot tool for Linux distributions running KDE as desktop environment, such as Zorin, Kubuntu and Manjaro KDE. It can be installed using steps mention on official website.
It offers more features than GNOME Screenshot, such as:
- Capture multiple monitors at once
- Take screenshots of menus and tooltips
- Copy screenshots to clipboard
- Include mouse pointer, window title and borders
- Export images to online services
Some keyboard shortcuts KDE Spectacle:
- PrtScn: Open KDE Spectacle with last used settings.
- Shift + PrtScn: Screenshot entire desktop.
- Meta + PrtScn: Screenshot active window.
- Alt + PrtScn: Select area and capture screenshot.
You can also open KDE Spectacle from the apps menu and select your screenshot mode, add a delay, and customize settings there.
Capture Screenshot in Linux (CLI)
Some users prefer command line tools over graphical tools because they are faster, more flexible, and more scriptable.
Here are the most common CLI tools for capturing screenshots in Linux:
1. ImageMagick
ImageMagick is a powerful image manipulation tool that can also be used to capture screenshots in Linux. You can also use ImageMagick to edit, convert, resize, crop, rotate, and apply effects to your screenshots.
You can use the import
command on a terminal to capture screenshots.
Some common use cases are given below:
Command |
Effect |
import -window root screenshot.png |
Screenshot of the entire screen and save to screenshot.png |
import -window "Firefox" screenshot.png |
Screenshot of window with the title “Firefox” |
import -screen -frame screenshot.png |
Screenshot of the screen with a border around it |
import -pause 5 screenshot.png |
Screenshot of the screen after a 5-second delay |
import -crop 800x600+100+100 screenshot.png |
Screenshot of a 800x600 pixel area at the position (100,100) on the screen |
Use display
command to preview your screenshots, or convert
command to modify your screenshots after saving them.
2. Scrot
scrot is a simple and lightweight screenshot tool. It has fewer options than ImageMagick, but it is faster and easier to use. You can also use scrot to create thumbnails, add timestamps, and execute commands after taking screenshots.
Here are some examples of how to use scrot to capture screenshots:
Command |
Effect |
scrot |
Screenshot of the entire screen and save it in the current directory with a filename based on the date and time |
scrot -u |
Screenshot of the active window |
scrot -s |
Screenshot of a specific area of the screen by dragging the mouse cursor and selecting the area |
scrot -d 5 |
Screenshot of the entire screen after a 5-second delay |
scrot -t 50 |
Screenshot of the entire screen. Also, create a thumbnail image that is 50% smaller than the original image. |
scrot -e 'mv $f ~/Pictures' |
Screenshot of the entire screen and save image file to the ~/Pictures directory. |
3. Xwd
This is another simple and lightweight screenshot tool that is compatible with any X Window System. You can also use xwd to capture screenshots of remote displays or servers.
Here are some examples of how to use xwd to capture screenshots and dump info X file:
Command |
Effect |
xwd -root > screenshot.xwd |
Screenshot of the entire screen and save it as screenshot.xwd (X dump file) |
xwd -id $(xdotool getactivewindow) > screenshot.xwd |
Screenshot of the active window. You need to install xdotool first to get the window ID. |
xwd -display :1 > screenshot.xwd |
Screenshot of display :1 (the second display) |
xwd -display remotehost:0 > screenshot.xwd |
Screenshot of display :0 (the first display) on remotehost (a remote server) |
Use xwud
command to display dumped X file. Or convert them to other formats using ImageMagick
or other tools.
Here are some tools which are helpful in the context of this article:
1. Screenfetch (System Info)
The screenfetch tool can automatically detect your Linux distribution and display its logo along with some system information, such as kernel, uptime, packages, shell, CPU, GPU, and RAM.
To use screenfetch, you just need to run it on your terminal and it will generate a colorful output. You can add -s
a flag to capture screenshot of the whole screen.
You can also customize the output by using different options, such as changing distro name (-D
), hiding the logo (-n
), or changing the colors (-c
).
2. Termshot (Snippet)
This tool creates screenshot-like image based on terminal commands and their output. You can install termshot using binaries provided on its GitHub release page.
go install github.com/homeport/termshot/...@latest
To use termshot, you need to prefix your command with termshot, and it will create a screenshot of the output.
termshot --show-cmd -- lolcat -f <(figlet Studytonight)
You can also edit (or removing sensitive content) the output before creating the screenshot.
We hope this article helped you find productive ways to capture screenshots in Linux and choose the best tool for your scenerio. Happy Linuxing!