Resume Broken or Disconnected SSH Session

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. 

screen -ls 

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.

Step3.) Doing 

screen -ls

will show your disconnected SSH sessions. Like as shown in next image.

Resume Broken or Disconnected SSH Session

Resume Broken or Disconnected SSH Session

 

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.

screen -R 

 

You can read further man pages for screen command. This is just very basic tutorial for Resuming Broken or Disconnected SSH Session

Akash Deep Singh

|| Eat Packets || Drink Management || Sleep Virtual || Work Linux || Think I.T. || Love MAC || Look After Windows || Dream APPS ||

Leave a Reply

Your email address will not be published. Required fields are marked *