linux - 在Linux上同步2个文件

标签 linux rsync

我在 2 台 Linux 服务器上有 2 组文件,我想让它们保持同步。 rsync 是最好的工具吗?如果两个文件具有相同的名称,我将想要同步到具有最新修改时间的文件。这可能吗?

最佳答案

以下命令应将两个文件同步到最新版本:

rsync -u file1 file2; rsync -u file2 file1

在对重要文件尝试命令或进行备份之前,最好先在一些临时文件上进行测试。

关于linux - 在Linux上同步2个文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25839019/

相关文章:

macos - 终端命令中的自动应答 "y"

linux - 仅在从节点 Jenkins 中保存构建数据

linux - 如何将 valgrind 用于内存配置文件

Linux 查看日志文件,每次重新创建

linux - $(pwd) - 上一级

linux - 列出目录 1 中但不在目录 2 中的文件,反之亦然?

linux - 使用 rsync 保持两台服务器同步

git - rsync-filter 可提交到 git

google-cloud-platform - gsutil rsync 'ascii' 编解码器无法解码位置 51 中的字节 0xe2 : ordinal not in range(128)

arrays - 具有双for循环的bash脚本可以访问数组名称