Screen is something I’ve never been interested in using previously, but to be honest, it has many benefits. Screen is basically a window manager that allows you to run many windows from your SSH session. By doing this you don’t need to initiate several SSH sessions to a box when running complex tasks. Also if your connection is terminated in the middle of your task, you can resume your screen session.
Basics:
Start screen:
screen
Create new screen window:
CTRL + A + C
Run a command in a new screen window:
CTRL + A + [command]
Flip to the nextscreen:
CTRL + A + N
Flip to the previous screen:
CTRL + A + P
Detach screen (send screen to the background and return to your shell)
CTRL + A + D
Show screen sessions:
screen -ls
There is a screen on:
21970.pts-0.ct-1565 (Detached)
Re-attach to a detatched screen:
screen -r [session]
screen -r 21970.pts-0.ct-1565 in this case
If your screen is still attached you must detatch it before being able to re-attach:
screen -d [session]
To Exit from screen back to your shell, just:
exit
[screen is terminating] will let you know your back.