Linux explains how to copy files from one machine to another.

Source: Internet
Author: User
Tags gz file

Linux explains how to copy files from one machine to another.

1. Function Description

Scp Is security copy, which is used to copy files or directories from one Linux system to another. Scp uses the SSH protocol to ensure data transmission security. The format is as follows:

Scp remote username @ IP Address: absolute path of the file local Linux System Path

Scp local Linux system file path remote user name @ IP Address: absolute path name of the remote system file

Scp uses the first format to copy a file or directory on a remote Linux system to a local Linux system, the second method is to copy a local file or directory to a path in a remote Linux system.

2. Example

(1) In the Linux system with the IP address "192.168.60.133", we plan to copy the/home/ixdba/etc.tar.gz file in the system to the IP address "192.168.60 ".

168 "remote Linux system under the/tmp directory of the root user:

Scp/home/ixdba/etc.tar.gz root@192.168.60.168:/tmp

After the command is entered, enter the root password of the "192.168.60.168" server and then copy data remotely.

If we are on the "192.168.60.168" server, you can also use the following command to transmit data:

Scp root@192.168.60.133:/home/ixdba/etc.tar.gz/tmp

After the command is entered, enter the root password of the "192.168.60.htm" server, and then start copying data remotely. For example: scp./id_rsa.pubjing.wei@10.28.8.20:/home/jing. wei go to a server and copy id_rsa.pub in the current directory to another server.

(2) Copy all the files and sub-directories in the local/etc directory to the/opt directory under the root user of the remote Linux system whose IP address is 192.168.60.135:

Scp-r/etc root@192.168.60.135:/opt

The option "r" here is the same as the option "r" of the cp command.

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.