Thats a common phenomenon that you break or disconnect your existing ssh connection to your host. It could be painful if you were editing a script and didnt save it. By all means you would like to reconnect and start or resume from the same place where your ssh session broke or disconnected. Linux has a software called screen which lets us resume our broken or disconnected SSH session.
How to use Screen to resume broken or disconnected ssh session.
Step1.) Check whether you have screen install or not. Type on the command line.
If you have screen installed on your host this will show some output. If you dont have screen installed move to step2 else move to step 3
Step2.). To install screen on ubuntu host type the following command
sudo apt-get install screen
. when the install is complete goto step1 and make sure screen is installed.
will show your disconnected SSH sessions. Like as shown in next image.
Step4.) To resume or broken/ disconnected SSH session type screen -R . If you hava named the session then you can type the name of session with screen command for eg. screen -R sessioname (a bit of advanced configuration) . Following is the command.
You can read further man pages for screen command. This is just very basic tutorial for Resuming Broken or Disconnected SSH Session