Find duplicate files by SHA-256 content hash
Build a paste-ready command, then review its compatibility and effects before running it.
find <path> -type f -print0 | xargs -0 sha256sum | sort | uniq -w64 -dDComplete required fields to copy the generated command.
read-onlyno known side effects Compatibility
LinuxUses GNU sha256sum, GNU xargs, and null-delimited filenames. On macOS install coreutils or use shasum with a compatible pipeline.
Operational knowledgereview due 2027-01-19
Requirementsfindfind must be installed and available on PATH.
Version supportfind Current supported releasesVerified for linux using bash, zsh syntax; consult compatibility notes for platform-specific differences.
Expected signals8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92 ./photos/copy.jpgRepresentative successful output; values vary with the selected target and system state.
Known errorsfind: command not foundfind is missing or is not available on PATH.
Verifyfind {{path}} -type f -print0 | xargs -0 sha256sum | sort | uniq -w64 -dDThe output matches the expected target and exits without an error.Rollback noteNot required: this command is read-only and does not change system state.
Command breakdown
01findCommandRuns the find stage of this one-liner.
02<path>ParameterA value supplied in the Fill parameters section.
03-typeOptionConfigures find with the -type option.
04fArgumentPasses f to find.
05-print0OptionConfigures find with the -print0 option.
06|PipelinePasses the output on the left to the command on the right.
07xargsCommandRuns the xargs stage of this one-liner.
08-0OptionConfigures xargs with the -0 option.
09sha256sumArgumentPasses sha256sum to xargs.
10|PipelinePasses the output on the left to the command on the right.
11sortCommandRuns the sort stage of this one-liner.
12|PipelinePasses the output on the left to the command on the right.
13uniqCommandRuns the uniq stage of this one-liner.
14-w64OptionConfigures uniq with the -w64 option.
15-dDOptionConfigures uniq with the -dD option.
This advanced community-curated one-liner combines several stages. Review every option and placeholder before running it.
Example input
find ./photos -type f -print0 | xargs -0 sha256sum | sort | uniq -w64 -dD
Example output
8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92 ./photos/copy.jpg
8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92 ./photos/original.jpg
Illustrative output — exact values vary by system and data.
Official sources