CleanMate

All guides · macOS and Ubuntu · Updated

How to find and delete duplicate files safely on a Mac and on Ubuntu (fdupes, hard links, APFS clones)

Where duplicate files come from, how to find them with fdupes or jdupes on macOS and Ubuntu, why hard links and APFS clones look like duplicates but free no space, and which copy to keep.

Download for macOS · Install on Ubuntu — free and open source

CleanMate Large & Old Files on a Mac with Duplicate Files chosen in the Kind menu, copies grouped togetherCleanMate Large & Old Files on a Mac with Duplicate Files chosen in the Kind menu, copies grouped together

Duplicate files pile up quietly: the same PDF downloaded twice (report.pdf, report (1).pdf), photos imported from the phone into two places, a project folder copied “just in case”, a backup of a backup. Finding them is easy; deleting the right ones safely takes a few rules. This guide covers both, on a Mac and on Ubuntu.

Rule 1: compare content, not names

report (1).pdf may differ from report.pdf, and IMG_2041.jpg in two folders may be two different photos. Two files are duplicates only when their bytes are identical. Every tool below first groups files by size, then compares a hash or the bytes themselves.

A quick check of two files by hand:

shasum -a 256 file1 file2     # Mac
sha256sum file1 file2         # Ubuntu
cmp file1 file2 && echo same  # both: byte-for-byte

fdupes and jdupes

fdupes is the classic duplicate finder; jdupes is a faster fork with the same flags for the common cases.

sudo apt install fdupes   # Ubuntu (or: sudo apt install jdupes)
brew install fdupes       # Mac, with Homebrew (or: brew install jdupes)

fdupes -r ~/Pictures      # list groups of identical files, recursively
fdupes -rS ~/Downloads    # with the size of each group
fdupes -rm ~              # only a summary: how many duplicates, how much space

Run the listing first and read it. Then, for a folder you understand, fdupes -rd <folder> asks, group by group, which copy to keep and deletes the others. Avoid -N (keep the first, delete the rest without asking) on anything you care about: “first” depends on the order the folders are read, and the deletion skips the Trash. Don’t point either tool at ~/Library, a Photos or Music library, or a git repository: apps keep identical files there on purpose, and deleting one breaks the library.

A safer route is to let the tool only list (fdupes -r ~/Downloads > dupes.txt), then remove copies yourself in Finder or Files, so they go to the Trash.

Some “duplicates” share their data on disk, so deleting one frees nothing.

So the space a duplicate finder reports is a maximum, not a promise. Check df -h ~ before and after (and empty the Trash).

Which copy to keep

How CleanMate does it

CleanMate finds duplicates by content and moves the copies you pick to the Trash, where Undo puts them back (see all macOS features and all Ubuntu features). The duplicates and similar photos page shows the whole flow on both systems.

To find what else fills the disk, see finding large files on a Mac and Ubuntu, and Space Lens compared with DaisyDisk and Baobab on the compare page. Photos that look alike but are not byte-identical are a separate mode: similar photos and burst shots on a Mac and Ubuntu. Download CleanMate — free and open source.

FAQ

Is it safe to delete duplicate files? Your own documents, photos and downloads, yes — one copy at a time, after checking the content is identical and keeping one. Files inside app folders, libraries and system folders, no.

I deleted hundreds of duplicates and gained almost nothing. They were probably hard links or APFS clones, which share data on disk; or the Trash is not emptied yet.

Does the Finder have a duplicate finder? No. Photos on the Mac has a Duplicates album for photos in its own library; for other files you need a tool.

Looking for a free MacCleaner Pro alternative? See how CleanMate compares, feature by feature.

Skip the commands

CleanMate runs on both systems: pick yours.

Open source — star it on GitHub: CleanMate for macOS · CleanMate for Ubuntu

How CleanMate decides what is safe to remove →