If you ssh into remote *nix boxes with any sort of regularity, it's almost inevitble that at some point your connection is going to drop. If it happens while you are editing a file it can be a real pain to start from where you left off. In my case, I had an account on my school's Unix server but it would kick me off after about 5-10 minutes of inactivity. Talk about frustrating.
Fortunately, the "screen" command let's you easily restart your session.
Your distro probably already has screen built in. If you're using ubuntu and it's not there just type:
sudo apt-get install screenFor gentoo the command would be:
emerge -av app-misc/screen
Once it's installed usage is trivial. If you're only going to be using a single session, connect via ssh and type:
screenIf you get dissconnected, reconnect your ssh session and type:
screen -RYou will then enter the session where you left off.
You can check if there is an existing screen session by typing:
screen -lsIf you want to use multiple sessions, you will need to name the sessions with a unique name.
screen -S session1Then connect in the same way, but including the session name:
screen -R session1Those are the basics! Screen has more advanced features you can check out in the man page.