How To Find and Remove Duplicate Files In Linux?
Hi, long time age when I was new comer to the Linux world I was using duplicate file finder named fdupes. But after a time I change my OS to windows and again to Linux. But I stopped using fdupes. Today When I was looking to the file compression of btrfs I found fdupes again and run in my test system. It it very useful tool for untidy persons on the computer. By the way I am not untidy in my computer 🙂 . Lets look to fdupes. Fdupes looks files with their size and MD5 and then byte by byte comparison.
Ubuntu, Debian, Kali, Mint
We will install
fdupes with the following command for Ubuntu, Debian, Kali, Mint.
$ sudo apt install fdupes
Fedora, CentOS, RedHat
yum based installation for
fdupes with the following command.
$ sudo yum install fdupes
Simply Look Duplicate Files
Look current working directory with recursive style where all files folders and subfolders are looked.
$ fdupes -r .
We can see an duplicate example below. Files
Vide and others all the same.
Following Symbolic and Hard Links
By default symbolic and hardlinks do not followed by fdupes. We can enable to follow sym and hard link with the
-H options. This can be useful if there are some link to other paths.
$ fdupes -r -s -H .
Show Size Information of Duplicate Files
Before deleting files we may want to list the size of duplicate files. We can use
-S to list sizes of the duplicate files.
$ fdupes -r -S .
Delete Without Confirmation
And the most useful and dangerous command where duplicate ones are deleted. Use this command in your own risk.
$ fdupes -r -d .