![Forrest logo](/images/logo.png)
fdupes:tldr:a080e
The command "fdupes -rdN ${path-to-directory}" is used for finding and removing duplicate files within a specified directory.
Here's what each part of the command does:
-
fdupes
: This is the command itself.fdupes
is a program designed to detect and list duplicate files. -
-rdN
: These are optional flags or options used withfdupes
. Let's explain each of them:-r
: This flag tellsfdupes
to search for duplicates recursively, checking all subdirectories within the specified directory as well.-d
: This flag tellsfdupes
to prompt the user for each set of duplicates and ask which files should be deleted.-N
: This flag ensures that only the newest version of each duplicated file is kept and the rest are deleted. If this flag is not used, by defaultfdupes
will keep the first version it encounters and delete the rest.
-
${path-to-directory}
: This is the placeholder for the actual path to the directory where you want to search for duplicates. For example, if you want to search for duplicates in the "Documents" directory located in your home folder, you would replace${path-to-directory}
with/home/your-username/Documents/
.
Once you run this command, fdupes
will scan the specified directory and its subdirectories (if -r
flag is used). Any duplicate files found will be displayed, and you will be prompted for which files to keep and which to delete unless you use the -d
flag. Finally, only the newest versions of the duplicated files will be retained in the directory.