How-To Guide

    fdupes: How to Find and Delete Duplicate Files in Linux

    fdupes is the standard command-line duplicate finder on Linux. Here is how to install it, the commands you will actually use, and how to delete duplicates without deleting the wrong copy.

    Published November 15, 2026Updated November 15, 20268 min read
    Mehrab Ali

    Author

    Mehrab Ali

    Founder & Executive Lead, ARCED International

    Founder of ARCED Foundation, ARCED International, and Solutions of Things Lab (SoTLab). Built FolderManifest to help teams protect file integrity and stay audit-ready.

    Quick Answer

    fdupes is a command-line tool that finds identical files on Linux. Run fdupes -r ~/Pictures to list duplicates in a folder and its subfolders, and fdupes -rd ~/Pictures to choose which copy to keep in each set and delete the rest. It compares file sizes, then MD5 signatures, then every byte, so it only reports exact copies.

    The options and wording below follow the fdupes 2.4.0 manual page, the version Debian and Homebrew currently ship. Older 1.x releases behave the same for listing; the differences are in the delete prompt and are noted where they matter.

    Install fdupes

    fdupes is packaged by every major distribution, so you do not need to build it:

    # Debian, Ubuntu, Linux Mint
    sudo apt install fdupes
    
    # Fedora
    sudo dnf install fdupes
    
    # Arch, Manjaro
    sudo pacman -S fdupes
    
    # openSUSE
    sudo zypper install fdupes
    
    # macOS with Homebrew
    brew install fdupes
    
    # Check the version
    fdupes --version

    Find Duplicate Files with fdupes

    Give fdupes one or more directories. Without -r it only looks at files directly inside them; with -r it descends into every subdirectory.

    $ fdupes -r ~/Pictures
    /home/sam/Pictures/2024/IMG_0412.jpg
    /home/sam/Pictures/phone-backup/IMG_0412.jpg
    
    /home/sam/Pictures/2023/scan.pdf
    /home/sam/Pictures/Downloads/scan (1).pdf

    Each block separated by a blank line is one set of identical files. Names do not matter: scan.pdf and scan (1).pdf are matched because their contents are the same. Nothing has been changed on disk at this point.

    The variations you will use most:

    # Show the size of each set
    fdupes -rS ~/Pictures
    
    # One-line summary: how many duplicates, how much space
    fdupes -rm ~/Pictures
    
    # Ignore empty files and hidden files
    fdupes -rnA ~/Pictures
    
    # Only files of 1 MB or more (size is in bytes)
    fdupes -r -G 1048576 ~/Videos
    
    # Several directories at once
    fdupes -r ~/Pictures /mnt/backup/Pictures
    
    # Save the list to a file, without the progress indicator
    fdupes -rq ~/Pictures > duplicates.txt

    -m prints a line such as 42 duplicate files (in 17 sets), occupying 318.4 megabytes, which is a quick way to decide whether a clean-up is worth the time. -n is worth adding almost always: every zero-byte file is identical to every other one, so they show up as one large, useless set.

    fdupes Options Worth Knowing

    OptionWhat it does
    -rRecurse into subdirectories of every directory given
    -RRecurse only into the directories listed after this option
    -S / -tShow the size / modification time of duplicate files
    -mPrint a summary instead of the list
    -n / -AExclude zero-length files / hidden files
    -G / -LMinimum / maximum file size in bytes
    -fOmit the first file in each set from the output
    -1Print each set on a single line
    -o / -iOrder files by time, ctime, or name / reverse the order
    -dAsk which files to keep in each set and delete the others
    -NWith -d: keep the first file in each set, delete the rest, no prompt
    -PWith -d: use the line-based prompt instead of the full-screen interface
    -l FILELog deletion choices to a file
    -HTreat hard links to the same data as duplicates (off by default)
    -sFollow symlinked directories
    -pDo not match files with a different owner, group, or permission bits

    Delete Duplicates Safely with fdupes

    fdupes deletes with rm semantics: files do not go to the trash. Work in three steps, and stop after any step that surprises you.

    1. Preview what would go

    # Every file except the first in each set
    fdupes -rf ~/Pictures

    This is the exact list -dN would delete. If the copies you want to keep appear in it, change the order with -o name or -i and preview again, or use the interactive mode instead.

    2. Delete interactively

    $ fdupes -rdP ~/Pictures
    [1] /home/sam/Pictures/2024/IMG_0412.jpg
    [2] /home/sam/Pictures/phone-backup/IMG_0412.jpg
    
    Set 1 of 2, preserve files [1 - 2, all]:

    Type the number of the copy to keep (or several, separated by commas), or all to keep the whole set. Version 2 opens a full-screen interface by default on builds that include it; -P gives the classic line prompt shown here, which is also what 1.x releases use.

    3. Or delete without prompting

    # Keeps the first file in each set, deletes the rest
    fdupes -rdN ~/Pictures
    
    # Same, and record what was chosen
    fdupes -rdN -l fdupes.log ~/Pictures

    If you would rather review a list in an editor before anything is removed, write the preview to a file, edit out the lines you want to keep, then delete what is left:

    fdupes -rfq ~/Pictures | grep -v '^
    #x27; > to-delete.txt # ...open to-delete.txt, remove any line you want to keep... xargs -d '\n' rm -v -- < to-delete.txt

    xargs -d is a GNU option, so this works on Linux as written. It handles spaces in names but not file names that contain a newline.

    Use fdupes to Compare Two Directories

    A common job: new/ is a dump from a phone or an old drive, and you want to know which of its files already exist in archive/. Passing both directories finds the matches, but the output also includes sets that sit entirely inside one directory. This filter prints only the files in new/ that have an identical copy in archive/:

    fdupes -rq archive new | awk -v RS= -v keep='archive/' -v drop='new/' '{
      n = split($0, f, "\n"); has = 0
      for (i = 1; i <= n; i++) if (index(f[i], keep) == 1) has = 1
      if (has) for (i = 1; i <= n; i++) if (index(f[i], drop) == 1) print f[i]
    }'

    fdupes prints paths the way you typed the directories, so keep and drop must match those prefixes exactly, including the trailing slash. The result is a list of files in new/ that are safe to remove because the archive already holds the same bytes.

    fdupes answers "which files are the same?" It does not tell you which files are missing from one side or which changed. For that, see how to compare folders on Linux with diff -rq, rsync, or checksum lists.

    Three Ways to Lose Data with fdupes

    These come straight from the manual's CAVEATS section

    • Naming the same directory twice. In fdupes -rd ~/Pictures ~/Pictures, or a parent and its child with -r, every file is listed as its own duplicate. Keep one "copy" and you delete the only one.
    • Combining -s with -d. When symlinks are followed, you can keep a symlink and delete the real file it points to.
    • Trusting -dN on the default order. "First" is whatever the sort order puts first, not the copy in your tidy folder. Always preview with -f.

    One more thing that is not a bug but catches people: identical files are sometimes meant to be there. Package caches, node_modules, git objects, and application data often contain legitimate duplicates. Point fdupes at your own documents, photos, and downloads, not at / or your whole home directory.

    fdupes vs jdupes, rdfind, rmlint, and Czkawka

    fdupes is the tool most guides start with because it is in every repository and has few moving parts. These are the other duplicate file finders for Linux you will see recommended, and what each is for:

    ToolInterfaceWhy pick it
    fdupesCommand lineSimple, packaged everywhere, interactive delete prompt
    jdupesCommand lineA fork of fdupes, usually faster on large trees; can replace duplicates with hard links
    rdfindCommand lineRanks copies by the order you list directories; dry-run mode; can hard-link or delete
    rmlintCommand lineWrites a shell script you review and run, instead of deleting directly
    CzkawkaGraphicalAlso finds similar images and other clutter, not only exact copies
    dupeGuruGraphicalReference folders that are never deleted from; fuzzy name and picture modes

    fdupes itself has no option to replace duplicates with links. If you want to reclaim space but keep every path working, jdupes -rL directory hard-links identical files in place.

    Find Duplicates Without Installing Anything

    On a server where you cannot install packages, GNU coreutils gives the same answer for exact copies. This hashes every file and prints the groups that share a SHA-256:

    find . -type f ! -empty -exec sha256sum {} + | sort | uniq -w64 --all-repeated=separate

    It is slower than fdupes on big trees because it hashes every file, where fdupes skips any file whose size is unique. More on reading and checking these lists is in sha256sum on Linux.

    When You Want to Review Before Anything Moves

    fdupes is hard to beat for a quick, scripted clean-up. Its limits show on a photo archive or a shared drive, where you want to see the sets side by side, decide folder by folder, and be able to take it back. fdupes deletes immediately and has no undo.

    FolderManifest is a desktop app for Linux, Windows 10/11, and macOS that finds duplicates the same strict way, by exact SHA-256 content match, then puts the clean-up into a plan you review and approve, with undo. Like fdupes, it does not detect similar photos or re-encoded audio. It also compares folders and verifies copies and backups against a SHA-256 manifest, which fdupes does not do.

    You may not need it

    If you are comfortable in a terminal and have a backup, fdupes with a -f preview is enough for most clean-ups, and it is free. A reviewable plan with undo is worth it when the files are irreplaceable or someone else has to sign off on what gets removed.

    Frequently Asked Questions

    What is fdupes?

    fdupes is a free, open-source command-line program that finds duplicate files in the directories you give it. It compares file sizes, then MD5 signatures, then confirms each match byte by byte, and can list, summarize, or delete the duplicates it finds.

    How do I install fdupes?

    It is in the standard repositories of most distributions: sudo apt install fdupes on Debian and Ubuntu, sudo dnf install fdupes on Fedora, sudo pacman -S fdupes on Arch, and sudo zypper install fdupes on openSUSE. On macOS, use brew install fdupes.

    Does fdupes delete files automatically?

    Not unless you ask. Plain fdupes only lists duplicates. With -d it asks which copies to keep in each set. Only -dN (delete with no prompt) removes files without asking, keeping the first file listed in each set.

    Which file does fdupes -dN keep?

    The first file listed in each set. The order is controlled by -o (time, ctime, or name) and reversed by -i. Run the same command with -f instead of -dN first: it prints every file except the first in each set, which is exactly what -dN would delete.

    Does fdupes find similar photos or songs?

    No. fdupes only matches files whose bytes are identical. A resized photo, a re-encoded MP3, or a document saved again is a different file to fdupes. For near-duplicates you need a similarity tool such as Czkawka or dupeGuru.

    What is the difference between fdupes and jdupes?

    jdupes started as a fork of fdupes. It is usually faster on large trees and adds actions fdupes does not have, such as replacing duplicates with hard links. The basic usage is the same: jdupes -r directory.

    Does fdupes work on Windows?

    There is no official native Windows build. You can run it inside WSL against your Windows drives under /mnt/c. For a native option, see our guide to finding duplicate files on Windows.

    On Windows, start with how to find duplicate files on Windows.

    Find Exact Duplicates, Review the Plan, Keep an Undo

    SHA-256 duplicate detection with a clean-up plan you approve before anything moves. Linux, Windows, and Mac. 7-day free trial, no card required, 30-day money-back guarantee.

    Continue Learning