SSH Escape Sequences
Have you ever had an SSH connection timeout on you and you’re left with what looks like a locked session. Repeatedly hitting the Enter key does nothing. It seems that there is nothing that you can do except close the console terminal session…or is there something else?
Many people are not aware that SSH has its own set of keyboard shortcuts. The solution to the above problem is to terminate the connection using the first of these shortcuts.
- Press the Enter key.
- Press the tilde followed by a period.
- Press Enter again. You should now be back at your command prompt.
Supported escape sequences:
~.
- terminate
connection (and any multiplexed sessions)
~B
- send a
BREAK to the remote system
~R
- request rekey
~V/v
- decrease/increase verbosity (LogLevel)
~^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.)
It is important to note that you always press the Enter key before typing the key sequences above.