Using Screen To Work Remotely
Screen is a Linux tool that allows you to keep your session alive in case your disconnected. Once you gain back remote access to your server, you can “reattach” yourself to your previous session.
So for example, if you’re compiling a huge application and you get disconnected for whatever reason, the server will keep doing its thing and you will be able to get back in there later.
How To Use Screen For Session Management
First of all, you gotta make sure you’ve got screen installed. On CentOS / RHEL, you can use Yum:
# yum install screen
Othewise you can surely find a compiled package for your distribution.
When you want to create a new screen session, simply type
Now suppose you got disconnected, once you logged back in you can list the ongoing screen sessions:
# screen -list There is a screen on: 14173.pts-0.clapton (Detached) 1 Socket in /var/run/screen/S-root.
Now to reattach to an existing session, type:
# screen -r session_number
Where as in this example the session number would’ve been 14173. And when you want to end a screen session, simply type exit.
You might also find other interesting options for screen in the man pages.