Tag: Linux server file synchronization

1 Posts

Linux server file synchronization command Rsync
CP and SCP are two commands commonly used for file copying in Ubuntu. Generally, we use the CP command on the same server, and we have used the SCP command across services. However, Rsync is better than the above two commands for file synchronization, both across servers and not across servers. Because Rsync can only synchronize the files that need to be updated, instead of copying all the files in the specified path and then overwriting the source files in the target path. For example, the local /mnt/tem folder should be connected to the remote xx. xx. The /mnt/tem path of 123 can be synchronized using the following: rsync -avu --progress /www/wwwroot/cdn.gouuuu.com [email protected]:/www/wwwroot/cdn.mateing.xyz -V detailed output -A archiving mode means that files are transferred recursively and all file attributes are maintained. If the file attributes change, it is considered to be a different file -U option ignore duplicate data Current host option displays the transfer details process transfer file or folder path target host user name @ target host IP address planned transfer file storage path test-rsync-command 中文版 Linux 服务器文件同步命令 rsync: cp和scp是ubuntu中文件拷贝常用的两个命令,一般在同一台服务器上我们是用cp命令,跨服务时使用过scp命令,但是如果做文件同步的话,rsync要比上述两个命令更好用一些,跨不跨服务器都是如此。因为rsync可以只同步需要更新的文件,而不是将所有的指定路径内的文件都拷贝一份,然后再目标路径下去覆盖源文件,比如本地的/mnt/tem文件夹要和远程xx.xx.xx.123的/mnt/tem路径做同步,可以使用: rsync -avu --progress /www/wwwroot/cdn.gouuuu.com [email protected]:/www/wwwroot/cdn.mateing.xyz -v 详细输出 -a 归档模式,表示以递归方式传输文件,并保持所有文件属性,如果文件属性变了,认为是不同文件 -u 选项忽略重复的数据 当前主机 选项 显示传输细节进程 传输的文件或文件夹路径 目标主机用户名@目标主机IP地址计划传输的文件存储路径