How To Install and Use Linux Screen, With Commands

August 21, 2019


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.

linux screen command tutorial


  • 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 18.04 or CentOS 7, you probably already have Screen installed.

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

screen –version
check screen version running on system

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-get install screen

Commands to Start Screen

To launch Screen, enter the following at a command line:


The tool will launch and give you a brief license agreement. Press the spacebar or Enter to continue to the Screen shell. The system will drop out to a command line that looks just like a regular terminal window.

screen shell on linux launching

Screen works using command keystrokes. These are usually Ctrl-a plus another key.

To display a list of available commands, enter the following:

list of available commands for screen

When you launch the Screen application, it’s helpful to name the session. This helps you keep track of different instances.

To name a session with the –S option:

screen –S name_session

To exit Screen, use the following command:


Note: Press and release the ctrl-a key combination, then hold the shift key and press the ? key.

Basic Commands in Screen to Manage Windows

When Screen is first launched, it creates one window inside of the Screen session. New windows can be created and switched using command keystrokes.

To open a new Screen window, use the following keystroke:


The original window is labeled 0 bash, unless you name it something different. Each new Screen window gets a number, up to 9.

Here is a list of useful commands for managing Screen windows:

Ctrl-a c – 

Create a new window

Ctrl-a “ 

List all open windows


0 – Switch to window #0 (or any other numbered window)

Ctrl-a A

Rename the current window

Ctrl-a S

Split the screen horizontally, with the current window on top

Ctrl-a |

– (pipe) Split the screen vertically, with the current window to the left

Ctrl-a tab

Switch between areas of the split screen (usually used along with

Ctrl-a 0

to run different windows side-by-side)

Ctrl-a Ctrl-a

Switch between current and previous windows

Ctrl-a n

– Switch to the next window

Ctrl-a p

– switch to the previous window

Ctrl-a Q

Quit all other windows except the current one

Ctrl-a x

Lock the current window

Ctrl-a H

– Create a running log of the session

Ctrl-a M

Monitor a window for output (Screen will flash a notification when that window has activity)

Ctrl-a _

– (underscore) Watch the window for the absence of output (such as when a file finishes downloading, or a compiler finishes)

Ctrl-a k

kill the Screen session (or you can type exit)

Detaching From Screen

You can leave a process working in Screen, and exit the interface. This is the equivalent of minimizing an application in a graphical operating system.

To detach from screen (and leave the window running in the background):

Ctrl-a d

Reattach to Screen

Screen helps preserve your work if your remote SSH connection drops.

To reconnect to the server, use the screen –ls command.

If you have multiple sessions running, you may need to find the screen session ID

To list different Screen sessions from a standard command line with:

screen –ls

This only lists sessions that are created with the screen command. Windows inside a session won’t be listed. If you have multiple different Screen instances running, each will have a different session ID.

This command lists all the Screen sessions that kept running after you disconnected.

You can then reattach to that Screen using the screen –r [sessionID]command.

To reattach to a running Screen instance:

screen –r [sessionID]

Note: 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.

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.

Open the file for editing:

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
December 2, 2019

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
November 14, 2019

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
April 12, 2019

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
September 24, 2018

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
  • © 2021 Copyright phoenixNAP | Global IT Services. All Rights Reserved.