How to Find duplicate copies of files Using fdupes in Ubuntu

Sponsored Link
FDupes uses md5sums and then a byte by byte comparison to find duplicate files within a set of directories. It has several useful options including recursion.

Install fdupes in ubuntu

sudo aptitude install fdupes

This will install all the required packages for fdupes

Using fdupes

Fdupes syntax

fdupes [ options ] DIRECTORY

Available Options

-r --recurse -- include files residing in subdirectories

-s --symlinks -- follow symlinked directories

-H --hardlinks -- normally, when two or more files point to the same disk area they are treated as nonn-duplicates; this option will change this behavior

-n --noempty -- exclude zero-length files from consideration

-f --omitfirst -- omit the first file in each set of matches

-1 --sameline -- list each set of matches on a single line

-S --size -- show size of duplicate files

-q --quiet -- hide progress indicator

-d --delete -- prompt user for files to preserve, deleting all others

-v --version -- display fdupes version

-h --help -- displays help

Fdupes Examples

1) fdupes -r ./stuff > dupes.txt

Then, deleting the duplicates was as easy as checking dupes.txt and deleting the offending directories. fdupes also can prompt you to delete the duplicates as you go along.

2) fdupes -r /home/user > /home/user/duplicate.txt

Output of the command goes in duplicate.txt

fdupes will compare the size and MD5 hash of the files to find duplicates

You can also use fslint to do this job this is simple GUI tool to do this.

Sponsored Link

You may also like...

6 Responses

  1. Daniel says:

    You can also try fslint, it is faster, more powerful, updated and has gui interface

  2. canalegrande says:

    funny, even when starting
    sudo fdupes -r ./backup/ > dupes.txt

    I always get “Permission denied”

    any idea?

  3. Alex says:

    The problem is that when you say sudo fdupes -r ./backup/ > dupes.txt, fdupes will run as root as you intend, but the > means that your shell will attempt to open the file, and your shell is running as your user so it can’t write there.

    Some options:
    * redirect to a file in /tmp/ then sudo mv it where you want it
    * sudo su then run the command
    * sudo fdupes -r ./backup/ | sudo dd of=dupes.txt

  4. Seng says:

    wow that reply came 2 years later xD

  5. simon67 says:

    to find and remove duplicate files you may use DuplicateFilesDeleter

  6. pawan says:

    how does the output looks and explain the secquence of output

Leave a Reply

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