Copy files across servers (use of SCP command)

Operating prerequisites:

①You have logged into the local server;

②You know the IP address of the remote server (assumed to be 192.168.0.2);

③You have a Linux user on the remote server (assuming root)

1. Local file -------> remote server
Suppose you want to copy a file named a.tar.tz under the local computer /home to /home/tmp on the remote server. You can use this command:

scp /home/a.tar.tz [email protected]:/home/tmp/ (will prompt for root password)

2. Remote server file -------> Local
Suppose you want to copy the /home/a.tar.tz file on the remote server to the current directory of the machine and use this command:


scp [email protected]:/home/a.tar.tz
copies the files in the entire directory of the remote machine:


scp -r [email protected]:/home/* ./

Guess you like

Origin blog.csdn.net/cyfcsd/article/details/83927871