The SCP command in Linux implements remote upload download files/folders

Source: Internet
Author: User
Tags file copy ftp client scp command scp command in linux


Command: SCP

There are 3 common ways to copy files between different Linux types:

The first is FTP, which is one of the Linux installation FTP Server, this can be another use of FTP client program for file copy.

The second approach is to use the Samba service, similar to the Windows file copy of the way to operate, more concise and convenient.

The third way is to use the SCP command for file copying.

The SCP is a security file copy, based on SSH login. Easy to operate, such as to the current one file copy to a remote other host, you can command the following.

Scp/home/daisy/full.tar.gz Root@172.19.2.75:/home/root

You will then be prompted to enter the login password for the other 172.19.2.75 host's root user, and then copy it.

If you want to reverse the operation, it is also easy to copy the files from the remote host to the current system.

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

Linux's SCP commands allow you to copy files and directories between Linux;

Example
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.
Transferring files using the SCP

1, download files from the server


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

For example, the SCP Codinglog@192.168.0.101:/home/kimi/test.txt put 192.168.0.101 on the/home/kimi/test.txt
File Download to/tmp/local_destination

2, upload local files to the server


Scp/path/local_filename Username@servername:/path

For example, scp/var/www/test.php codinglog@192.168.0.101:/var/www/the test.php file in the native/var/www/directory
Upload to the/var/www/directory on the 192.168.0.101 server

3, download the entire directory from the server


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

For example: Scp-r codinglog@192.168.0.101/home/kimi/test/tmp/local_dir

4, upload directory to the server


Scp-r/tmp/local_dir Username@servername:remote_dir

For example:

Scp-r test codinglog@192.168.0.101:/var/www/upload the test directory in the current directory to the server/var/www/directory

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.