Linux Commands and Scripts

Find and Delete Duplicate Files Using fdupes in Linux

In this article, we will see how to find and delete duplicate files using fdupes in Linux.

Fdupes is another program that allows you to identify duplicate files on your system. It is free and open source and written in C. You can scan directories for duplicate files, with options to list, delete or replace the files with hardlinks pointing to the duplicate. It first compares file sizes, partial MD5 signatures, full MD5 signatures, and then performs a byte-by-byte comparison for verification.

Install fdupes

# apt-get install fdupes    [On Debian/Ubuntu]

# yum install epel-release && yum install fdupes   [On CentOS/RHEL]

Scan directory to find duplicate files

# fdupes <dir>

Scan the directory recursively

# fdupes -r <dir>

Scan multiple directories

# fdupes <dir1> -r <dir2>

Calculate the size of the duplicate files

# fdupes -S <dir>

Display summarized information

# fdupes -m <dir>

Delete all duplicate files

# fdupes -d <dir>

In this article, we have seen how to find and delete duplicate files using fdupes in Linux.

[Need assistance to fix this error or install tools? We’ll help you.]

Related Articles