SSH transfer file command in Linux system

Source: Internet
Author: User
Tags ssh

1, download files from the server
SCP username@servername:/path/filename/var/www/local_dir (local directory)

For example, the SCP root@192.168.0.101:/var/www/test.txt downloads/var/www/test.txt files on 192.168.0.101 to/var/www/local_dir (local directory)

2, upload local files to the server
Scp/path/filename Username@servername:/path

For example, scp/var/www/test.php root@192.168.0.101:/var/www/upload test.php files from the native/var/www/directory to 192.168.0.101 on this server In the Directory

3, download the entire directory from the server
Scp-r username@servername:/var/www/remote_dir/(remote directory)/var/www/local_dir (local directory)

For example: Scp-r root@192.168.0.101:/var/www/test/var/www/

4, upload directory to the server
Scp-r Local_dir Username@servername:remote_dir
For example: Scp-r test root@192.168.0.101:/var/www/uploads the test directory in the current directory to the server's/var/www/directory

Note: The target server will open write permission.

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.