Scp command syntax for Linux

Source: Internet
Author: User
Tags scp command secure copy

Scp command syntax in Linux Secure Copy is used to Copy remote files. Data Transmission uses ssh and uses the same authentication method as ssh, provides the same security assurance. This is a very convenient and useful command. The file is directly transferred between two servers, and it is completely solved by using only one scp command. Scp requires you to enter the other party's password or password when verification is required. Copy basic command syntax from local to remote: scp [optional parameter] Local User Name @ IP Address: local path remote user name @ IP Address: remote path from remote to local: scp [optional parameter] remote user name @ IP Address: remote path Local User Name @ IP Address: local path [local user name @ IP Address:] This item can be left blank. If you do not enter the [remote user name @], the user is required to enter it after the command is executed. After the command is executed, you may need to enter the password of the remote user. Generally, you need to enter a password for the first transmission. After the system is restarted, the password is considered as the first transmission. Optional parameter:-v is the same as-v in most linux commands. It is used to display specific information during command execution, and can be used to view connection, authentication, or configuration errors. -C: Enable the compression option. -P: select the port. Note that-p is already used by rcp. -4 Use the IPV4 address forcibly. -6 Use IPV6 addresses forcibly. -R is used to send subdirectories and subfiles recursively. Copy the scp local_file remote_username @ remote_ip: Using local_file remote_ip: remote_file 1st: 1st specify the remote directory name, that is, copy the local file to the remote directory without changing the file name; 2nd specify the remote file name, that is, copy the local file and rename it to a remote file. 3rd and 4 do not specify the user name. After the command is executed, enter the User name: 3rd specify the remote directory name, as shown in the preceding figure; 3rd specify the remote file name, as shown in the preceding figure. Example scp/home/dir/1.mp3 root@192.168.1.110:/home/root/otheremd/home/dir/1.mp3 root@192.168.1.110: /home/root/others/001.mp3 scp/home/dir/1.mp3 192.168.1.110:/home/root/otheremd/home/dir/1.mp3 192.168.1.110: /home/root/others/001.mp3 copy Directory: scp-r local_folder remote_username @ remote_ip: remote_folderscp-r local_folder remote_ip: remote_folder 1st user names specified: recursively copy the local directory to the remote directory. If there are no 2nd user names specified, enter the user name after executing the command: recursively copy the local directory to the remote directory. Example scp-r/home/dir root@192.168.1.110:/home/root/others/scp-r/home/dir 192.168.1.110: /home/root/others/from remote to local, you only need to change the local and remote information in the command "copy from local to remote. Sample scp root@192.168.1.110:/home/root/others/homescp-r 192.168.1.110:/home/root/others/home

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.