1.0 KiB
How to kill an unresponsive SSH session
Summary
Lets say you're happily typing in your remote shell when all of sudden, the crappy Wi-Fi network you're using goes down. You end up with a perfectly unusable frozen shell, ugh!
To do that, assuming you lost connectivity, press in that order:
[Enter]
~
.
That is, return key then tilde then period.
This will send an escape sequence to your local SSH client and terminate the connection. So this will always work even without a network connection.
Here's the list of escape sequences:
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.)