In this geekosaur post, we suggest using escape sequences as follows: "To kill the current session, Enter ↵ , ~ ,.
More of these escape sequences can be specified using Enter ↵ , ~ ,? :
Supported escape sequences: ~. - terminate session ~B - send a BREAK to the remote system ~R - Request rekey (SSH protocol 2 only) ~
You can close the list of Escape sequences by pressing enter .
Note that since pressing ~ ~ causes ssh to send ~ instead of intercepting it, you can access N nested ssh connections by pressing ~ N times. (This only applies to ~ s, which immediately follow enter .) That is, enter ~ ~ ~ ~ ~ ~ . terminates the ssh session 5 layers deep and keeps the other 4 intact. "
source share