How To Find and Remove Duplicate Files In Linux? – POFTUT

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.

Install fdupes

Ubuntu, Debian, Kali, Mint

We will install fdupes with the following command for Ubuntu, Debian, Kali, Mint.

$ sudo apt install fdupes
Install fdupes
Install fdupes

Fedora, CentOS, RedHat

For 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 .
Simply Look Duplicate Files
Simply Look Duplicate Files

We can see an duplicate example below. Files pass , Vide   and others all the same.

Simply Look Duplicate Files
Simply Look Duplicate Files

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 -s and -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 .
Show Size Information of Duplicate Files
Show Size Information of Duplicate Files

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 .

 

LEARN MORE  How To Get File System Disk Usage In Linux?

How To Find and Remove Duplicate Files In Linux? Infographic

How To Find and Remove Duplicate Files In Linux? Infographic
How To Find and Remove Duplicate Files In Linux? Infographic

 

Leave a Comment