Ubuntu 16.04.

My terminal freezes, as the title says. I know it's an ssh session, however I would expect only to drop me off, but the whole terminal freezes, no mouse nor keyboard input is possible.

Does anybody know a solution?

  • 5
    In the terminal with the hanging SSH session you could try the following key-sequence which will close the connection. ~, then shortly afterwards .
    – Thomas
    Commented May 22, 2017 at 9:59
  • Seems does not work all the time. Sometimes it does.
    – MattSom
    Commented May 30, 2017 at 13:20

1 Answer 1


For the SSH escape sequences to work you need to be on a newline, so hit the RETURN key first.

Then usage of eg ~. (terminate connection) will work.

To see all supported escape sequences use ~? in a SSH session:

Supported escape sequences:
 ~.   - terminate connection (and any multiplexed sessions)
 ~B   - send a BREAK to the remote system
 ~C   - open a command line
 ~R   - request rekey
 ~V/v - decrease/increase verbosity (LogLevel)
 ~^Z  - suspend ssh
 ~#   - list forwarded connections
 ~&   - background ssh (when waiting for connections to terminate)
 ~?   - this message
 ~~   - send the escape character by typing it twice
(Note that escapes are only recognized immediately after newline.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .