'Screen' it's really awesome, we can create a session with multiple
interactive shells, and can share a server screen with multiple ssh
connections.
Screen : Screen is a terminal multiplexer, which
allows a user to access multiple separate terminal sessions inside a
single terminal window or remote terminal session (such as when using
SSH).
Suppose you want to run a program persistently (even if a terminal window closes, for example). For that, you might use thenohup command.
But what if you want to start a command-line session on one computer
and then go home and resume that session? For something like that,
you’ll want to use screen. Screen is also really handy because you can have multiple shells running in one terminal window.
Steps to install 'Screen', and some basic important commands
1. Installing screen
apt-get install screen
2. To create a new session
screen -S <session-name>
2.
the most important screen commands that you need to control screen.
These commands begin with CTRL a to distinguish them from normal shell
commands.
Ctrl a c - Creates a new screen session so that you can use more than one screen session at once. Ctrl a n - Switches to the next screen session (if you use more than one). Ctrl a p - Switches to the previous screen session (if you use more than one).
Ctrl a d - Detaches a screen session (without killing the processes in it - they continue).
3. To list down all current sessions
screen -ls
4. To reattach on perticular session
screen -r <session_name>
3. To close a screen session where all tasks are finished you can type