How to Disconnect from SSH in a Terminal on Mac OS X

Ever since switching to OS X there has been one tiny annoyance bugging me, and it really is a small one: My SSH sessions will hang whenever my VPN times out, and then I have to close out of the Terminal to get it to disconnect, because SSH takes forever to time out for some reason.

Of course, there are a bunch of settings that you can use to change the SSH timeout so it’ll recognize that the connection is gone, but I was in the mood for instant gratification. Luckily there is an easy shortcut key sequence you can use to make SSH disconnect instantly.

Enter ~ .

That’s the Enter key, then the Tilde (~) key, followed by the period key (.), although I was able to also just use the tilde followed by period when using a drop-down terminal. In any case, it disconnects me instantly on OS X Mavericks, and that’s good enough for me.

I’m sure that I’ll be using this shortcut key sequence every day, so I won’t forget it, but maybe it’ll help somebody else. And for those that are wondering, CTRL + D just wasn’t working for me.

Lowell Heddings, better known online as the How-To Geek, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on if you'd like.