How to find duplicate files in Linux? Help is here with the fdupes command!

User Avatar
👤 admin
🔴 Admin
✍️ The most important thing in the world is to not be alone.
⏳ Last active: 15 Apr 2025 at 16:01
📅 Created: 04 Mar 2021 at 19:00
👀 Viewed: 9 times
✉️ Send Email

Fdupes is a command line tool that allows you to find all duplicate files through the console. The advantage over using graphical tools like fslint is of course the speed. At the end of the day, there is nothing faster and more convenient than the Linux console.

Why should we look for duplicate files in Linux?

No matter what operating system you use sooner or later, your computer will contain many files of different sizes, and if you're not careful enough, repeating them can cost you disk space that you need. For example, you inadvertently downloaded the same ultra HD movie with 40 giga bytes twice.

How to install fdupes on Ubuntu or Debian linux?


sudo apt install fdupes

Or using apt-fast which we prefer :)


sudo apt-fast install fdupes

How to install fdupes on Fedora?


dnf install fdupes

How to install fdupes on CentOS/RHEL?


yum install fdupes

Once installed, you can search for duplicate files using the following command:


fdupes /path/to/folder

Or you can search recursively in which case you will be presented with a progress bar


# fdupes -r /path/to/folder

Progress [34248/65545] 80%

Using the -S option will give you the size of the duplicated files.

Using the -d option will delete permanently the duplicated files!
fdupes -d /path/to/folder
It won't delete anything on it's own, you will be asked for confirmation.

For help you can use the built in help in the command


fdupes -h

Usage: fdupes [options] DIRECTORY...
 -r --recurse       for every directory given follow subdirectories
                    encountered within
 -R --recurse:      for each directory given after this option follow
                    subdirectories encountered within (note the ':' at
                    the end of the option, manpage for more details)
 -s --symlinks      follow symlinks
 -H --hardlinks     normally, when two or more files point to the same
                    disk area they are treated as non-duplicates; this
                    option will change this behavior
 -n --noempty       exclude zero-length files from consideration
 -A --nohidden      exclude hidden files from consideration
 -f --omitfirst     omit the first file in each set of matches
 -1 --sameline      list each set of matches on a single line
 -S --size          show size of duplicate files
 -m --summarize     summarize dupe information
 -q --quiet         hide progress indicator
 -d --delete        prompt user for files to preserve and delete all
                    others; important: under particular circumstances,
                    data may be lost when using this option together
                    with -s or --symlinks, or when specifying a
                    particular directory more than once; refer to the
                    fdupes documentation for additional information
 -N --noprompt      together with --delete, preserve the first file in
                    each set of duplicates and delete the rest without
                    prompting the user
 -v --version       display fdupes version
 -h --help          display this help message

In conclusion, we could say that this modest command is an extremely powerful and fast option to deal with duplicate files on our computer and use the free space on our disk for more useful purposes.

https://youtu.be/S_r8n5Ces4w

If you want to comment: Login or Register