Article Title: Copy two linux Files. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Scp is secure copy, which is used to copy remote files. data transmission uses ssh1 and uses the same authentication method as ssh1 to provide the same security guarantee. unlike rcp, scp requires you to enter the password if necessary.
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:] You can enter the password corresponding to the remote user name.
Several useful parameters:
-V is the same as-v in most linux commands. It is used to display the progress. It can be used to view the connection, authentication, or configuration error.
-C enable compression options.
-P: select the port. Note that-p has been used by rcp.
-4 Use the IPV4 address forcibly.
-6 Use IPV6 addresses forcibly.
Command for copying a single file:
Scp file username @ ip: filepath
Note:
File: the name of the file to be copied.
Username: the user name for remote logon,
Ip: Remote Server ip Address
Filepath: Remote File Path
Run the following command to copy a folder (add the-r parameter ):
Scp-r file username @ ip: filepath
There are three common methods to copy files between Linux:
The first is to install the ftp Server in one of the Linux systems, so that you can copy the file in another client program using ftp.
The second method is to use the samba service, similar to the Windows file copy method, which is simple and convenient.
The third is to use the scp command to copy files.
Scp is a file copy with Security and is used for ssh logon. For example, to copy the current file to another remote host, you can run the following command.
Scp/home/1.gif root@172.19.2.75:/home/root
Then you will be prompted to enter the login password of the root user of the other 172.19.2.75 host, and then start cp and ungzip.
If you want to copy files from the remote host to the current system, it is also very easy:
Scp root@172.19.2.75:/home/abc.gif/home/root
The format of the copied folder is
Scp-r root@192.168.1.1:/home // local directory