How to Find and Delete Duplicate Files in Ubuntu Using Fdupes

It’s quite common to end up with many copies of the same file on your computer while working with huge volumes of media and documents.

Eventually, you’ll end up with a mess of files and an additional storage shortage due to duplicate files, prompting you to run a duplicate file check on your system.

Checking for duplicate files manually is not an option for obvious reasons. You can use various programs to discover and delete duplicate files to accomplish this.

In this article, you will learn to manage your duplicate files with fdupes, which is a Linux software that not only detects duplicates but also gives you multiple options to deal with them.


  • A Linux-based system
  • Terminal access
  • A user account with sudo privileges.

Note: The commands in this tutorial are executed on the Ubuntu 22.04 system. All the instructions in the tutorial are valid for any Linux-based system.

Install Fdupes in Ubuntu

The fdupes installation package comes with all major Linux distributions. To install fdupes in Ubuntu, run the following apt command.

sudo apt install fdupes
sudo apt install fdupes

Install fdupes in Ubuntu

Find Duplicate Files With Fdupes

Once the installation is finished, you can use fdupes to identify duplicate files. To find duplicate files, run the following command with your directory path.

fdupes <directory path>

Find duplicate files

You can see the duplicate files presented in the output.

Search for Duplicate Files in Subfolders With Fdupes

The above command only finds duplicate files within the current folder. It does not look through the subfolders and such. To find duplicates throughout the folder and subfolders, you need to run the fdupes command with the -r option.

fdupes -r <directory path>

Find duplicates files recursively

You can see from the output that the “-r” option does a more thorough search for duplicates in the folders and subfolders.

Search for Non-Empty Duplicate Files With Fdupes

You can also search for non-empty duplicate files. This will help you focus on the task, and you will not have to deal with empty files. To use this option, use the following command.

fdupes -n <directory path>

Show only non-empty duplicate files

Get Information About Duplicate Files With Fdupes

Run the fdupes command with the -m option to get more information on the set of duplicate files.

fdupes -m <directory path>

Get number and used space of duplicate files

You can also run the fdupes command with the -S option to get size information about the duplicate files.

fdupes -S <directory path>

Get file sizes

Run the following command to save the fdupes command’s outputs.

fdupes <directory path> > output.txt

Store fdupes output in a file

Delete Duplicate Files With Fdupes

Once you have narrowed down the duplicates in the directory, you can delete the duplicates by running the fdupes command with the -d option.

fdupes -d <directory path>

Automatically delete duplicate files

You will be prompted to preserve versions out of the duplicate files list. Simply enter the file number mentioned in the list to preserve the file.

Advanced Options in Fdupes Command

You can run the fdupes commands with multiple options to avail of the offered benefits. Such as, you can find all the non-empty files in the folders and subfolders with the following command.

fdupes -n -r <directory path>

Find all non-empty files

Or get overall information about all the duplicate files within the folders and subfolders.

fdupes -m -r <directory path>

Get overall infor on duplicate files using fdupes


File organization is a time-consuming process in and of itself. When you factor in the time and work it takes to organize your disorganized storage, you look at a few hours of wasted time and effort.

However, owing to applications like fdupes, identifying duplicate files and deleting them has never been easier or more efficient. The instructions in this article will provide you with multiple options on how to treat your duplicate files.