Linux File Transfer command SCP

Source: Internet
Author: User
Tags ssh port

First, install the SSH service on the two computers that transmit files to each other:

 
1. Yum-y install openssh2 and Yum-y install OpenSSH-clients


1. Obtain files on the remote server

 
SCP-P 2222 root@www.vpser.net:/root/lnmp0.4.tar.gz/home/lnmp0.4.tar.gz

The upper-case p parameter indicates the port after the ssh port is changed. If the ssh port is not changed, you do not need to add this parameter. Root@www.vpser.net represents using the root user to log on to the remote server www.vpser.net,:/root/lnmp0.4.tar.gz represents the file on the remote server, and the last/home/lnmp0.4.tar.gz represents the path and file name saved locally.

2. Obtain the directory on the remote server

 
SCP-P 2222-r root@www.vpser.net:/root/lnmp0.4 // home/lnmp0.4/

The upper-case p parameter indicates the port after the ssh port is changed. If the ssh port is not changed, you do not need to add this parameter. The-R parameter indicates recursive replication (that is, copying the files and directories under the Directory); The root@www.vpser.net indicates using the root user to log on to the remote server www.vpser.net ,: /root/lnmp0.4/indicates the directory on the remote server, And/home/lnmp0.4/indicates the path saved locally.

3. upload local files to the server

 
SCP-P 2222/home/lnmp0.4.tar.gz root@www.vpser.net:/root/lnmp0.4.tar.gz

The upper-case p parameter indicates the port after the ssh port is changed. If the ssh port is not changed, you do not need to add this parameter. /Home/lnmp0.4.tar.gz indicates the path and file name of the local file to be uploaded. The root@www.vpser.net represents using the root user to log on to the remote server www.vpser.net, And:/root/lnmp0.4.tar.gz represents the Directory and file name saved on the remote server.

4. Upload the local directory to the server

 
SCP-P 2222-r/home/lnmp0.4/root@www.vpser.net:/root/lnmp0.4/

The upper-case p parameter indicates the port after the ssh port is changed. If the ssh port is not changed, you do not need to add this parameter. The-R parameter indicates recursive replication (that is, copying the files and directories under the Directory);/home/lnmp0.4/indicates the directory to be uploaded, The root@www.vpser.net indicates using the root user to log on to the remote server www.vpser.net, :/root/lnmp0.4/indicates the directory location stored on the remote server.

5. Several useful parameters:

-V is the same as-V in most Linux commands. It is used to display the progress. It can be used to view the connection, authentication, or configuration error.

-C enable compression options.

-4 Use the IPv4 address forcibly.

-6 Use IPv6 addresses forcibly.

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.