diff用于比较文本文件,二进制文件请用cmp、fdupes等命令

据说最新版本的diff支持比较二进制文件了,没试过

比较2个文件夹,并将相同的文件找出来

diff -srq dir1/ dir2/ | grep identical

srq参数含义

-s  --report-identical-files  Report when two files are the same.
-r  --recursive  Recursively compare any subdirectories found.
-q  --brief  Output only whether files differ.