Scp command remote and local replication

Source: Internet
Author: User
Tags scp command scp command in linux
Scp commands remotely and locally copy each other. scp provides secure file copy, which is based on ssh logon. For example, to copy the current file to another remote host, you can run the following command. 1scp/home/test/test.txtroot@192.168.1.5:/home/roo... scp command remote and local mutual replication scp is a secure file copy, based on ssh login. For example, to copy the current file to another remote host, you can run the following command. 1scp/home/test/test.txt root@192.168.1.5:/home/root then you will be prompted to enter another host 192.168.1.5 root user login password, and then start copy. If you want to copy files from the remote host to the current system, it is also very easy. Scp root @/full.tar.gz 192.168.1.5:/home/root/full.tar.gz home/test/full.tar.gz scp command in linux can copy files and directories between linux; scp command can copy files between two linux hosts. basic command format: 1scp [optional parameter] file_source file_target copy files from local to remote * copy files: * command format: 1scp local_file remote_username @ remote_ip: remote_folder or 1scp local_file remote_username @ remote_ip: remote_file or 1scp local_file remote_ip: remote_folder or 1scp local_file r Emote_ip: remote_file specifies the username for the first two. after the command is executed, you need to enter the password. The first one only specifies the remote directory, the file name remains unchanged, and the second one specifies the file name; no user name is specified for the 3 and 4 commands. after the command is executed, enter the user name and password. only the remote directory is specified for the 3rd commands. the file name remains the same. The 4th commands specify the file name. * example: 1scp/home/space/music/1.mp3 root@www.test.cn:/home/root/others/music 2scp/home/space/music/1.mp3 root@www.test.cn: /home/root/others/music/001.mp3 3scp/home/space/music/1.mp3 www.test.cn:/home/root/others/music 4scp/home/space/music/1.mp3 www.test.cn: /ho Me/root/others/music/001.mp3 * copy Directory: * command format: 1scp-r local_folder remote_username @ remote_ip: remote_folder or 1scp-r local_folder remote_ip: remote_folder 1st specified user name, after the command is executed, enter the password again; 2nd no specified user name, after the command is executed, enter the user name and password; * Example: 1scp-r/home/space/music/root@www.test.cn: /home/root/others/2scp-r/home/space/music/www.test.cn:/home/root/others/the command above copies the local music directory to the remote others directory, that is, there is a remote connection after the replication .. /others/music/Directory From remote to local from remote to local, you just need to replace the last two parameters that copy from local to remote command; for example: 1scp root@www.test.cn: /home/root/others/music/home/space/music/1.mp3 2scp-r www.test.cn: /home/root/others/home/space/music/The simplest application is as follows: scp local user name @ IP address: file name 1 remote user name @ IP address: file name 2 [local user name @ IP address:] can be left blank. you may need to enter the password corresponding to the remote user name. possible useful parameters:-v is the same as-v in most linux commands to display the progress. it can be used to view connections, authentication, or configuration errors. -C enable compression options. -P: Select the port. note-p already Used by rcp. -4 use the IPV4 address forcibly. -6 use IPV6 addresses forcibly. note: 1. if the remote server firewall has special restrictions, scp will go through the special port, the specific port depends on the situation, the command format is as follows: # scp-p 4588 remote@www.test.com: /usr/local/sin. sh/home/administrator 2. when using scp, pay attention to whether the user has the permission to read the corresponding files on the remote server.
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.