CCCPaste

Find and Remove Duplicate Files with BASH

# find all duplicate files
find . ! -empty -type f -exec md5sum {} + | sort | uniq -w32 -dD

# list only first match in duplicates
find . ! -empty -type f -exec md5sum {} + | sort | uniq -w32 -d

# list only the filename of first match
find . ! -empty -type f -exec md5sum {} + | sort | uniq -w32 -d|cut -c 35-

#---- using fdupes
# List Duplicates
fdupes -r .

# -f Omit the first file in each set of matches 
fdupes -r -f .  

# list and select Duplicates
fdupes -r -d .

# auto delete, be careful with this
fdupes -r -f . | grep -v '^$' | xargs -I {} rm -v "{}"

fdupes -r -f . | grep -v '^$' |while read file;do rm -v "$file";done