linux 比较两个文件夹不同 (diff命令, md5列表)
2017-03-03 08:14
911 查看
比较文件夹diff,可以直接使用diff命令
[root@~]# diff -urNa dir1 dir2
-a Treat all files as text and compare them 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压缩会带上文件的时间
[root@~]# diff -urNa dir1 dir2
-a Treat all files as text and compare them 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列表)
- linux下的comm和diff命令:用来比较两个文件的不同之处
- linux 下使用diff命令比较两个文件夹
- bzdiff命令_Linux bzdiff 命令用法详解:直接比较两个.bz2压缩包中文件的不同
- linux下的comm和diff命令:用来比较两个文件的不同之处
- diff命令_Linux diff 命令用法详解:比较给定的两个文件的不同
- diff命令比较两个文件的不同
- Linux diff --比较两个文件并输出不同之处
- diff命令比较两个文件的不同
- linux 比较文件相同部分comm命令和不同部分diff命令
- Linux diff比较两个文件并输出不同之处
- 两个实用的强大linux命令介绍——vim比较, tar备份权限
- 使用diff比较两个文件夹
- 在linux下面比较两个文件及打补丁整理 <diff> - <patch>
- 使用diff比较两个文件夹
- 在linux下,如何比较两个目录下的文件(目录比较命令)
- 使用diff比较两个文件夹
- linux diff与comm命令比较文件(找出新增内容)
- Linux使用diff命令比较文件找出文件之间相同的部分
- linux下比较两个文本文件的不同——diff命令