Break out and escape SSH session

Problem

SSH session is stuck and cannot be exited by entering exit or CTRL+D
And we need to break out this session without closing terminal emulator

How to solve?

Press ~ then press .
Why? Because ~. is an escape sequence that can terminate SSH session
More details:
1
Supported escape sequences:
2
~. - terminate session
3
~B - send a BREAK to the remote system
4
~R - Request rekey (SSH protocol 2 only)
5
~# - list forwarded connections
6
~? - this message
7
~~ - send the escape character by typing it twice
8
(Note that escapes are only recognized immediately after newline.)
Copied!
Last modified 2yr ago
Copy link