Files
MarkdownNotes/howto - kill unresponsive SSH.md
chawley 65c434952a Catagorized Notes
Renamed notes to fit categories and be easier to find later: blog, config, howto
2023-04-28 10:31:11 -04:00

36 lines
1.0 KiB
Markdown

# 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:
```shell
[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.)