$ find /home/foo -type f -exec cksum {} \;|sort2418082923 2 /home/foo/bla/a.txt2418082923 2 /home/foo/bla2/a.txt2418082923 2 /home/foo/bla3/a.txt2454254050 2 /home/foo/bla/b.txt2454254050 2 /home/foo/bla2/b.txt2454254050 2 /home/foo/bla3/b.txt2475711845 2 /home/foo/bla/c.txt2475711845 2 /home/foo/bla1/c.txt2475711845 2 /home/foo/bla2/c.txt2475711845 2 /home/foo/bla4/c.txt2526747376 2 /home/foo/bla5/d.txt2526747376 2 /home/foo/bla6/d.txt2537797239 2 /home/foo/bla5/e.txt2537797239 2 /home/foo/bla6/e.txt$bla and bla2 and bla3 have more than 1 identical (according to cksum, not the filename) duplicated files in them (a.txt and b.txt), so they will be listed. bla4 only have 1 identical file to other dirs, so it will not be listed. bla5 and bla6 have more than 1 duplicated files in them (d.txt and e.txt), so they will be listed. So the output of the magic should be something like this: $ find /home/foo -type f -exec cksum {} \;|SOMEMAGIC/home/foo/bla//home/foo/bla2//home/foo/bla3/<empty line separates the different duplicate groups>/home/foo/bla5//home/foo/bla6/$ Avoiding to list the directories several times. A Human will erase the unneeded directories later, based on the MAGIC output, that's why this format should be needed. Saving space would be great for anybody. Dirs could have many files, duplicates, that's why it would be a bad idea to only list the duplicated files, since it would be a toooo big list. Dirs, if there are duplicates in them, the contents are probably the same, dir will be deleted later, only leaving 1 dir.
List directories that have more than 1 duplicated files in common
linux;find;deduplication