Forrest logo
back to the fdupes tool

fdupes:tldr:a080e

fdupes: Search recursively and delete duplicates without prompting.
$ fdupes -rdN ${path-to-directory}
try on your machine

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 with fdupes. Let's explain each of them:

    • -r: This flag tells fdupes to search for duplicates recursively, checking all subdirectories within the specified directory as well.
    • -d: This flag tells fdupes 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 default fdupes 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.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the fdupes tool