2. How To Install and Configure Screen on CentOS 7
Page | 1
Overview
GNU Screen is a terminal multiplexer, a software application that can be used to multiplex several virtual
consoles, allowing a user to access multiple separate login sessions inside a single terminal window, or
detach and reattach sessions from a terminal.
It is useful for dealing with multiple programs from a command line interface, and for separating programs
from the session of the Unix shell that started the program, particularly so a remote process continues
running even when the user is disconnected.
In this guide we will install screen, configure and check different options to utilize it.
Applies To
CentOS 7, tested on CentOS Linux release 7.3.1611 (Core)
Pre-Requisites
superuser access for installation.
Install Package – Screen
In this section we will go over the steps for installation of screen.
To install screen package, run the command;
yum install screen -y
3. How To Install and Configure Screen on CentOS 7
Page | 2
Verify – Package Installation
To check the package is installed, run the command;
yum list installed | grep screen or
rpm -qai screen | grep -E "Name| Install Date"
Launch – New Screen Session
To initialize / start a new screen session, run the command;
screen
A new “Screen 0” has been created.
4. How To Install and Configure Screen on CentOS 7
Page | 3
List – Screen Session
To list created screens and that are available to connect, run the command;
screen -ls
Attach – Screen Session
To list screen sessions available / started session, screen ID is associated with the process ID of the session,
run the command;
screen -r 14733
5. How To Install and Configure Screen on CentOS 7
Page | 4
Detach – Screen Session
After starting / connecting, to disconnect and keep the processes running without being terminated, you
need to detach the screen session, to disconnect an active session run the command;
Ctrl + A and D or Ctrl + A and Ctrl + D
Lock – Screen Session
At times locking screen would be required typically when you intended to step away from the system, to
lock screen run the command; password of the login user has to be entered to unlock the screen session.
Ctrl + X
Create – New Screen
To will launch a new screen session within existing screen session, we can create 10 screen sessions, these
screen session windows will be will be titled from screen:[0 to 10], run the command;
screen
6. How To Install and Configure Screen on CentOS 7
Page | 5
Switch – Next Screen Session
To navigate to next screen, run the command;
Ctrl + A and n
Switch – Previous Screen Session
To navigate to next screen, run the command;
Ctrl + A and p
Switch – List Screen Session
To list and switch to selected screen, run the command;
Ctrl + A and "
7. How To Install and Configure Screen on CentOS 7
Page | 6
Stop – Screen Session
To stop / kill a screen session, run the command;
Ctrl + A and k
Or Ctrl + D
Wipe – Screen Session
In some scenarios, screen session is abruptly killed or process ID of “SCREEN” is killed in such cases screen
session ID is in a defunct or dead state or it is also considered as unreachable session, you have to clean
the screen by running the command;
screen -ls
screen -wipe
8. How To Install and Configure Screen on CentOS 7
Page | 7
Scroll back – Screen Session
By default screen scroll back buffer is configured to display 100 lines; to increase the scroll back buffer,
this option can be tweaked by running the command;
screen -h 200
Split – Screen Session
At times you want to split screen to work on some task and would like to see the progress of the task
simultaneously, for this you can utilize split screen sessions. Screen splits can be done horizontally or
vertically. In this section we check different options.
This option is useful to check real time logs in one window and other window you are performing some
task that would impact the log generated.
Ctrl A + S
9. How To Install and Configure Screen on CentOS 7
Page | 8
Split – Screen Session – Start Session
After Splitting the screen, to utilize the split screen you need to create a new screen session, shell prompt
will be enabled / created to work in the split screen, run the command;
Ctrl A + C
Split – Screen Session – Switch Session
After creating the screen if you want to switch between screen sessions, run the command;
Ctrl A + <TAB Key>
Note: To split vertically, run the command “Ctrl A + |”
10. How To Install and Configure Screen on CentOS 7
Page | 9
Split – Screen Session – Exit Session
If you intended to close the split session, run the command;
Ctrl A + Q
Share – Screen Session – Other Users
At times you intended to share the screens with others on the servers, in this section we will configure to
be able to share the screen sessions with other users.
SUID Permissions – Modify
First step is to configure SUID permission, in order to share the screen sessions between different users
on the server, permissions have to be tweaked. Again this security poses a security risk, though this
configuration is a necessity to ensure that users have access to see screen sessions.
chmod +s /usr/bin/screen
chmod 755 /var/run/screen
11. How To Install and Configure Screen on CentOS 7
Page | 10
SUID Permission – Error
If the SUID permissions has not been configured and try to share the session, error message will be
displayed as below;
“Must run suid root for multiuser support”
Start – Screen Session – Name
Next step is to start the screen session associated with a name which will help us in easier identification,
to start a screen session associated with a name to it, run the command;
screen -S TestingSharingSession
12. How To Install and Configure Screen on CentOS 7
Page | 11
Access – Screen Session – Name
Now that we have configured and started the session, when the other user wants to access, from his login
session run the command;
screen -x root/TestingSharingSession