Skip to content

ssh Escape Sequences

Use escape sequences to manage your client terminal session. Escape sequences are recognized only after a newline character. If you have just logged in, press Enter before you enter your first escape sequence. You can configure an alternate escape character using -eon the command line or EscapeChar in the configuration file.

The following escape sequences are available. These are shown with the default escape character, a tilde (\~).

~. Terminates the connection.

~^Z Suspends ssh.

~# Lists active forwarded connections. Note: Forwarded connections are listed only when the ports are actually transmitting data.

~- Disables use of the escape character for the duration of the session.

~? Displays a list of available escape sequences.

~~ Sends the escape character to the host. (Type the escape character twice to send one escape character.)

~C Execute command mode, which you can use to request port forwarding. The options are:

-L[bind_address:]port:host:hostport    Request local forward
-R[bind_address:]port:host:hostport    Request remote forward
-KL[bind_address:]port                 Cancel local forward
-KR[bind_address:]port                 Cancel remote forward

~V Sends version information to stderr.

~s Sends connection information to stderr.

~r Initiates an immediate key exchange to establish new encryption and integrity keys.

~l Enters line mode. Keystrokes are stored to a buffer and output when you press Enter.

~B Sends a BREAK to the remote system.