How to remove duplicate files in Linux using rdfind

Duplicate files can be removed using the rdfind command in Linux. To do so open a terminal window and first install rdfind as below:
$ sudo apt-get install rdfind <enter>

Then, check for duplicate files on a medium:
$ rdfind true . <enter>

. is the current directory where I ran rdfind

Make sure you have a data backup before deleting any files.

Lastly, after confirming that results.txt lists out what are duplicates and that you need to delete the duplicate files, enter the below command:
$ rdfind -deleteduplicates true . <enter>

. is the current directory where I ran rdfind.

rdfind matches hashes to identify indentical files.