Today we will see how to find and remove file duplicates in Linux Mint. This is a very commonly required task for anyone who stores a bunch of photos, documents and other files in various locations. Over time, several copies of the same file can accumulate because you don't want to change the originals. Here is how you can find and remove duplicate files.
In Linux, there are several ways to find file duplicates. But the most useful tool is fdupes, a console app. Don't be scared with the command line; it is very easy to use this application. In Linux Mint, you can install it from the default repository, no external PPA or software source is required.
To find and remove file duplicates in Linux Mint, do the following.
- Open main menu and go to Administration - Software Manager.
Enter your password to continue with Software Manager.
- In Software Manager, type fdupes in the search box and press the Enter key: Click the fdupes search result and install it.
- Now, go to the folder where you want to find duplicates in. Open Terminal in that folder.
- To find file duplicates, type the command
fdupes -r ./
The -r switch tells the app to go through subdirectories. The ./ portion makes the app find duplicates in the current folder.
So, the whole command means "find file duplicates in the current directory and its subdirectories".
In the output, you will see all file duplicates:
- To find and delete file duplicates, type the following command:
fdupes -r -d ./
For each set of file duplicates, the app shows a list of files and asks which file to keep.
Fdupes is a reliable and easy to use application which allows you to keep your files organized and recovers valuable drive space. It supports a number of other options which you can find in its manual page. In the terminal app, you can type the command man fdupes to learn about them.
These are worth mentioning:
-S --size - use this switch to print out the size of duplicate files.
-s --symlinks - follow symlinked directories
-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.
-m --summarize - summarize duplicate file information.