SSH Escape Characters or How to kill Dead SSH Connection

Have you ever got ssh stuck?
For years every time I’ve wanted to close the ssh session I’ve used “kill” command – Guess what? no need to.

By pressing Enter followed by  Shift~ and without leaving the Shift press “.”

More options available – Just press “?” instead of “.”:

root@vps:~# ~?
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 (SSH protocol 2 only)
  ~^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.)

Leave a Reply

Your email address will not be published. Required fields are marked *