Suspend ssh

ssh 连接到一半,想回到本地,可以 suspend ssh 会话。
输入 ~+<C-z> ,回到本地:

[email protected]A ~$: ~^Z  [suspend ssh]
[1]+  Stopped                 ssh [email protected]

[email protected]B ~$:


[email protected]B ~$: jobs
[1]+  Stopped                 ssh [email protected]


[email protected]B ~$: fg %1
ssh [email protected]

[email protected]A ~$:

上面的 ~ 符号其实就是 -e 选项的默认参数:

-e escape_char
             Sets  the escape character for sessions with a pty (default: `~'
             ) .  The escape character is only recognized at the beginning of
             a  line.   The  escape character followed by a dot (`.')  closes
             the connection; followed by control-Z suspends  the  connection;
             and followed by itself sends the escape character once.  Setting
             the character to “none'' disables any  escapes  and  makes  the
             session fully transparent.