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:

screen

to list started sessions:

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

to de-attach from running session:

[root]# screen -d 8210

[remote detached from 8210.pts-0.bobcat.com]
[root]# screen -list
There is a screen on:
8210.pts-0.bobcat.com    (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.

Source

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s