Linux under SCP command implementation File Replication example

Source: Internet
Author: User
Tags scp command

Copy files:

(1) Copy Local files to remote

SCP filename root@59.64.28.78: remote path

(2) Copy files from remote to local

SCP root@59.64.28.78: filename Local Path

Copy directory:

(1) Copy the local directory to the remote

Scp-r Directory name root@59.64.28.78: remote path

(2) from the remote directory back to the local

Scp-r root@59.64.28.78: Directory name local path.

Example

Copy remote files to local

SCP root@192.168.0.1:/home/database.php/var/www/database.php

Copy local files to another server

scp/var/www/database.php root@192.168.0.1:/home/database.php

Copy directory with the-r parameter, ssh non 22 port with the-p parameter.

Scp-p 2133-r root@192.168.0.1:/home/wwwroot//var/www/

scp-p 2133/var/www/root@192.168.0.1:/home/wwwroot/

Several parameters that may be useful:

-V is the same as the-V meaning in most Linux commands, and is used to show progress. Can be used to view connections, authentication, or configuration errors.

-C enables compression options.

-R passes all content under the directory.

-P Select the port. Note-P has been used by RCP.

-4 forcibly use IPV4 address.

-6 forcibly use IPV6 address.

Related Article

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.