hieuhtr / Blog

Don’t be lazy. Don’t make excuses. No one cares. Work fucking harder.
Other
6 stars 2 forks source link

Break out and escape SSH session #21

Open hieuhtr opened 7 years ago

hieuhtr commented 7 years ago

Problem:

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

Solved: Press ~ then press .

Why? Because ~. is an escape sequence that can terminate SSH session

More details:

Supported escape sequences:
  ~.  - terminate session
  ~B  - send a BREAK to the remote system
  ~R  - Request rekey (SSH protocol 2 only)
  ~#  - list forwarded connections
  ~?  - this message
  ~~  - send the escape character by typing it twice
(Note that escapes are only recognized immediately after newline.)

From http://askubuntu.com/a/29952/668849