5 Best Tools to Find and Remove Duplicate Files in Linux Marin Todorov Last Updated: July 14, 2023 Categories Linux Commands 34 Comments Organizing your home directory or even system can be particularly hard if you have the habit of downloading all kinds of stuff from the internet using your download managers . Often you may find you have downloaded the same mp3, pdf, and epub (and all kinds of other file extensions ) and copied it to different directories . This may cause your directories to become cluttered with all kinds of useless duplicated stuff. In this tutorial, you are going to learn how to find and delete duplicate files in Linux using rdfind , fdupes, and rmlint command-line tools, as well as using GUI tools called DupeGuru and FSlint . A note of caution – always be careful what you delete on your system as this may lead to unwanted data loss. If you are using a new tool, first try it in a test directory where deleting files will not be a problem. 1. Rdfind – Find Duplicate Files in Linux Rdfind comes from redundant data find, which is a free command-line tool used to find duplicate files across or within multiple directories. It recursively scans directories and identifies files that have identical content, allowing you to take appropriate actions such as deleting or moving the duplicates. Rdfind uses an algorithm to classify the files and detects which of the duplicates is the original file and considers the rest as duplicates. The rules of ranking are: If A was found while scanning an input argument earlier than B , A is higher ranked. If A was found at a depth lower than B , A is higher ranked. If A was found earlier than B , A is higher ranked. The last rule is used particularly when two files are found in the same directory. Install Rdfind on Linux To install rdfind in Linux, use the following command as per your Linux distribution. $ sudo apt install rdfind [On Debian, Ubuntu and Mint ] $ sudo yum install rdfind [On RHEL/CentOS/Fedora and Rocky/AlmaLinux ] $ sudo emerge -a sys-apps/rdfind [On Gentoo Linux ] $ sudo apk add rdfind [On Alpine Linux ] $ sudo pacman -S rdfind [On Arch Linux ] $ sudo zypper install rdfind [On OpenSUSE ] To run rdfind on a directory simply type rdfind and the target directory. $ rdfind /home/user Find Duplicate Files in Linux As you can see rdfind will save the results in a file called results.txt located in the same directory from where you ran the program. The file contains all the duplicate files that rdfind has found. You can review the file and remove the duplicate files manually if you want to. Another thing you can do is to use the -dryrun an option that will provide a list of duplicates without taking any actions: $ rdfind -dryrun true /home/user When you find the duplicates, you can choose to replace them with hard links. $ rdfind -makehardlinks true /home/user And if you wish to delete the duplicates you can run. $ rdfind -deleteduplicates true /home/user To check other useful options of rdfind you can use the rdfind manual. $ man rdfind 2. Fdupes – Scan for Duplicate Files in Linux Fdupes is another command-line program that allows you to identify duplicate files on your system. It searches directories recursively, comparing file sizes and content to identify duplicates. It uses the following methods to determine duplicate files: Comparing partial md5sum signatures Comparing full md5sum signatures byte-by-byte comparison verification Just like rdfind, it has similar options: Search recursively Exclude empty files Shows the size of duplicate files Delete duplicates immediately Exclude files with a different owner Install Fdupes in Linux To install fdupes in Linux, use the following command as per your Linux distribution. $ sudo apt install fdupes [On Debian, Ubuntu and Mint ] $ sudo yum install fdupes [On RHEL/CentOS/Fedora and Rocky/AlmaLinux ] $ sudo emerge -a sys-apps/fdupes [On Gentoo Linux ] $ sudo apk add fdupes [On Alpine Linux ] $ sudo pacman -S fdupes [On Arch Linux ] $ sudo zypper install fdupes [On OpenSUSE ] Fdupes syntax is similar to rdfind . Simply type the command followed by the directory you wish to scan. $ fdupes