sontek ( John M. Anderson )

September 29, 2007

Recover locked terminal from dead SSH session

Filed under: Linux — Tags: , — sontek @ 2:21 pm

If you’ve ever been shelled into a server when your connection drops, you would have noticed that your terminal is completely locked up, you can’t even CTRL+C to get out of it. If you would like to save your terminal you can with the key sequence “<ENTER> ~ .”

SSH has a few more key strokes you can use too! To find out which ones are available type “<ENTER> ~?”

it’ll bring up this:

Supported escape sequences:
~. - terminate connection
~B - send a BREAK to the remote system
~C - open a command line
~R - Request rekey (SSH protocol 2 only)
~^Z - suspend ssh
~# - list forwarded connections
~& - background ssh (when waiting for connections to terminate)
~? - this message
~~ - send the escape character by typing it twice
(Note that escapes are only recognized immediately after newline.)

Thanks to Herlo for this tip.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • description
  • Pownce
  • Slashdot
  • StumbleUpon
  • TwitThis

1 Comment »

  1. I can’t say how much this pisses me off. Thanks for the post.

    Comment by Will Smith — September 29, 2007 @ 11:58 pm

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress