Skip to content

Instantly share code, notes, and snippets.

@hyoshida
Created September 13, 2015 09:50
Show Gist options
  • Save hyoshida/ea59ecef8b64edcf1f01 to your computer and use it in GitHub Desktop.
Save hyoshida/ea59ecef8b64edcf1f01 to your computer and use it in GitHub Desktop.
Shell script one-liner to find duplicate files.
find $* -type f | ([ -x "`which sha1sum 2> /dev/null`" ] && xargs sha1sum || xargs shasum) | awk '{ p[$1] = p[$1] ? p[$1] " = " $2 : $2 } END { for (key in p) { if (p[key] ~ / = /) print p[key] } }'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment