Network infrastructure is the backbone of your computer’s connectivity and therefor should be stable, reliable and very little, if no downtime. If it isn’t the case, can you imagine getting disconnected from the server while you are remotely running your scripts via ssh? Not only that the script has to be re-run, but might damage other important files as well.
If you are in a situation where you need something to remain connected to the server, you can use screen. screen is a full-screen window manager that multiplexes a physical terminal between several processes typically interactive shells). When screen is called, it creates a single window with a shell in it (or the specified command) and then gets out of your way so that you can use the program as you normally would. Then, at any time, you can create new (full-screen) windows with other programs in them (including more shells), kill existing windows, view a list of windows, turn output logging on and off, copy-and-paste text between windows, view he scrollback history, switch between windows in whatever manner you wish, etc. All windows run their programs completely independent of each other. Programs continue to run when their window is currently not visible and even when the whole screen session is detached from the user’s terminal.
If screen command is not readily available, you can install it by using your distro’s package manager (you need to be root to do this):
Fedora: yum install screen
Ubuntu: apt-get install screen
RHEL: up2date screen
To run screen, just type the command:
$ screen
When screen is called, you now have a terminal that remains connected, even if your session is disconnected. This means that whatever it is that you are doing, remains where they are until the screen process is terminated.
If you want to resume a screen session, just type the command:
$ screen -r
This will resume any existing running screen sessions, and brings you back the terminal you were previously working on. If you want to detach the previous session and reconnect to it, use this command:
$ screen -dr
This is useful when the previous session exited abnormally and the screen refuses to resume because the session isn’t detached yet.
Popularity: 6% [?]


















This is a must for remote admins, especially if you are connected to a crappy ISP and always got a timeout on your ssh session.
Nice tip.
[...] alternative I have written before here is using screen command or by editing the SSH config file to prevent SSH from disconnecting its [...]