laszlo.nu

How to kill an unresponsive ssh session

I often find myself in the somewhat cumbersome situation that a currently running ssh session stops responding, often due to a lost connection. The normal ctrl+c of course doesn’t work, the ssh client catches all the usual commands, which is very handy while you are still connected to the host but not very handy at all in this case.

My usual approach has been to switch to another terminal window or shell and then killing the process in question. Today I happened to be skimming through the ssh client’s man page and I found a section about escape characters. Suddenly I gazed upon the glory of the disconnect key sequence: a newline followed by ~.. It works like a charm. As always, I thought I should share.

  1. upsidethehead reblogged this from instabil and added:
    So useful! Thank you!
  2. stefanauss reblogged this from instabil
  3. kano89 reblogged this from instabil
  4. tomsthoughts reblogged this from instabil and added:
    That’s a very neat trick, good to know!
  5. awasim reblogged this from instabil and added:
    ,
  6. arjunbajaj reblogged this from instabil
  7. thefox21 reblogged this from instabil and added:
    laszlo.nu: That’s very interesting. I’ll try it the next time.
  8. braindead reblogged this from instabil and added:
    non smetto mai di stupirmi di come ci sia gente che usa quotidianamente [ssh] senza queste conoscenze...
  9. arunsag reblogged this from instabil and added:
    (~[space].) breaks any unresponsive ssh connection. Nice tip!
  10. chriscamps reblogged this from instabil and added:
    love stumbling on clean solutions...little annoyances I deal with regularly. Anyone who...
  11. instabil posted this