How to use SSH to implement switch between hosts

Source: Internet
Author: User

When working in a Linux/unix environment, the most common way to log on to a remote host is to use SSH for remote logins, but sometimes we need to switch between two or more host terminals frequently, so it is cumbersome to provide a password each time. In fact, you can not completely from the SSH exit, directly suspend the current job can be, the specific way is to type the symbol "~", and then the shortcut key Ctrl + Z, so you can suspend the SSH already logged in, if you want to return, you can directly FG or FG followed by the specific job number Examples are as follows:

knightrcom@local-server:~$ hostname
Local-server
Knightrcom@local-server: ~$ ssh knightrcom@ "test2.csdn.com"
KNIGHTRCOM@test2.csdn.com ' s Password:
Last Login:thu June 06:31:11 from 9.123.72.20

Dis Beez My box.
It don ' is real fast.
But If you are mess with it,
I be Kickin ' Yo butt!
--Management
[Knightrcom@test ~]$ hostname
Test
[Knightrcom@test ~]$ ~^z [suspend SSH]

[1]+ Stopped ssh knightrcom@ "test2.csdn.com"
knightrcom@local-server:~$ hostname
Local-server
knightrcom@local-server:~$ Jobs
[1]+ Stopped ssh knightrcom@ "test2.csdn.com"
knightrcom@local-server:~$ FG
SSH knightrcom@ "test2.csdn.com"

[Knightrcom@test ~]$ echo "Game over:)"

The

Yellow section is the most critical, the first is to suspend the current job, and the other is to restore the current job:)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.