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.
Hard links and APFS clones: duplicates that take no space
Some “duplicates” share their data on disk, so deleting one frees nothing.
-
Hard links: two names for the same file (Time Machine, package managers like pnpm and uv, some backup tools use them). fdupes and jdupes skip hard links unless you pass
-H. To see whether a file has other names:stat -f '%l links: %N' file # Mac (BSD stat) stat -c '%h links: %n' file # Ubuntu (GNU stat) find ~ -xdev -type f -links +1 2>/dev/null | head # files with more than one name -
APFS clones (Mac only): Finder’s Duplicate (⌘D) and
cp -cmake a copy that shares the original’s blocks until one of them is edited. Both files look full-size everywhere — in Finder,du, fdupes — yet together they use the space of one. Deleting the clone frees almost nothing, and macOS has no built-in command to tell a clone from a real copy.
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
- Keep the oldest copy, usually the original; the newer one is the re-download or the copy.
- Keep the copy in the place you organise (Documents, Pictures, a project) and delete the one in Downloads or Desktop.
- Keep the copy inside a library (Photos, Music, Lightroom) and delete the loose one outside it — never the other way round.
- Never delete every copy of a group. Easy to do when you tick by hand across several screens.
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.
- Mac — Large & Old Files › Kind › Duplicate Files: searches your home folder, or a folder or external drive you choose, for files that have an identical copy and shows them in groups, each copy with its date, folder and size. Files from 1 MB by default; the Size menu changes that to 100 KB, 10 MB or 50 MB. Only files of the same size are read, and compared by SHA-256. Hard links to one file count once, and a file with other hard links is marked Hard link — moving it frees no space. APFS clones are listed with their group, labelled APFS clone — moving it frees no space (or what it frees, if they no longer share everything), and the selected size counts only what they really free.
- Ubuntu — Duplicates: groups identical files from 1 MB, in a folder or drive you pick.
- Nothing is ticked for you. On the Mac, Select All but Suggested ticks every copy except the one marked Suggested to keep (the copy outside Downloads, then the oldest) and never ticks APFS clones. On Ubuntu, Select automatically ticks every copy except the oldest of each group. Both warn you if every copy of a file is ticked.
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.

