Sep 25, 2023 7 min read

How to Screenshot a Debian/Ubuntu Server's Login Shell CLI

In this tutorial, you will learn how to take screenshots of the login shell/command line interface of your Ubuntu/Debian server operating system.

Screenshot a Debian/Ubuntu Server's Login Shell CLI
Table of Contents

Introduction

Before we begin talking about how to screenshot a Debian/Ubuntu Server's Login Shell CLI, let's briefly understand – What is a Login Shell?

A login shell is a program that enables you to access a computer system by authenticating your identity. It provides a command line interface where you can execute various tasks and programs. Login shells play a crucial role in computer security by validating user credentials before granting access.

To demonstrate how to perform a certain job or the current state of your work, you must take a screenshot of the desktop of your computer. On the desktop versions of Ubuntu and Debian, screenshotting is relatively simple.

But what if you want to display something on your Ubuntu/Debian server operating system's login shell (command line interface)? Fortunately, you can capture screenshots of your Ubuntu/Debian server operating system's login shell/command line interface.

In this tutorial, you will screenshot a Debian/Ubuntu Server's Login Shell CLI. We will also address a few FAQs on how to screenshot a Debian/Ubuntu Server's Login Shell CLI.

Installing Fbcat on Ubuntu/Debian Server

You require the fbgrab program to capture screenshots of your Ubuntu/Debian server's login shell or command line interface. The fbcat package contains the fbgrab program. The official Ubuntu/Debian package repository contains the fbcat package. Thus, installing it on an Ubuntu or Debian server is fairly simple.

First, run the following command to update the APT package repository cache:

 sudo apt update

Run the following command to install the fbcat package on an Ubuntu/Debian server:

sudo apt install fbcat

To confirm the installation, hit Y followed by <Enter>.

The APT package manager should begin downloading fbcat and all of its dependencies. It takes some time to complete.

The APT package manager installs the packages when they have been downloaded. It takes some time to complete.

The fbcat package should be installed at this stage.

Syntax of the Fbgrab Program

The fbgrab program, which you will use to take screenshots of the login shell or command line interface of Ubuntu/Debian servers, has the following format:

sudo fbgrab <options> <image-save-path>

<options> are the supported fbgrab options that can be used to control the fbgrab's behaviour.

The <image-save-path> absolute path (for example, /mnt/screenshots/image01.png) or relative path (for example, /Photos/image01.png,./screenshots/image01.png) to save the screenshot image file. The screenshot photos are saved in PNG format using fbgrab. As a result, the image files terminate with .png (the PNG extension).

Capturing Screenshots of the Current Ubuntu/Debian Server Login Shell

Run the following command to capture a screenshot of the current shell of the Ubuntu/Debian server and save it in the current working directory as the PNG image file – image01.png:

 sudo fbgrab image01.png

It is necessary to capture a screenshot of the current Ubuntu/Debian server shell.

In the current working directory of your Ubuntu/Debian server, a new image file called "image01.png" should be created.

ls -lh

You can download and see the screenshot file by connecting to the Ubuntu/Debian server using SFTP or Filezilla. As you can notice, a proper screenshot was obtained of our Ubuntu server's current login shell and command line interface.

Capturing Delayed Screenshots of the Current Ubuntu/Debian Server Login Shell

Run the following command to take a snapshot of the current shell of the Ubuntu/Debian server after, let's say, 10 seconds and save it in the current working directory as the PNG image file - image02.png:

sudo fbgrab -s 10 image02.png &

Fill in the current login shell/command line interface with the information you wish to screenshot, and a screenshot is taken after 10 seconds.

To return to the command prompt, press <Enter> once again.

In the current working directory of your Ubuntu/Debian server, a new image file called "image02.png" should be created.

ls -lh

You can download and see the screenshot file by connecting to the Ubuntu/Debian server using SFTP or Filezilla. As evident, the screenshot of our Ubuntu server's current login shell/command line interface was taken properly.

Changing to a Different Interactive Shell (TTY) on Ubuntu/Debian Server

Using two different interactive shells to capture screenshots of your Ubuntu/Debian server's login shell/command line interface is another option. One to use the fbgrab application on while the other is used to snap screenshots.

You can switch between 6 interactive shells (TTYs) on an Ubuntu/Debian system. "tty1" is the interactive shell by default. The other interactive shells are referred to as "tty2", "tty3", "tty4", "tty5", and "tty6".

Using the keys Ctrl + Alt + FN, you can modify the interactive shell (TTY) on your Ubuntu/Debian server. The function key to press to enter an interactive shell in this case is FN.

To access interactive shell 1 - "tty1", press Ctrl + Alt + F1.

To access interactive shell 2 - "tty2", press Ctrl + Alt + F2.

To access interactive shell 3 - "tty3", press Ctrl + Alt + F3.

To access interactive shell 4 - "tty4", use Ctrl + Alt + F4.

