Screen terminal multiplexer

screen is a terminal multiplexer. It's a good tool for e.g. remote support. It can also be used to start a command you want to keep running after you close your console session (you can later on attach to your running session). When you enter a screen session you will not notice too much.
To know if you are inside a screen session, use the notes in 'get help' section mentioned below.

Attach to a existing session

Lets say you want to attach to a existing session (e.g. the above 11131.pts-3.mhlab01 session).

screen -x 11131

or

screen -x pts-3

Tip: If you see Attaching from inside of screen?, you are already inside a screen session.

Controlling a screen session

While inside a screen session, you can control it using keyboard shortcuts. We will only describe some of those alternatives.

Tip: To enter a keyboard shortcut that controls the current screen session, you should click A while holding down CTRLIn the below examples this procedure is described as ^A

Get help

One of the most useful commands is the one that gives you 'help'.
While in your screen session, click:

^A ?

(Do not press/hold CTRL when clicking ?)

Detach from a session

Sometimes it's useful to just detach from a session without killing it.

^A d

Tip: Try starting ping 127.0.0.1 while inside a screen session and then detach from the session.After some while re-connect to the session using screen -x.Note that the "seq" value indicates that ping had continued running while you where detached from the session.

Close or kill a session

To 'kill' a session:

^A k

Confirm by clicking y when prompted.

You can also 'kill' your session by entering:

exit

Extra

Connect to serial console

screen is a good tool when you need to connect to a serial console (e.g. if you want to configure a switch using it's serial port). Connecting to a serial console could look like this:

screen /dev/ttyS0 9600

Force console users into a screen session

In some cases you might want to force only console users into a screen session.
Note that the this configuration will not force SSH-users into a screen.
Edit /etc/profile and add the following code to it: