Suspend ssh

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

jaseywang@A ~$: ~^Z  [suspend ssh]
[1]+  Stopped                 ssh jaseywang@

jaseywang@B ~$:


jaseywang@B ~$: jobs
[1]+  Stopped                 ssh jaseywang@


jaseywang@B ~$: fg %1
ssh jaseywang@

jaseywang@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.

  • Li Fanxi


    • jaseywang

      多谢支持,继续努力 :-)