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.


I am a g33k, Linux blogger, developer, student and Tech Writer for My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.