Screen terminal multiplexer
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 session you will not notice too much.
To know if you are inside a session, use the notes in 'get help' section mentioned below.
In order to useyou will have to install it:
Start a new session
To enter asession you just enter:
List existing sessions
When you have started some session(s) you can list them:
You might get a list that looks like this:
There are screens on: 11151.pts-1.mhlab01 (Attached) 11131.pts-3.mhlab01 (Attached) 2 Sockets in /var/run/screen/S-root.
Attach to a existing session
Lets say you want to attach to a existing session (e.g. the above
Controlling a screen session
While inside asession, you can control it using keyboard shortcuts. We will only describe some of those alternatives.
One of the most useful commands is the one that gives you 'help'.
While in your session, click:
(Do not press/holdwhen clicking )
Detach from a session
Sometimes it's useful to just detach from a session without killing it.
Close or kill a session
To 'kill' a session:
Confirm by clickingwhen prompted.
You can also 'kill' your session by entering:
Connect to serial console
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:
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:
if [ -n "$PS1" ] && [ -z "$STARTED_SCREEN" ] && [ -z "$SSH_TTY" ]; then STARTED_SCREEN=1 ; export STARTED_SCREEN screen -RR && exit 0 echo "Screen failed! continuing with normal bash startup" fi
Force console and SSH users into a screen session
The above example holds the if-statement:
&& [ -z "$SSH_TTY" ]
Remove this part from above configuration to force SSH sessions into a screen session.
Other terminal multiplexers
A similar tool is here.which is documented