Screen is like a window manager for your console. It will allow you to keep multiple terminal sessions running and easily switch between them - much like the Mac OS and Windows 10 desktop screens. It also protects you from disconnection, because the screen session doesn’t end when you get disconnected - this is very handy if your connect gets borken pipes or unreliable connections.
To make sure screen is installed on the server you are connecting to use the following command:sudo apt-get install screen
Or with CentOS 5+sudo yum install screen
Now that screen has been installed you can create a new screen session by using the simple command below.screen
To disconnect but leave the session running in the background:Press Ctrl+A and then Ctrl+D. You will see the message [detached]
To reconnect to an already running session:screen -r
To reconnect to an existing session, or create a new one if none existsscreen -D -r
To create a new window inside of a running screen sessionHit Ctrl+A and then C in immediate succession. You will see a new prompt.
To switch from one screen window to anotherHit Ctrl+A and then Ctrl+A in immediate succession.
To list open screen windowsscreen -ls
There’s lots of other commands you can use but the above will do most of the common elements of using screen.