duplicates – Internetblog.org.uk https://www.internetblog.org.uk Web hosting, Domain names, Dedicated servers Fri, 29 Jan 2016 11:05:52 +0000 en-US hourly 1 https://wordpress.org/?v=4.9.5 https://www.internetblog.org.uk/files/2016/01/cropped-favico-32x32.png duplicates – Internetblog.org.uk https://www.internetblog.org.uk 32 32 How to delete duplicate files in Linux https://www.internetblog.org.uk/post/999/how-to-delete-duplicate-files-in-linux/ Tue, 16 Feb 2010 19:45:00 +0000 http://www.internetblog.org.uk/post/999/how-to-delete-duplicate-files-in-linux/ terminal icon
Question: Two of my directories on my server have some the same files. How can I easily delete any duplicates while preserving the unique files?

Answer: There exists a Linux tool for just about everything, and this is no exception. You need a tool called fdupes, which searches the path you give it for duplicate files and uses several comparison techniques (sizes, MD5 signatures, byte-by-byte comparison) to find and eliminate duplicates.

First install fdupes. In RHEL/Fedora/CentOS, use the rpmforge repository enter:

# yum install fdupes

To find duplicates in the /etc directory, you would enter:

# fdupes /etc

To force fdupes to prompt you whether to preserve or delete files:

#fdupes -d /etc

As you can see, fdupes might be just what you need to clean up your server and possibly increase that precious disk space.

Source: nixCraft
Photo: Wikimedia Commons

]]>