Screen terminal multiplexer
'screen' is a good tool for 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 'screen' 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.
Start a new session
List existing sessions
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 "11131.pts-3.mhlab01" session).
Close or kill a session
When you are inside a 'screen' session you can 'kill' it by using:
or you might just type:
'screen' has various options/commands.
When your inside a 'screen' session you can get help and see what options you have by using:
(Do not press/hold 'CTRL' when entering '?')
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.