How to Install and Use Linux Screen in 2023

How to Install and Use Linux Screen in 2023

Sysadmins typically manage virtual servers via the Linux terminal. However, by incorporating the Linux Screen into your workflow, you can get even more out of it. It’s a long-standing favorite among developers and a must-have for anyone aspiring to be an expert.

Additionally, when it comes to VPS web hosting management, the Linux Screen proves to be an invaluable asset too. Although it may appear intimidating at first, the Linux Screen is simple to learn and offers limitless possibilities. It is an extremely efficient and resourceful utility, making it an indispensable tool.

With this in mind, we’ll show you how to enable and use Linux Screen to further expand the flexibility of the Linux terminal.

What Is Linux Screen

A Linux Screen is a terminal application developed by the GNU project. Often official documentation calls it a GNU Screen and is used for terminal multiplexing.

In other words, Screen divides a physical terminal into multiple virtual sessions, stops and summarizes the activity in them.

Screen works like this – if you work on a terminal session while using Screen, once you’re finished with your work and turn off the computer, it will save at that point. When the terminal is reaccessed, the terminal will return to the very same screen you worked on before shutting down.

Linux Screen might be basic in its structure, but every Linux user should know how to use it.

How to Install Linux Screen

Screen is usually installed by default on all major Linux distributions. If your system doesn’t have it preinstalled, don’t worry, the installation process is easy.

First, we need to connect to our server using the SSH command. Open up your terminal and type:

ssh your-user@server

In the case of Debian, Ubuntu or Linux Mint and its derivatives, you can execute the following command:

sudo apt install screen

If you are using CentOS 7, you can install it using the following:

sudo yum install screen

Or if the user can’t run sudo commands, we need to run it as a root user.

yum install screen

At the end of the installation, we can check the current version of Screen, using the following screen command line:

screen –version

Congratulations, now you can finally use Screen.

How to Use Linux Screen on Any Linux Distribution

To run Linux screen, we just have to type the word in our terminal session:

Running Linux Screen for the first time

After pressing the Space key, you will see the terminal again. Do not be worried, we have already started a new Screen session. To check it, just type exit in and press Enter.

So, we need to rerun the command by typing screen again.

We can also start a session and give it a name by using the -S variable. For example:

screen -S session1

We recommend you give the session a descriptive name and you will have no problem identifying it.

Screen uses commands to perform terminal multiplexing and the commands are easy to learn. They all follow a Ctrl+* * structure, where * are the variables.

Important! Take note of the lowercase and uppercase keys when performing commands.

Different Linux Screen commands

Working in a New Linux Screen Session

Once we have started a new session it is necessary to learn how to use it. These are the main commands you’ll be using:

Ctrl+a cCreate a new window
Ctrl+a ”List all the created windows
Ctrl+a aDelete a Ctrl+a, which useful if you made a mistake
Ctrl+a Ctrl+dLeave the session running

It is also possible to split the terminal screen. For example, using Ctrl+a S splits the terminal horizontally:

Splitting the terminal using Linux Screen

To change to the next terminal, we press CTRL+a TAB. To close it, CTRL+a X.

How to Manage Multiple Sessions Using Linux Screen

One of the great qualities of Screen is the ability to perform actions and leave them in the background so that when we return to them they’re still there. This is especially great for server administrators.

For this example, I will use htop. We can install it on Debian, Ubuntu, Linux Mint and its derivatives with the following command:

sudo apt install htop

You can run htop by simply typing the following command in your terminal:

Using htop as an example for Linux Screen

Next, we will use both CTRL+a and CTRL+d commands to detach the execution from the terminal. From here you can work on something else, while the previous window will run in the background. If you want to open up the same htop terminal, first type in the following Linux screen command:

screen -ls

It will show all of your saved sessions. To reopen htop, enter the following:

screen -r process_number
Reopening the previous session using Linux Screen

In this case, our process_number is 11520


It is really important to learn how to install and use Linux Screen, especially if you work as a server administrator. It’s a really handy tool that can greatly improve your overall workflow. Here you have learned how to both install Screen on your server and how to use its basic commands.

We hope you found this Linux tutorial helpful. Good luck!

The author

Edward S.

Edward is a content editor with years of experience in IT writing, marketing, and Linux system administration. His goal is to encourage readers to establish an impactful online presence. He also really loves dogs, guitars, and everything related to space.