To access interactive shell 5 - "tty5", press Ctrl + Alt + F5.

To access interactive shell 6 - "tty6", press Ctrl + Alt + F6.

The login prompt of your Ubuntu/Debian server displays the name of the interactive shell (TTY).

The following command can also be used to locate the interactive shell (TTY) you're currently using. In our situation, it is the "tty1" interactive shell, which is the default.

 tty

Press <Ctrl> + <Alt> + F2 to go to interactive shell 2, or "tty2".

You may verify that you are running the interactive shell "tty2" with the "tty" command after logging in to the interactive shell 2, or "tty2". In the parts that follow, we utilize the interactive shell 2 ("tty2") of our Ubuntu server to execute the fbgrab command and take screenshots of the interactive shell 1 ("tty1"), which is the default interactive shell.

tty

Capturing Screenshots of a Specific Interactive Shell (TTY) of Ubuntu/Debian Servers

Say you want to use fbgrab to capture a screenshot of the interactive shell "tty1" from the interactive shell "tty2" of your Ubuntu/Debian server.

Run the required commands on the "tty1" default interactive shell first if you want to capture screenshots.

Switch to the interactive shell "tty2" by pressing "Ctrl" + "Alt" + "F2". Run the command below to take a screenshot of the default interactive shell "tty1" while logged in to the interactive shell "tty2" (fbgrab option -c 1). Save the screenshot as "image03.png" in your Ubuntu/Debian server's current working directory:

sudo fbgrab -c 1 image03.png

Take a screenshot of the Ubuntu/Debian server's "tty1" default interactive shell.

You should make a new image file called "image03.png" in the server's current working directory of Ubuntu or Debian.

ls -lh

You can download and see the screenshot file by connecting to the Ubuntu/Debian server using SFTP or Filezilla. As you can see, the screenshot of our Ubuntu server's "tty1" default interactive shell was taken appropriately.

Capturing Delayed Screenshots of a Specific Interactive Shell (TTY) of Ubuntu/Debian Servers

Let's suppose that after running the fbgrab program for a little while, you wish to capture a screenshot of the default interactive shell "tty1" from the interactive shell "tty2" of your Ubuntu/Debian server.

Run the required commands on the "tty1" default interactive shell first if you want to capture screenshots.

To switch to the interactive shell "tty2" and enter the interactive shell "tty2," press <Ctrl> + <Alt> + F2.

To take a screenshot of the standard interactive shell "tty1" after 20 seconds (fbgrab option -s 20), use the command below, then save the image as "image04.png" in the currently active working directory of your Ubuntu/Debian server:

sudo fbgrab -c 1 -s 20 image03.png

Take a screenshot of the Ubuntu/Debian server's "tty1" default interactive shell.

You should make a new image file called "image04.png" in the working directory of your Ubuntu/Debian server.

ls -lh

You can download and see the screenshot file by connecting to the Ubuntu/Debian server using SFTP or Filezilla. As you can see, the screenshot of our Ubuntu server's "tty1" default interactive shell was taken appropriately.

FAQs to Screenshot a Debian/Ubuntu Server's Login Shell CLI

What tools can I use to remotely access the Ubuntu/Debian server and capture screenshots? 

You can use tools like SSH (Secure Shell) to remotely access the server command line interface (CLI) and capture screenshots with the help of additional utilities like "scrot" or "import" (part of ImageMagick package).

How do I install the "import" utility from the ImageMagick package on Ubuntu/Debian? 

Install ImageMagick by running: sudo apt-get install imagemagick. The "import" utility will be included in the package.

Can I automate the process of capturing screenshots on the Ubuntu/Debian server? 

Yes, you can create a script that utilizes tools like "scrot" or "import" to capture screenshots at specific intervals or trigger them based on certain conditions.

How do I install the "scrot" utility on Ubuntu/Debian? 

You can install "scrot" by running the command: sudo apt-get install scrot.

How do I capture a screenshot using "scrot"? 

After connecting to the server using SSH, run the command: scrot screenshot.png. The screenshot will be saved as "screenshot.png" in the current directory.

How do I install the "import" utility from the ImageMagick package on Ubuntu/Debian?

Install ImageMagick by running: sudo apt-get install imagemagick. The "import" utility will be included in the package.

How do I capture a screenshot using "import"? 

Once connected to the server via SSH, use the command: import -window root screenshot.png. This will capture the entire screen and save it as "screenshot.png" in the current directory.

Conclusion

We demonstrated how to set up the fbgrab application on servers running Ubuntu or Debian. Additionally, we demonstrated how to use fbgrab to capture screenshots of the Ubuntu/Debian servers' login shell and command-line interface. We additionally explained how to use fbgrab to capture delayed screenshots of the login shell/command line interface of Ubuntu/Debian servers.

If you have any queries or doubts, please leave them in the comment below. We'll be happy to address them.

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to DevOps Tutorials - VegaStack.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.