We're working on servers all day everyday, mostly by SSH. This can be annoying when you switch tabs and then want to go back to another and its timed you out and dead.
A nice quick shortcut to kill that session is to type in '~.' This needs to be on a new line so it wont hurt to press enter beforehand. You will not see it echo on screen, but it will kill the inactive/dead ssh session nicely.
Before you login again, if you are running Linux on your local machine, you can add the following into /etc/ssh/ssh_config
This will send a packet every 5 seconds to keep the connection alive. Very handy. You can make that longer if you want to use less bandwidth and your servers are setup ok with a longer keep alive.
Once you have logged into your server you can edit the /etc/sshd_config and add in the following
TCPKeepAlive yes ClientAliveInterval 60
This will keep things ticking over from the server point of view. Once you have added that in , restart the SSHD daemon with /etc/init.d/ssh restart . This will not kill your current SSH session, though it pays to logout and log back in again for it to take effect.
Do remember security, you do not want to leave your local machine alone, unlocked, with a live SSH session running logged in as root on a production server!