Why GNU Screen?
Scenario: you finish working with an SSH session, you close your laptop to go for lunch or for a tea. Then you come back and open your laptop wanting to resume your job, but the connection is broken or the VPN breaks and forced you to disconnect. You have no choice but setup the connection once again and reopen the documents/apps before you can resume from where you left.
Solution: with GNU Screen, you can directly resume from where you left, without having to reopen all the documents/apps you’ve been working on.
The concept of GNU Screen is like turning on and off of a computer screen. You turn off a screen when you are done, let the computer to hang in there; you come back later, turn the screen back on and continue your tasks.
Steps Using GNU Screen
- Connect. Connect to a remote server and create a Screen session via
ssh -t <server.domain.name> screen -R
- Detach. When done with the SSH session, use
ctrl-a dto detach from the session. This also disconnect with the SSH server.
- Reconnect. The SSH session is still running actually. When you are ready to resume working with the session, use
ssh -t <server.domain.name> screen -Ragain to reconnect, then you are right where you left it.
- Terminate. To permanently terminate a Screen session, just disconnect from the server the usual way (
Limitation: If you are using apps with graphical interface, not just the command line environment, then
screen is not suitable for resuming such jobs, and VNC instead would be the ideal choice.