Linux uses the scp command to remotely transfer files.

  

We know that most of the Linux system operations are implemented by commands. If you want to upload or download files remotely, you can choose to use the scp command. Explain the way Linux uses the scp command to upload and download files remotely. Friends who don't know can learn about it.

command: scp

Copy files between different Linux There are three common methods:

is a first ftp, wherein is mounted a Linux Ftp server, so you can use another ftp client program to copy the file.

The second method is to use the samba service, similar to the way Windows file copy operation, more concise and convenient.

The third is to use the scp command to copy files.

scp is a file copy with Security, based on ssh login. It is more convenient to operate. For example, to copy the current file to another remote host, you can use the following command.

scp /home/daisy/full.tar.gz [email protected]:/home/root

Then you will be prompted to enter the login of the root user of the other 172.19.2.75 host. Password, then start copying.

If you want to reverse the operation, copying the file from the remote host to the current system is also very simple.

scp root@/full.tar.gz 172.19.2.75:/home/root/full.tar.gz home/daisy/full.tar.gz

linux's scp command can be Copy files and directories between linux;

Examples

scp [-1246BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file] [-l limit] [-o ssh_option ] [-P port] [-S program] [[user@]host1:]file1 . . [[user@]host2:]file2

DESCRIPTION :scp copies files between hosts on a network.

Transfer files using scp

1. Download files from the server < Br>

scp username@servername:/path/filename /tmp/local_destination

For example, scp [email protected]:/home/kimi/test.txt put /home/kimi on 192.168.0.101 Download the file /test.txt

to /tmp/local_destination

2. Upload the local file to the server

scp /path/local_filename username@servername:/path

For example, scp /var/www/test.php [email protected]:/var/www/Upload the test.php file

in the /var/www/directory of this machine to 192.168. 0.101 in the /var/www/directory on this server

3. Download the entire directory from the server

scp -r username@servername:remote_dir//tmp/local_dir

For example: scp -r [email protected] /home/kimi/test /tmp/local_dir

4, upload directory to server

scp -r /tmp/local _dir username@servername:remote_dir

For example:

scp -r test [email protected]:/var/www/Upload the test directory in the current directory to /var/www on the server /directory

The above is the way to achieve remote upload and download files through the scp command. In addition to the scp command, you can also upload and download files remotely through the tool.

Copyright © Windows knowledge All Rights Reserved