There are usually 4 ways to copy files between different Linux
1.ftp
2.samba Service
3.sftp
4.scp
The above three methods, are more cumbersome, here do not repeat. The simplest approach is the SCP, which can be understood as the CP command under the SSH pipeline.
Copy the current file to a remote server:
Scp/home/a.txt Root@192.168.0.8:/home/root
You will then be prompted to enter the root password for 192.168.0.8, and then the replication transfer begins.
Copy the remote host to the current host:
SCP Root@192.168.0.8:/home/b.txt
To copy a folder:
Scp-r root@192.168.0.8:/home//root/home2
Command SCP Introduction
SCP Local username @ip address: filename 1 remote username @ip address: filename 2
[Local username @ip address:] You may need to enter the password for the remote user name without entering it.
Several parameters that may be useful:
-V, as in most Linux commands, is used to show progress. Can be used to view connections, authentication, or configuration errors.
-C enables compression options.
-P Select the port. Note-P has been used by RCP.
-4 forcibly use IPV4 address.
-6 forcibly use IPV6 address.
To copy a single file command:
SCP file Username@ip:filepath
Description
File: filename to copy
Username: User name for remote login,
IP: Remote server IP
FilePath: Remote file path
Copy folder commands as follows (plus a-r argument):
Scp-r file Username@ip:filepath