Mode one: SCP
"Advantages" simple and convenient, safe and reliable; Support speed limit parameters
"Disadvantage" does not support exclude directories
Usage
The SCP is secure copy, which is used for remote file copying. The data transfer uses SSH and uses the same authentication method as SSH, providing the same security guarantee.
SCP [parameters] < source address (user name @ip address or host name) >:< file path > < destination address (user name @IP address or hostname) >:< file path >
Example:
scp/home/work/source.txt [email protected]:/home/work/#把本地的source. txt files are copied to the/home/work directory on the 192.168.0.10 machine
SCP [email protected]:/home/work/source.txt/home/work/#把192. source.txt files on 168.0.10 machine are copied to the local/home/work directory
SCP [email protected]:/home/work/source.txt [Email protected]:/home/work/# Copy the Source.txt file on the 192.168.0.10 machine to the/home/work directory of the 192.168.0.11 machine.
Scp-r/home/work/sourcedir [email protected]:/home/work/#拷贝文件夹, plus-r parameter
Scp-r/home/work/sourcedir [Email protected]:/home/work/#使用主机名
Scp-r-v/home/work/sourcedir [email protected]:/home/work/#显示详情, plus-v parameter
Mode two: rsync
"Advantages" powerful, operation-like SCP, support to exclude directories, support speed limit parameters, also support local replication.
"Disadvantage" no
Usage
Rsync is a data-mirroring Backup tool under Unix-like systems, and--remote sync can be seen from the name of the software. It operates in the same way as the SCP and is much more powerful than the SCP. When using a double colon to split the hostname and file path, the rsync server is used, which is not described here.
Command format:
rsync [parameters] < source address (user name @ip address or host name) >:< file path > < destination address (user name @IP address or hostname) >:< file path >
Example:
rsync/home/work/source.txt [email protected]:/home/work/#把本地的source. txt files are copied to the/home/work directory on the 192.168.0.10 machine
rsync [Email protected]:/home/work/source.txt/home/work/#把192. source.txt files on the 168.0.10 machine are copied to the local/home/work directory
rsync [email protected]:/home/work/source.txt [Email protected]:/home/work/# Copy the Source.txt file on the 192.168.0.10 machine to the/home/work directory of the 192.168.0.11 machine.
Rsync-r/home/work/sourcedir [email protected]:/home/work/#拷贝文件夹, plus-r parameter
Rsync-r/home/work/sourcedir [Email protected]:/home/work/#使用主机名
Rsync-r-v/home/work/sourcedir [email protected]:/home/work/#显示详情, plus-v parameter
Two ways to transfer files between Linux servers