Home  >  Article  >  Operation and Maintenance  >  How to switch SSH sessions in Linux using SSH exit character

How to switch SSH sessions in Linux using SSH exit character

PHPz
PHPzforward
2023-05-11 17:22:141150browse

1. Log in to the remote host:

localhost$ ssh 172.16.1.165
oracle@172.16.1.165's password:
last login: fri mar 26 14: 48:08 2010 from euos

2. Connected to the remote host:

remotehost$

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

When you enter "~" you will not see it immediately on the screen, it will only be displayed together when you press and press Enter. .
As follows, enter "~"
remotehost$ ~^z [suspend ssh]
[1] stopped ssh 172.16.1.165
localhost$

4. Now that you have returned to the local host, the ssh remote client session is running in the unix background. You can view it as follows:

localhost$ jobs
[1] stopped ssh 172.16.1.165

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

localhost$ fg % 1
ssh 172.16.1.165
remotehost$

The above is the detailed content of How to switch SSH sessions in Linux using SSH exit character. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete