DUFF(1)
π duff(1) β the duplicate file finder, bestie edition π
okay so. you know how you have like 47 copies of the same screenshot in your Downloads folder and it's giving chaos?? duff is the local legend that finds all those clusters of duplicates for you. it lives in the LOCAL manual, section 1, and it's about to be your new obsession. β¨
πΈ NAME πΈ
duff β duplicate file finder π¦
π«Ά SYNOPSIS π«Ά
duff [-0HLPaeqprtz] [-d function] [-f format] [-l limit] [file ...]
duff [-h]
duff [-v]
π DESCRIPTION π
so basically, duff reports clusters of duplicates in whatever files and/or directories you hand it. in the default mode it prints a customizable header, and then the names of all the files in the cluster. in excess mode it skips the header and instead, for each cluster, prints the names of all but the first of the files it includes.
if you don't give it any files as arguments, duff just reads file names from stdin. lowkey convenient.
π¨ important lore: as of version 0.4, duff ignores symbolic links to files, because that behavior was conceptually broken. so the-H,-Land-Poptions now apply only to directories. periodt.
the following options are available:
β¨ OPTIONS β¨
-0β if it's reading file names from stdin, assume they're null-terminated instead of separated by newlines. also, when printing file names and cluster headers, terminate them with null characters instead of newlines. this is the moment for file names with whitespace or other non-standard characters, bestie β it's giving bulletproof. π-Hβ follow symbolic links listed on the command line. this overrides any previous-Lor-Poption. note that this only applies to directories, because symbolic links to files are never followed.-Lβ follow all symbolic links. this overrides any previous-Hor-Poption. note that this only applies to directories, because symbolic links to files are never followed.-Pβ don't follow any symbolic links. this overrides any previous-Hor-Loption. this is the default. note that this only applies to directories, because symbolic links to files are never followed.-aβ include hidden files and directories when searching recursively. yes bestie, the dotfiles too. π-dfunction β the message digest function to use. the supported functions aresha1,sha256,sha384andsha512. the default issha1. π-eβ excess mode. list all but one file from each cluster of duplicates. also suppresses output of the cluster header. this is the one when you want to automate removal of duplicate files and you genuinely don't care which duplicates get removed. π-fformat β set the format of the cluster header. if the header is set to the empty string, no header line is printed. π
the following escape sequences are available:
%nβ the number of files in the cluster.%cβ a legacy synonym for%d, for compatibility reasons.%dβ the message digest of files in the cluster. this may not be combined with-t, as no digest is calculated.%iβ the one-based index of the file cluster.%sβ the size, in bytes, of a file in the cluster.%%β a%character.
the default format string when using -t is:
%n files in cluster %i (%s bytes)
the default format string for other modes is:
%n files in cluster %i (%s bytes, digest %d)
-hβ display help information and exit. π«Ά-llimit β the minimum size of files to be sampled. if the size of files in a cluster is equal or greater than the specified limit, duff will sample and compare a few bytes from the start of each file before calculating a full digest. this is strictly an optimization and does not affect which files are considered by duff. the default limit is zero bytes, i.e. to use sampling on all files. β¨-qβ quiet mode. suppress warnings and error messages. shhh. π€«-pβ physical mode. make duff consider physical files instead of hard links. if specified, multiple hard links to the same physical file will not be reported as duplicates. π-rβ recursively search into all specified directories. go deep bestie. π¦-tβ thorough mode. distrust digests as a guarantee for equality. in thorough mode, duff compares files byte by byte when their sizes match. no cap, it checks. π₯-vβ display version information and exit. β-zβ do not consider empty files to be equal. this option prevents empty files from being reported as duplicates. π
π EXAMPLES π
the command:
duff -r foo/
lists all duplicate files in the directory foo and its subdirectories. iconic.
the command:
duff -e0 * | xargs -0 rm
removes all duplicate files in the current directory.
π use with care!! note that you have no control over which files in each cluster are selected by -e (excess mode). this is main character energy with consequences.
the command:
find . -name '*.h' -type f | duff
lists all duplicate header files in the current directory and its subdirectories. π
the command:
find . -name '*.h' -type f -print0 | duff -0 | xargs -0 -n1 echo
lists all duplicate header files in the current directory and its subdirectories, correctly handling file names containing whitespace. note the use of xargs and echo to remove the null separators again before listing. the way that pipeline just works. π§
π DIAGNOSTICS π
duff exits 0 on success, and >0 if an error occurs.
π SEE ALSO π
π AUTHORS π
Camilla Berglund <elmindreda@elmindreda.org>
π BUGS π
- duff doesn't check whether the same file has been specified twice on the command line. this will lead it to report files listed multiple times as duplicates when not using
-p(physical mode). note that this problem only affects files, not directories. π« - duff no longer (as of version 0.4) reports symbolic links to files as duplicates, as they're by definition always duplicates. this may break scripts relying on the previous behavior. π
- if the underlying files are modified while duff is running, all bets are off. this is not really a bug, but it can still bite you. π¦
and that's the whole page bestie, slay. this local manual page came to you from Debian, dated January 18, 2012 β yes it's an elder but it's still eating, and duff(1) remains that girl. πβ¨π
π¦ where this page comes from
- debian bookworm: duff 0.5.2-1.1+b2 Β· Zlib
- debian trixie: duff 0.5.2-2 Β· Zlib
- fedora 43: duff 0.5.2-31.fc43 Β· zlib
- fedora 44: duff 0.5.2-32.fc44 Β· zlib
- ubuntu jammy: duff 0.5.2-1.1build1 Β· Zlib
- ubuntu noble: duff 0.5.2-1.1build1 Β· Zlib
- ubuntu questing: duff 0.5.2-2
- ubuntu resolute: duff 0.5.2-2build1 Β· Zlib
- ubuntu stonking: duff 0.5.2-2build1 Β· Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms