Linux Screen

Apr 2020

Overview

When using Linux via SSH, if you get disconnected then you cannot rejoin that session. So if you were doing something like downloading a large file, then you can not reconnect to see the progress (the download would have stopped anyway once you disconnected).
This guide is based around CentOS7 (or RedHat).
Screen is a 'Terminal Multiplexer' which means you can start Screen and then open terminal windows. These windows will stay open if you disconnect and you can reconnect with them when you next join.

Check for Screen

Sounds great, do I have Screen?
From a terminal in Linux, enter the following:

screen --version

If you see a version number in the format Screen version 4.01.00devel (GNU) 2-May-06, you are good to go, check out the section Using Screen. if you see the message screen: command not found then you will need to install screen.

Installing Screen

To install screen, open a terminal window and use the following command:

sudo yum install screen -y

You will see something very similar to the following:

sudo yum install screen -y
Loaded plugins: fastestmirror
Determining fastest mirrors
epel/x86_64/metalink | 8.3 kB 00:00:00
* base: centos.mirroring.pulsant.co.uk
* epel: ftp.nluug.nl
* extras: mirror.mhd.uk.as44574.net
* updates: mirror.vorboss.net
base | 3.6 kB 00:00:00
epel | 4.7 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/7): base/7/x86_64/group_gz | 153 kB 00:00:00
(2/7): extras/7/x86_64/primary_db | 190 kB 00:00:00
(3/7): updates/7/x86_64/primary_db | 120 kB 00:00:00
(4/7): epel/x86_64/updateinfo | 1.0 MB 00:00:00
(5/7): epel/x86_64/group_gz | 95 kB 00:00:00
(6/7): base/7/x86_64/primary_db | 6.1 MB 00:00:01
(7/7): epel/x86_64/primary_db | 6.8 MB 00:00:02
Resolving Dependencies
--> Running transaction check
---> Package screen.x86_64 0:4.1.0-0.25.20120314git3c2946.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================================================================================
Package Arch Version Repository Size
================================================================================================================================================
Installing:
screen x86_64 4.1.0-0.25.20120314git3c2946.el7 base 552 k
Transaction Summary
================================================================================================================================================
Install 1 Package
Total download size: 552 k
Installed size: 914 k
Downloading packages:
screen-4.1.0-0.25.20120314git3c2946.el7.x86_64.rpm | 552 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : screen-4.1.0-0.25.20120314git3c2946.el7.x86_64 1/1
Verifying : screen-4.1.0-0.25.20120314git3c2946.el7.x86_64 1/1
Installed:
screen.x86_64 0:4.1.0-0.25.20120314git3c2946.el7
Complete!