The Samefile Home Page

La perfection est atteinte non quand il ne reste rien à ajouter, mais quand il ne reste rien à enlever.

Perfection is not reached when there is nothing more to add, but when there is nothing more to take away.

Antoine de Saint Exupery

What is samefile?

The samefile utility finds files with identical contents, independent of file name. This program is for you if you are notoriously low on disk space, keep exceeding your disk quota, pay for your storage by the megabyte, run any kind of file server, need to reduce the size of your backups, or just want to get a feeling for how much redundant files are there on your system. This program may be the reason for not buying a bigger disk or another set of backup media. It is pretty fast and can even check file systems with hundreds of thousands of files.

As one satisfied user put it: "Among the many uses of samefile is figuring out just how many copies of your digital camera images you have in various places on your hard disk(s). Just cleared up about a gig of space on my laptop drive - thanks!"

Typical usage would be find / | samefile. The result is a list of file name pairs which you can use for your storage spring-cleaning. It can also tell you how many kilobytes are wasted in duplicate files. Try it! You will be surprised how much wasted disk space you uncover.


The current Version is samefile-2.14.tar.gz (Size: 64K). See the Downloads Page for a list of releases, release dates, and user visible changes between releases.


The reference documentation is the Manual Page. It is also available as a printer-ready PostScript® (Size: 20K) file.


The installation of samefile is quite simple. Prerequisite is a Unix-like system with the usual toolchain for compiling C sources obtained from the 'net.

  1. Download the current distribution tarball, by clicking samefile-2.14.tar.gz (Size: 64K), or possibly using
  2. Uncompress tarball:
    gunzip samefile-2.14.tar.gz
  3. Unpack archive:
    tar xf samefile-2.14.tar
  4. Enter distribution directory:
    cd samefile-2.14
  5. Configure:
  6. Build:
  7. Test (optional):
    make test
  8. Install:
    make install
  9. Clean up (optional):
    make clean

For more details see also the distribution's INSTALL file.

For some operating systems the installation is even easier:


The samefile utility was written by Jens Schweikhardt, Please use this address for your bug report (preferably with a patch), suggestion, feature request or comment. For other contributions to the see the author's home page.


Did you know that an obfuscated version of samefile was a winning entry in the 1998 International Obfuscated C Code Contest (IOCCC)?

Quality Assurance

The distribution includes a regression test suite which tests a number of features and proper operation of the compiled binary. It is invoked via make test (see Installation above). The author recommends to run the test before installation or if you modify the source code.

The web pages for samefile conform to the W3 Consortium's Recommendations. They validate as correct XHTML and correct CSS. You are encouraged to verify this claim by clicking the respective icons in the menu on the left.