How to kill a hung SSH session

Josh Sherman
1 min read
Command-line Interface

It can happen for a number of reasons. You’re connected to a server via SSH and things just stop responding. It’s hung, stuck, frozen, locked up, unresponsive or many just not be paying attention to the keys you’re so desperately pounding on your keyboard.

It’s happens regularly, but not regularly enough that I end up remembering how to remedy the situation. Sure you could just close the terminal tab or window, but that’s not very elegant.

Fortunately there’s a quick couple of key strokes you can make to take care of things for you.

Next time you have an SSH session that’s hung up, just tap ~ and then ..

That’s it!

Upon entering this magical sequence of keys, you should be greeted with a Connection to x.x.x.x closed. and are dropped back to your system’s command prompt.

I’m not sure the circumstances, but sometimes I have to hit the keys a few times before it will take, so I usually slam the Enter key a few times before just out of rage.

Hopefully documenting this will help me remember this sequence better!

Join the Conversation

Good stuff? Want more?

Weekly emails about technology, development, and sometimes sauerkraut.

100% Fresh, Grade A Content, Never Spam.

Related Articles