An order to explain
Name: CP
Usage rights: All users
How to use:
CP [Options] Source Dest
CP [options] source ... directory
Command parameters:
-A as far as possible file status, permissions and other information are reproduced as original.
-R If the source contains a directory name, the files under the directory are also copied to the destination.
-F If a destination already has a file with the same file name, it should be deleted before copying.
====================================================================
Name: SCP
How to use:
SCP [parameter] [original path] [Target path]
SCP Local username @IP address: File name 1 remote user name @IP address: file name 2
Command parameters:
-1 Mandatory SCP command using protocol SSH1
-2 Mandatory SCP command using protocol SSH2
-4 Force SCP command to use only IPV4 addressing
-6 Force SCP command to use only IPV6 addressing
-B Use Batch mode (transfer password or phrase is not asked during transfer)
-C allows compression. (Pass the-c flag to SSH to turn on the compression function)
-P retains the original file's modification time, access time, and access rights.
-Q does not display the transfer progress bar.
-R recursively replicates the entire directory.
-V verbose displays the output. SCP and SSH (1) will display 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.
-F ssh_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.
The-L limit limits the bandwidth that the user can use, in kbit/s.
-O ssh_option If you are accustomed to using the parameter passing method in Ssh_config (5),
-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).
Two application examples
1. Copy from the local server to the remote server:
(1) Copying files:
Command format:
SCP Local_file [Email Protected]_ip:remote_folder
Or
SCP Local_file [Email protected]_ip:remote_file
Or
SCP Local_file Remote_ip:remote_folder
Or
SCP Local_file Remote_ip:remote_file
1th, 2 Specify the user name, the command executes after the user password is entered, the 1th only specifies the remote directory, the file name is unchanged, 2nd specified the file name
3rd, 4 does not specify a user name, the command executes after entering the user name and password, the 3rd only specifies the remote directory, the file name is not changed, 4th specified the file name
(2) Copy directory:
Command format:
Scp-r Local_folder [Email protected]_ip:remote_folder
Or
Scp-r Local_folder Remote_ip:remote_folder
The 1th one specifies the user name, the command executes after the need to enter the user password;
The 2nd does not specify a user name, and a user name and password are required after the command executes
2. Copy from the remote server to the local server:
Example 1: Copying files from a distance to a local directory
Command:
SCP [Email protected]:/opt/soft/nginx-0.5.38.tar.gz/opt/soft/
Example 2: Copying from a distance to a local
Command:
scp-r [Email protected]:/opt/soft/mongodb/opt/soft/
Example 3: Uploading a local file to a remote machine specified directory
Command:
scp/opt/soft/nginx-0.5.38.tar.gz [Email protected]:/opt/soft/scptest
Example 4: Uploading a local directory to a remote machine-specified directory
Command:
Scp-r/opt/soft/mongodb [Email protected]:/opt/soft/scptest
Linux command-cp/scp {copy}