Linux SCP Command Detailed

Source: Internet
Author: User
Tags file copy ftp client scp command

1. Order: SCP
There are 3 common ways to copy files between different Linux:
The first is FTP, which is one of the Linux installation FTP Server, so you can use an FTP client program to copy files.
The second method is to use Samba services, similar to the Windows file copy method to operate, relatively simple and convenient.
The third is the use of SCP commands for file replication.

2. Command format: SCP [parameter] [original path] [Target path]

3. Command parameters:

-1Enforce SCP command using protocol SSH1-2Enforce SCP command using protocol SSH2-4Force SCP command to use only IPV4 addressing-6Force SCP command to use only IPV6 addressing-B use batch mode (transfer password or phrase is not asked during transfer)-C allows compression. WillC flag passed to SSH, thus turning on the compression function)-p Keep the original file modification time, access time and access rights. -Q does not display the transfer progress bar. -R recursively copies the entire directory. -V verbose displays the output. SCP and SSH (1) displays debugging information for the entire process.   This information is used to debug connections, authentication, and configuration issues. -C cipher Encrypts the data transfer with cipher, and this option is passed directly to SSH. - Fssh_config Specifies an alternative SSH configuration file that is passed directly to SSH. -I identity_file the key file used to read the transfer from the specified file, and this parameter is passed directly to SSH. -L limit limits the bandwidth that users can use to kbit/S is the unit. -O ssh_option If you are accustomed to using Ssh_config (5), and the method of parameter passing in the-P Port Note is uppercase P, port is the port number specified for data transfer-S program specifies the programs that are used to encrypt the transmission. This program must be able to understand the options for SSH (1).

4. Example

Copy the Hadoop folder from the current Linux to hadoop-nn-02:

Scp-p 6000-r/home/hadoopuser/hadoop [email protected]:/home/hadoopuser

The-p 6000 indicates that the SSH login port is 6000, and the default 22 port can be omitted.

-R means recursive replication

Note: From remote copy to local, only two parameters can be swapped after SCP.

5. SCP password-free copy expect script

# !/usr/bin/expect-fSet password 123456spawn scp root@192.168.0.10:/root/a.wmv/home/hadoop/   "[email protected] ' s password:" $password \ r "   "exit\r" expect EOF

Linux SCP Command Detailed

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.