Put this into ~/.bashrc then everytime you ssh to a host it will startup a screen session or resume one. This way you will not loss work when connection is broken. ssh() { if [[ "$2" == "" ]]; then command ssh "$1" -Xt screen -aAdr -RR work bash else command ssh $@ fi } ---- ---- Source:http://profarius.com/content/persistent-ssh