Terminate a hanging SSH session

It may be very frustrating when SSH sessions just hangs because the target is power cycling or something. Lucky for you there is a "secret" escape sequence that allows you to terminate the session (and a few other things).

The escape sequence is <enter>~X where X is a command letter. To see all available key sequences, type <enter>~?. Example output:

marcus@Ilos:~$ ~?
Supported escape sequences:
  ~.  - terminate connection (and any multiplexed sessions)
  ~B  - send a BREAK to the remote system
  ~C  - open a command line
  ~R  - Request rekey (SSH protocol 2 only)
  ~^Z - suspend ssh
  ~#  - list forwarded connections
  ~&  - background ssh (when waiting for connections to terminate)
  ~?  - this message
  ~~  - send the escape character by typing it twice
(Note that escapes are only recognized immediately after newline.)

<enter>~. is my favorit. It terminates the connection and keep your mood cheerful.