Detailed explanation of scp commands in linux

Source: Internet
Author: User
Scp copies files between different hosts on the network. it uses the ssh security protocol to transmit data and has the same authentication mechanism as ssh, so as to ensure secure remote copy of files. scp command usage: scp copies files between different hosts on the network. it uses the ssh security protocol to transmit data and has the same authentication mechanism as ssh, thus securely copying files remotely. ######################################## ######### Scp command parameter description: -1 force scp command use protocol ssh1-2 force scp command use protocol ssh2-4 force scp command use only IPv4 addressing-6 force scp command use only IPv6 addressing-B use batch mode (during transmission do not ask for the transmission password or phrase) -C allows compression. (Pass the-C flag to ssh to enable the compression function)-p retains the modification time, access time, and access permission of the original file. -Q: The transmission progress bar is not displayed. -R recursively copies the entire directory. -V details display output. Scp and ssh (1) will display the debugging information of the entire process. This information is used to debug connections, verify and configure problems. -C cipher encrypts data transmission with cipher. this option is passed directly to ssh. -F ssh_config specifies an alternative ssh configuration file, which is passed directly to ssh. -I identity_file: read the key file used for transmission from the specified file. this parameter is directly transmitted to ssh. -L limit: limits the bandwidth that a user can use, in Kbit/s. -O ssh_option if you are used to using the parameter transfer method in ssh_config (5),-P port should be written in uppercase, port is the port number used for data transmission-S program specifies the program used for encrypted transmission. This program must be able to understand the options of ssh (1. ######################################## ######### Application of the scp command: ========================================================== === 1> Copy from local server to remote server (1) copy a file: command format: scp local_file remote_username @ remote_ip: allow or scp local_file reply @ remote_ip: remote_file or scp local_file remote_ip: allow or scp local_file remote_ip: remote_file the user name is 1 or, after the command is executed, enter the user password. only the remote directory is specified for the 1st files, and the file name remains unchanged. the user name and Password, 3rd only specifies a remote directory, the file name remains the same, 4th specify the file name instance: scp/home/linux/soft/scp.zip root@www.mydomain.com: /home/linux/others/softscp/home/linux/soft/scp.zip root@www.mydomain.com:/home/linux/others/soft/scp2.zipscp/home/linux/soft/scp.zip www.mydomain.com: /home/linux/others/softscp/home/linux/soft/scp.zip www.mydomain.com:/home/linux/others/soft/scp2.zip (2) copy Directory: command format: scp-r local_folder remote_username @ remote_ip: r Emote_folder or scp-r local_folder remote_ip: remote_folder 1st specifies the user name. after the command is executed, enter the user password. for example: scp-r/home/linux/soft/root@www.mydomain.com:/home/linux/others/scp-r/home/linux/soft/www.mydomain.com: the command above/home/linux/others/copies the local soft directory to the remote others Directory, that is, the remote server will have the/home/linux/others/soft/directory. ========================================================== === 2> The scp command remotely replicated from the remote server to the local server is the same as the command above, you just need to swap the order of the two parameters after the command is copied from the local device to the remote device. For example, scp root@www.mydomain.com:/home/linux/soft/scp.zip/home/linux/others/scp.zip scp www.mydomain.com: in the/home/linux/soft/-r/home/linux/others/linux system, many parameters in the scp command are related to ssh1. you also need to see more original parameter information, run man scp to see more detailed English descriptions.
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.