Skip to content

Instantly share code, notes, and snippets.

@nepsilon
Last active March 12, 2024 09:44
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nepsilon/bd8573cfa1bf118d2d58f2c989083e8f to your computer and use it in GitHub Desktop.
Save nepsilon/bd8573cfa1bf118d2d58f2c989083e8f to your computer and use it in GitHub Desktop.
How to kill a frozen SSH session? — First published in fullweb.io issue #104

How to kill a frozen SSH session?

No need to close your terminal tab anymore (or furiously hitting your keyboard) when your SSH session frozen. SSH has an escape sequence that will let you properly close the connection and give you back the prompt. In order, type: Return, ~, .

That’s it! This will send an escape sequence to your local SSH socket and close the connection.

SSH has more escape sequences under the hood, hit Return ~ ? to display the full list:

~?
Supported escape sequences:
 ~.   - terminate session
 ~B   - send a BREAK to the remote system
 ~R   - request rekey
 ~#   - list forwarded connections
 ~?   - this message
 ~~   - send the escape character by typing it twice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment