iis服务器助手广告广告
返回顶部
首页 > 资讯 > 操作系统 >linux 比较两个文件夹diff不同 (diff命令, md5列表)
  • 279
分享到

linux 比较两个文件夹diff不同 (diff命令, md5列表)

linuxdiff文件夹linuxdiffmd5linuxdiff比较文件夹 2022-06-04 22:06:47 279人浏览 薄情痞子
摘要

比较文件夹diff,可以直接使用diff命令 [root@~]# diff -urNa dir1 dir2   -a Treat all files as text and compare tOxCVthem line

比较文件夹diff,可以直接使用diff命令

[root@~]# diff -urNa dir1 dir2
  -a Treat all files as text and compare tOxCVthem line-by-line, even if they do not seem to be text.
  -N, --new-file
    In directory comparison, if a file is found in only one directory, treat it as present but empty in the other directory.
  -r When comparing directories, recursively compare any subdirectories found.
  -u Use the unified output fORMat.

比较文件夹diff,也可以比较文件MD5列表。下面命令可以获取文件夹中文件md5列表


find /home/ -type f -not \( -name '.*' \) -exec md5sum {} \;

说明:

          (1) /home/文件目录

     (2) -type f 文件类型为普通文件

     (3) -not \( -name '.*' \)  过滤掉隐藏文件。可以过滤掉不需要考虑的文件

         (4) -exec md5sum {} \;  对每个文件执行md5sum命令

 用tar命令压缩后,比较文件的MD5是不行的。tar压缩会带上文件的时间

总结

以上所述是小编给大家介绍的linux 比较两个文件夹diff不同 (diff命令, md5列表),希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对我们网站的支持!

--结束END--

本文标题: linux 比较两个文件夹diff不同 (diff命令, md5列表)

本文链接: https://www.lsjlt.com/news/19571.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作