I know that OpenSSH knows an "escape character". For example, you can
terminate the session using "~.", even if the remote host has frozen
and won't let you log out using the normal "^D".
Well, but sometimes this doesn't work. I had no idea why until I
finally had a closer look at the friendly manual:
The escape character is only recognized at the beginning of a line.
Aha! You have to hit return before entering "~.". In actuality, the
"escape character" is an "escape sequence": "\n~", not just "~".