Useful Tools To Find And Delete Duplicate Files In Linux

Useful Tools To Find And Delete Duplicate Files In Linux

Insight: Useful Tools to Find and Delete Duplicate Files in Linux

Let’s have a quick look into the list of best and useful tools to find and delete duplicate files in Linux based operating system.

Useful Tools To Find And Delete Duplicate Files In Linux

1. Fdupes – Scan for Duplicate Files in Linux

We can use Fdupes tool in Linux to find and delete duplicate files. It is free and open source tool to search duplicate files in Linux based operating systems.

Install fdupes on a Linux

Run the following commands to install fdupes on Linux based operating systems.

For Ubuntu/Debian:

sudo apt-get install fdupes

For Fedora

yum install fdupes
dnf install fdupes    [On Fedora 22+]

Now, run the following command to search the file in specific directory.

sudo fdupes <directory name>

To search files recursively.

sudo fdupes -r <directory name>

To delete all duplicates use the -d option like this. You need to carefully follow the on screen instructions.

sudo fdupes -d <directory name>

To search in multiple directories.

sudo fdupes <directory1>  <directory2>

To calculate the size of the duplicate files.

sudo fdupes -S <dir>

2. Rdfind

Rdfind is another tool to search duplicate files in Linux and delete it from the system. Along with the filenames, It uses checksum and find duplicates based on file contains.

READ More Relevant Stuff:  List Of Useful Apps For Ubuntu 20.04 LTS [For Beginner]

Install Rdfid in Linux based operating system.

Run the following command to install Rdfid in Linux:

[On Debian/Ubuntu]

sudo apt-get install rdfind

[On CentOS/RHEL]

sudo yum install epel-release &&  sudo yum install rdfind

[On Fedora 22+]

sudo dnf install rdfind

Run the following command to search the duplicate files in a specific directory. It will save the results in file called results.txt located in the same directory.

sudo rdfind /home/user

You can also use the -dryrun option to provide a list of duplicates without taking any actions:

sudo rdfind -dryrun true /home/user

and replace them with hardlinks.

sudo rdfind -makehardlinks true /home/user

To delete the duplicates.

$ rdfind -deleteduplicates true /home/user

Comments

No comments yet. Why don’t you start the discussion?

    Leave a Reply

    Your email address will not be published. Required fields are marked *