How to take screenshot from the Linux terminal?


There are several ways in which you can take a screenshot in a Linux system for example you can use the print screen button given on your keyboard or take it by using graphical tools like GNOME screenshot, Flameshot, etc.

But there are some tools that allow you to capture the screen from your terminal, the benefit of using these tools is that you can take screenshots on servers or the systems without a desktop environment.

In this article, I will discuss how to take screenshots from the Linux terminal.

Method 1: Using Gnome screenshot command

Gnome screenshot provides both GUI and command-line options to take screenshots in a Linux system. This is the default screenshot tool in systems based on the GNOME desktop environment.

To take a screenshot using this tool, run the following command –

gnome-screenshot

If it shows that the gnome-screenshot package is not installed then you can install it by using one of the given commands in your terminal –

In Ubuntu/Linux Mint/ Kali Linux etc use-

sudo apt install gnome-screenshot -y

In Fedora/ CentOS/ RHEL use –

sudo dnf install gnome-screenshot -y

To take a screenshot of the current window with a delay of 10 seconds use –

gnome-screenshot -w -d 10

Where -w is used to capture the current window and the option -d is used to mention the time to delay.

If you want to take a screenshot of a specific area on the screen the us=e option -a with the given command –

gnome-screenshot -a

This will allow a rectangular selection of the area on your screen to capture.

Now if you want to include a border in your screenshot then run the following command –

gnome-screenshot -w -b

The screenshots will get saved in your current working directory.

For more options that can be used with the gnome-screenshot command see its manual page –

man gnome-screenshot

Method 2: By using the scrot command-line tool

Scrot is the lightweight command-line tool to take screenshots in a Linux system. It uses the imlib2 library to capture and save images and supports multiple image formats.

So before using this utility you need to install it on your system. You can use one of the given commands to install it on your system.

In Ubuntu/Linux Mint/ Kali Linux etc use-

sudo apt install scrot -y

In Fedora/ CentOS/ RHEL use –

sudo dnf install scrot -y

To take a screenshot of the entire desktop use the following command –

scrot

The screenshot will get saved in your current working directory.

If you want to grab a specific area on your computer screen then use the options -s with the scrot command –

scrot -s

This will display the plus shape icon to select the area on your screen.

You can check more options to use with scrot command on its man page.

man scrot

Conclusion

There are many other such tools like xwd, Ksnapshot, etc that can be used to capture the screen from the Linux terminal here we discussed only a few of them.

Now if you have a query then write us in the comments below.

 

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.