Updated: 28 September 2026 · Applies to: fdupes 2.3 and 2.4, jdupes 1.27 to 1.31 and rdfind 1.6 on Ubuntu 24.04 and 26.04, Debian 13, AlmaLinux and Rocky Linux 9 and 10 (EPEL)

Duplicate files waste disk space, especially in backups, photo collections and old website copies. The tools below find files with identical content (not just the same name) by comparing sizes and checksums, and can then delete the extra copies or replace them with links. We tested each command on Ubuntu 24.04.

Before you start

  • Always list the duplicates first and read the list before deleting anything.
  • Take a backup of anything important. Deleted files do not go to a trash folder.

Install

apt install fdupes jdupes rdfind                          # Ubuntu, Debian
dnf install epel-release && dnf install fdupes jdupes      # AlmaLinux, Rocky Linux

rdfind is not packaged for AlmaLinux and Rocky Linux; use fdupes or jdupes there.

1. fdupes

fdupes -r /data                 # list duplicate groups, recursively
fdupes -rSm /data               # summary: how many and how much space

Each group of identical files is printed together, separated by a blank line. To delete, run fdupes -rd /data: for every group it asks which copy to keep. -N would keep the first file of each group without asking; use it only after checking the list.

2. jdupes (faster on large folders)

jdupes -r /data                 # list
jdupes -rL /data                # replace duplicates with hard links

Hard links keep every file name working while the data is stored once. They only work within one file system, and a change to one "copy" changes all of them, so do not use them for files that will be edited separately.

3. rdfind (Ubuntu and Debian)

rdfind -dryrun true /data       # report only
rdfind -makehardlinks true /data

rdfind writes its findings to results.txt in the current folder. It decides which file is the "original" by the order of the folders you give it, so list the folder you want to keep first.

Tips

  • Leave out system folders such as /usr, /etc and /var/lib: packages rely on their files, even identical ones.
  • For websites, duplicates often come from old backups inside the web root. Moving those backups out of the public folder is a security fix as well as a space saving.
  • To see which folders use the most space in the first place: du -xh /data | sort -h | tail -20.

Official documentation: fdupes and rdfind on GitHub.

Related services

KVM VPS hosting

NVMe SSD and full root access, with Free Basic Managed Support.

Unmanaged dedicated servers

full root access and free IPMI KVM, with Free Basic Managed Support.

Managed dedicated servers

our engineers look after the server for you, from $135 a month.

Was this answer helpful?

Still stuck? Open a ticket