[Howto] Exit bad/broken/locked ssh sessions

I just have to share this: have you ever been in a situation where the SSH connection locked up, and you were not able to send any more commands? And particularly, you were not able to send commands like Ctrl+c or similar to close the session?

In such situations I usually had to close the terminal - which is not always fortunate.

But: you can just close the SSH session with an escape sequence: next time, just do Enter+~+. !So just press the enter key, followed by the tilde key followed by the dot - and you should be back to your terminal!

I use SSH on a daily base for more than ten years, but never knew about that! :sweat_smile:

Read more in the actual SSH documentation.

6 Likes