Find and Replace Duplicate Files in Ubuntu 18.04 LTS

Find and remove duplicate files on Ubuntu

Sometimes our systems are loaded with the same files residing in different locations, eating up our memory resources. There are instances when we download a file to a location and then re-download and save it to some other location. We often forget that many files with the same name might be existing on our system without us knowing the exact location. If you are using your system for a while, these duplicate files may take a lot of space and create a large clutter. When we want to clear the clutter, it is a very burdensome task to manually look up for duplicate files and then delete them. However, Ubuntu supports many open-source applications that you can use to locate and delete any such files.

In this article, we will introduce you to two such applications named FSlint and fdupes that let you locate and delete redundant files from your system. We are running the commands and steps described in this article on an Ubuntu 18.04 LTS (Bionic Beaver) system.

FSlint – a GUI and Terminal based solution

In order to install FSlint, open your Ubuntu Terminal through the Dash or by pressing Ctrl+Alt+T and enter the following command:

$ sudo apt install fslint

Install fslint

Enter y when prompted with a y/n option in order to continue installation. Once the installation is complete, you can access both the FSlint Janitor graphical application and FSlint command line utility.

FSLint Janitor

In your Ubuntu Dash, enter fslint in order to access the graphical application FSlint Janitor that helps you get rid of not only duplicate files, but also empty directories, files with incorrect names, and temporary files etc.

search for fslint application

The Duplicates option in the left panel is selected by default. All you need to do is specify a path and click the Find button.

Find duplicate files with fslint on Ubuntu

You can then choose to select and delete the files you want to get rid of.

FSlint Command Line

In order to access the command line utility FSlint, move to the directory where it is located by entering the following command in your Ubuntu Terminal.

$ cd /usr/share/fslint/fslint

Once you are in the fslint directory, you can run the utility using the following syntax:

$ ./fslint /[directorylocation]


$ ./fslint /home/[name]

Replace [name] with your Ubuntu username in the above example..

Search for duplicate files on the shell

You can then delete the unwanted files on your own. It is best to run this utility as a root user so that you can access all the files without facing authorization issues.

Fdupes – a Terminal-based solution

Unlike FSlint that can be operated both graphically and through the command line, Fdupes is a powerful yet only a simple Terminal based utility. It lists all the redundant file and lets you delete the ones you want to. Run the following command in order to list all the redundant files:

$ fdupes [directorylocation]

If you get the following message after running this command, you need to install the utility first through this command:

$ sudo apt install fdupes

Install fdupes

This is how you can check a directory for redundant files:

Use fdupes to scan a directory for duplicate files

You can then delete the redundant files on your own.

You can also make use of various switches along with this command in order to ease your search and deletion. For example, using the -d switch will give you an option to delete duplicate files and preserve the one you want to keep.

Delete duplicates files with fdupes

Running this utility as a root user is preferable in order to avoid authorization issues. If you want to list duplicate files from the sub-directories as well, you can use the -r switch as follows:

Recursive search for duplicate files

This is how the two utilities FSlint and fdupes let you clear the clutter on your system to make space for more important data, by getting rid of all the duplicate files residing on your system.