Find and delete duplicate files/directories in Linux Ubuntu. Install fdupes CLI (Command Line) tool to find and remove duplicate files in Ubuntu 15.04, Ubuntu 14.04 and Derivatives.
fdupes is a powerful CLI tool that can find duplicate files in a given set of directories. In simple words, fdupes is a program for identifying or deleting duplicate files residing within specified directories. It searches the given path for duplicate files. Such files are found by comparing file sizes and MD5 signatures, followed by a byte-by-byte comparison. Fdupes is a Linux utility written by Adrian Lopez in C programming Language.
Install fdupes on Linux Ubuntu Systems
Fdupes CLI Tool can be installed on Ubuntu systems by running the following command:
$ sudo apt-get install fdupes
The same command will also work on Ubuntu Derivatives and on Debian based systems (Linux Mint). To install fdupes on CentOS/RHEL and Fedora systems, replace the “sudo apt-get” with “yum” and “dnf” in the above command. Please note that the default package manager yum is replaced by dnf on Fedora 22 and higher versions.
How To Use Fdupes Command
Once installed, here’s how to use fdupes command on Linux Ubuntu Systems. The best way to learn more about the command in using the man page/help. To get all the information and usage details on fdupes, run the command “fdupes” using ‘-h’ parameter (see below).
$ fdupes -h
Before start using the fdupes CLI tool, please note the following points:
- When using -d or –delete, care should be taken to insure against accidental data loss.
- When used together with options -s or –symlink, a user could accidentally preserve a symlink while deleting the file it points to.
- When specifying a particular directory more than once, all files within that directory will be listed as their own duplicates, leading to data loss should a user preserve a file without its “duplicate” (the file itself).
Below is the usage format of the fdupes command:
The fdupes can be used to search for duplicate files or directories within the folder recursively or in regular way. The fdupes command parameter -d can be used to delete the duplicate files while preserving a copy of ir. Please be cautious while using the command else you may delete vital files and data which is required by the system. THE PROCESS (FIND AND DELETE DUPLICATE FILES/DIRECTORIES) IS UNRECOVERABLE AND CANNOT BE UNDONE OR UNDO.
You can also print the output of ‘fdupes’ command to a text file which can be used to check and decide what files/directories to delete or not.