LINUX – Screen command

Screen  is  a  full-screen window manager that multiplexes a physical terminal between several processes (typically interactive shells).

It is not installed by default but it can be easilly installed with yum or apt by calling up a package called “screen”

To start working just type in:


to list started sessions:

[root]# screen -list
There is a screen on: (Attached)
1 Socket in /var/run/screen/S-root.

to de-attach from running session:

[root]# screen -d 8210

[remote detached from]
[root]# screen -list
There is a screen on:    (Detached)
1 Socket in /var/run/screen/S-root.

to re-attach to our disconnected session just run:

[root]# screen -r 8210

Alternatively instead of using the IDs we can open new screen and name is:

[root]# screen -S mysession
[root]# screen -list
There are screens on:
        8283.mysession  (Attached)

and now we can re-attach to that session by calling its name:

[root]# screen -r mysession

Cool thing about screen that it very easy to setup a terminal sharing session so when i.e. two users log in as the same user they both will be able to see exactly the same thing.

to attach 2nd user to screen session called “mysession” issue this command:

[root]# screen -x mysession

The x option used above can only be used to connect to already attached session.

Leave a Reply

Your email address will not be published. Required fields are marked *

four × four =

This site uses Akismet to reduce spam. Learn how your comment data is processed.