I want to find files with identical contents, even when their filenames differ. What can I use on Linux?
How can I find duplicate files with different names on Linux?
Asked by
8x!quartzspanner_731
Answers
You can hash the files and group matching checksums. For example, run find /path/to/search -type f -exec sha256sum {} + | sort | uniq -w64 -D. Replace the path with the directory you want to search.
This prints entries whose SHA-256 hashes match, regardless of filename. Check the files before deleting anything. Matching hashes are a strong indication of identical content, though not a mathematical guarantee. Filenames containing newlines or backslashes can also make the output tricky to interpret.
Reply to this answer
Try fdupes if you would rather use a tool made for this job. Point it at the directory you want to check and review the matches it reports before removing any files.
Reply to this answer
Add your answer
Answers are reviewed before publication.
_d53!hexwinder.2:
What does the plus sign after the braces do?