How to use the SSH exit character to switch SSH sessions in Linux


This article mainly explains how Linux uses the SSH exit character to switch SSH sessions. Interested friends may wish to take a look. The method described in this article is simple, quick and practical. Now let the editor take you to learn how to use the SSH exit character to switch SSH sessions in Linux!

1. Log in to the remote host:

localhost$ ssh
[email protected]'s password:
last login: fri mar 26 14:48:08 2010 from euos

2. Connected to the remote host :


3. To temporarily return to the local host, enter the exit symbol: "~" combined with "control-z".

When you enter "~", you will not see it on the screen immediately, and it will be displayed together after you press Enter.
As follows, enter "~" in the remote host "
remotehost$ ~^z [suspend ssh]
[1]+ stopped ssh

4. Now it has returned to the local The host, the ssh remote client session is running in the unix background, you can view it like this:

localhost$ jobs
[1]+ stopped ssh

5. You can switch the ssh session process running in the background to the foreground and return to the remote host again without entering a password

localhost$ fg %1

Copyright Description:No reproduction without permission。

Knowledge sharing community for developers。

Let more developers benefit from it。

Help developers share knowledge through the Internet。

Follow us