How To Install and Use Linux Screen, With Commands

April 7, 2022


Linux Screen provides users an option to open several separate terminal instances within a single terminal window manager. Screen also includes an enhanced command line, giving you extra features and functionality over a standard command line.

This tutorial will show you how to install and use Screen on a Linux system.


  • A user account with sudo privileges
  • Access to a command line / terminal window (Ctrl+Alt+t/Ctrl+Alt+F2)

How to Install Screen on Linux

If you’re running a recent version of Linux, like Ubuntu 20.04 or CentOS 8, you probably already have Screen installed.

To verity if Screen is installed, check the version with the command:

screen –version
Check Screen version to verify the software is installed.

Installing Screen on CentOS

To install Screen on Red Hat / CentOS, enter the command:

yum install screen

Installing Screen on Debian or Ubuntu

To install Screen on Debian/Ubuntu, enter the following:

sudo apt install screen

How to Use Linux Screen Examples

Below you will find the most common Screen commands with examples on how to use them.

Starting Linux Screen

To launch Linux Screen and start a screen session, run the command:


The initial launch begins with a brief licensing agreement displayed on the screen. Press Space to continue to the next page.

Screen license agreement.

Press Space again to open a new screen session.

Linux Screen license agreement.

The system drops out to a command line that looks just like a regular terminal window.

The manage screen shells, use Screen keystrokes (in most cases, Ctrl + a, followed by another key). To see a list of available commands press the keys Ctrl + a, followed by ?.

Screen command list.

Named Sessions

While working in Screen, it is recommended to name each session. This helps you keep track of instances if you have multiple screen sessions running.

To launch and name a new session, use the command:

screen -S session_name

For instance, to create a session named upgrade, you run:

screen -S upgrade 

Working with Linux Screen

Once you launch Screen, the application creates a window with a shell inside of the screen session. Add, switch, and manage windows using command keystrokes.

The most commonly used keystrokes include:

  • Ctrl + a and c – Open a new screen window.
  • Ctrl + a and " – List all open windows.
  • Ctrl + a and 0 – Switch to window 0 (or any other numbered window).
  • Ctrl + a and A – Rename the current window.
  • Ctrl + a and S - Split the screen horizontally, with the current window on top.
  • Ctrl + a and | - Split the screen vertically, with the current window on the left.
  • Ctrl + a and tab – Switch focus between areas of the split screen.
  • Ctrl + a and Ctrl + a – Switch between current and previous windows.
  • Ctrl + a and n – Switch to the next window.
  • Ctrl + a and p – Switch to the previous window.
  • Ctrl + a and Q – Quit all other windows except the current one..
  • Ctrl + a and X – Lock the current window.
  • Ctrl + a and H – Create a running log of the session.
  • Ctrl + a and M – Monitor a window for output (a notification pops up when that window has activity).
  • Ctrl + a and _ - Watch a window for absence of output (such as when a file finishes downloading or a compiler finishes).

Detaching and Reattaching Screen

To detach from screen and leave the window running in the background, use the keystroke:

Ctrl + a and d

The command leaves the process working in Screen and exits the interface. It is the equivalent of minimizing a window in a graphical operating system.

To reattach to a running screen session, use:

screen -r

If you only have one Screen instance, you don’t need to enter the session ID. If you have more than one, you’ll need to specify which session ID you want to reconnect to.

Each screen session has a different ID and you can see the session ID list with the command screen -ls.

Find screen ID using the ls command.

Once you have the ID, add it to the screen -r command:

screen -r sessionID

For example, to restore screen 3361.upgrade, run:

screen -r 3361.upgrade

Locking and Adding Passwords to Screen

To lock the screen, use the shortcut:

Ctrl + a and x

The default lock screen mechanism asks for your Linux password to unlock the screen.

Example of locked screen.

Additionally, Screen allows you to protect a session with its own password. Each time you attempt to reattach to the screen, you need to provide the set password.

To create a password-protected screen, run the command:

password your_password

Replace your_passowrd with a strong password of your choice.

The next time you try to reattach to the password-protected screen, you have to provide two passwords to enter – your Linux password, followed by your Screen password.

Customizing Screen

Like many Linux applications, Screen uses a customizable configuration file. Find the system-wide configuration file at /etc/screenrc. The user’s configuration file is located at ~/.screenrc.

To edit, open the file:

sudo nano /etc/screenrc
screen configuration file to edit

Most of the settings can be toggled by removing the comment (#) sign at the beginning of the line.


This tutorial showed you how to install Linux screen as well as the basic commands for using it.

Once you have mastered using the screen interface, you can navigate through multiple terminals, multitask and work more efficiently.

Was this article helpful?
Vladimir Kaplarevic
Vladimir is a resident Tech Writer at phoenixNAP. He has more than 7 years of experience in implementing e-commerce and online payment solutions with various global IT services providers. His articles aim to instill a passion for innovative technologies in others by providing practical advice and using an engaging writing style.
Next you should read
How To Unzip A ZIP File In Ubuntu / Linux
March 25, 2024

Zip files are ubiquitously used on all operating systems, including Linux. This simple guide explains how to unzip files from the command line, as well as how to unzip multiple files or exclude specific files when unzipping.
Read more
How To Extract Or Unzip Tar.Gz Files From Linux Command Line
February 12, 2024

This article shows which commands best to use when compressing and decompressing files from the command line. By using the two compression utilities, covered in this tutorial, tar and gzip, you can manage zip files with ease.
Read more
How To Kill A Process In Linux? Commands To Terminate
December 13, 2023

If a Linux process becomes unresponsive or is consuming too many resources, you may need to kill it. Most processes have their own methods of shutting down.
Read more
How To Use SSH To Connect To A Remote Server In Linux Or Windows
November 23, 2023

In this tutorial, Find out How To Use SSH to Connect to a Remote Server in Linux or Windows. Get started with an SSH connection to a Server Today!
Read more