Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This is a very simple problem. I use gnome-terminal to SSH to other machines every day. I do this on a laptop which I carry around the office, so I am constantly switching between wired and wireless networks. When this happens my SSH sessions drops off and the terminal freezes.

Why does this happen (the freezing, not the session dropping) and is their a way to prevent it? I know I can get around this by logging off from the remote server before I know I want to disconnect my laptop from Ethernet.

It's annoying because I have to manually close the terminal session after it has frozen which pops up a dialogue box and I also lose the title of the session - all very time consuming. It would be much better if the ssh session just got killed and it returned me back to the local bash prompt.

share|improve this question
Try pressing Ctrl + D – becko Aug 18 '14 at 14:07
up vote 10 down vote accepted

The session will eventually time out and disconnect; this will happen faster if you configure ServerAliveInterval and ServerAliveCountMax in ~/.ssh/config. To force an immediate disconnect, Return~..

share|improve this answer

Without getting into the why of it, here's how you fix it:


that's tilde-dot. Press those two keys, one after another, and that will disconnect from the hung ssh session and give you back your terminal. Yay!

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.