Uploading files to a Linux cloud server in the Mac/linux/centos terminal

Source: Internet
Author: User
Tags scp file vps scp command ssh port

1, Mac upload files to the Linux server

SCP file name User name @ server IP: Destination path
such as: scp/users/test/testfile [email protected]:/test/

2, Mac Upload folder to the Linux server, compared with the upload file more than the-R

Scp-r folder directory user name @ server IP: Destination path
such as: Scp-r/users/test/testfolder [Email protected]:/test/

3. Linux server download files to Mac

SCP User name @ server IP: File path destination path
such as: SCP [email protected]:/test/testfile/users/test/

4, Linux Server download folder to the Mac, and download the file compared to the extra-r

SCP-R User name @ server IP: File path destination path such as: scp-r [email protected]:/test/testfolder/users/test/

CentOS cannot use the SCP command workaround

In the test, you need to pass the files between the two virtual machines, the first thought is the SCP command, the results prompt:

-bash:scp:command not found

Take it for granted with the Yum Install SCP command, the result is:

No Package SCP available.

Later found SCP this thing should belong to openssh-clients this package, run:

Yum Install openssh-clients

Run the SCP again and run it again:

SCP 1.so [Email protected]:/root/

After entering your password, you are prompted again:

Bash:scp:command not found

In the target host also installs the Openssh-clients, tries again, solves the problem.

Mac uploads local files to the server

Scp-p 22/java/program.war [Email protected]:/usr/server/tomcat7/webapps/

Upper Port Capital P is the parameter, 22 means the port after changing the SSH port, if not changed SSH port can not add this parameter. /java/program.war represents the path and file name of the file that is ready to be uploaded locally. [email protected] means that using the root user to log on to the remote server www.vpser.NET,:/usr/server/tomcat7/webapps/represents the directory and file name saved on the remote server.

The above is my practice, the following is the tutorial instructions

Linux (MAC) SSH remote file/directory Transfer command SCP
I believe you vpser in the use of VPS will often in different VPS between the backup data or transfer data, most of the time the VPS has installed Nginx or similar Web server, directly to transfer the files to the Web server directory, Then execute on the target machine: wget http://www.vpser.net/testfile.zip on the line. The SCP command comes in handy when there is no Web server and FTP server installed on the VPS or if the method is more cumbersome.

Iii. methods of use of the SCP

1. Get the files on the remote server

Scp-p 2222 [Email protected].net:/root/lnmp0.4.tar.gz/home/lnmp0.4.tar.gz

Upper Port Capital P is the parameter, 2222 means the port after changing the SSH port, if not changed SSH port can not add this parameter. [email protected] means that 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 face/home/ Lnmp0.4.tar.gz represents the path and file name that is saved locally.

2. Get the directory on the remote server

Scp-p 2222-r [Email protected]:/root/lnmp0.4//home/lnmp0.4/

Upper Port Capital P is the parameter, 2222 means the port after changing the SSH port, if not changed SSH port can not add this parameter. The-r parameter indicates a recursive copy (that is, the files and directories under the directory are copied); [email protected] means to log on to the remote server using the root user www.vpser.net,:/root/lnmp0.4/represents the directory on the remote server, the last The/lnmp0.4/represents the path that is saved locally.

3. Upload the local file to the server

Scp-p 2222/home/lnmp0.4.tar.gz [Email protected]:/root/lnmp0.4.tar.gz

Upper Port Capital P is the parameter, 2222 means the port after changing the SSH port, if not changed SSH port can not add this parameter. /home/lnmp0.4.tar.gz represents the path and file name of the file that is ready to be uploaded locally. [email protected] means that using the root user to log on to the remote server www.vpser.net,:/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/[email protected]:/root/lnmp0.4/

Upper Port Capital P is the parameter, 2222 means the port after changing the SSH port, if not changed SSH port can not add this parameter. The-r parameter indicates a recursive copy (that is, copying files and directories under the directory);/home/lnmp0.4/indicates the directory to be uploaded, [email protected] means to log on to the remote server using the root user www.vpser.net,:/root/ LNMP0.4/represents the directory location that is saved on the remote server.

5. Several parameters that may be useful:

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

-C Enable compression option.

-4 forcibly use the IPV4 address.

-6 forcibly use the IPV6 address.

The file on the diahosting VPS is attached to the SCP transfer on Linode, at a speed of 10mb/s:

Linux (MAC) SSH remote file/index transfer command SCP

Uploading files to a Linux cloud server in the Mac/linux/centos terminal

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.