Cheatsheet Pages / SSH Cheatsheet

How to kill a frozen SSH session — the Enter ~. escape

The session stopped responding and not even Ctrl+C helps.

Every flag and config keyword was checked against the OpenSSH 9.6 man pages, and the config examples were parsed for real with ssh -G.

# type these INSIDE a live (or hung) ssh session; ~ must be the first char after Enter
<Enter>~.       # disconnect NOW — the rescue for a session that stopped responding
<Enter>~^Z      # background ssh itself and get your local shell back

Good to know

Type the sequence inside the live (or hung) session — the ~ must be the first character after Enter. Enter ~^Z backgrounds ssh itself and gives your local shell back.

SSH Cheatsheet one-page card — commands that actually work
The full one-page card — SSH Cheatsheet. Get the complete cheatsheet on GitHub