There are tons of free and paid apps available for Mac to identify duplicate files and clean them, but do you know you can identify and delete duplicate files easily using the Mac Terminal, all you need is a package called fdupes
You can download this package using brew
brew install fdupes
GitHub: https://github.com/adrianlopezroche/fdupes
Example: Find all duplicates in the Downloads folder% fdupes -r -S Downloads
2513563 bytes each:
Downloads/mysql-connector-java-8.0.30/mysql-connector-java-8.0.30.jar
Downloads/mysql-connector-java-8.0.30.jar
1113 bytes each:
Downloads/2020101_Image.png
Downloads/temp.png
24958 bytes each:
Downloads/college-trip.mp4
Downloads/college-trip-copy.mp4
As you can see, I was able to get duplicate files - Images, Software, and Videos with the size they occupy!
Few useful options-r --recurse :for every directory given follow subdirectories encountered within
-s --symlinks :follow symlinks
-G --minsize=SIZE :consider only files greater than or equal to SIZE bytes
-L --maxsize=SIZE :consider only files less than or equal to SIZE bytes
-A --nohidden :exclude hidden files from consideration
-S --size :show size of duplicate files
Deleting the files
Use -d as an option with the command, Note: You should be extra cautious while using this command to delete file,
% fdupes -d -r /Downloads/myFiles
You will get an interactive screen for duplicate files asking which one to keep.
Facing issues? Have Questions? Post them here! I am happy to answer!
Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.
Follow him on: X
You can also reach out to him via e-mail: rakesh@code2care.org
- How to show line numbers in Nano on Mac
- How to install Jupyter Notebook on macOS Sonoma
- How to Disable Remote Management using Mac Terminal
- Test internet speed using macOS Terminal command
- Docker Desktop needs privileged access macOS
- Google Search Hot Trends Screensaver for Mac OS X
- How to do calculations in Mac Terminal
- How to make TextEdit the default text Editor on Mac
- How to Show Full Website Address on Safari for Mac (Ventura/Sonoma)
- The Zsh Shell - Mac Tutorial
- Opening mac Terminal
- How to change the name of your Mac running on macOS Ventura 13
- How to find the Battery Cycle Count on macOS Ventura
- How to set an emoji as Zsh terminal prompt in macOS
- How to access Trash Folder using Mac Terminal Command
- macOS Ventura XCode Command Line Tools Installation
- Hide Bluetooth icon on Mac Menu Bar macOS Ventura 13
- How to run .sh file in Mac Terminal
- Terminal Command to get the list of available shells in macOS
- How to see Storage Information on macOS Ventura
- How to Go To /usr/local/bin on Mac Terminal?
- How to do screen recording on Mac
- How to Find File and Directory Size in Mac Terminal
- Open .bash_profile File in TextEdit using Terminal
- Remove Now Playing icon from macOS Big Sur Menu Bar
- Fix MySQL - Error: (OperationalError) (HY000) [08S01] Communications link failure - MySQL
- What is ValueError: math domain error and how to fix it - Python
- Android: Save Data in local Db using Android Room - Android
- Disable Startup Sound on macOS - MacOS
- How to Auto Click Mouse on Mac every X Seconds - MacOS
- How to Save a Notepad file as Microsoft Excel file - Microsoft
- How to delete SharePoint List Item programmatically using C#.Net - SharePoint
- Run Scripting Language (JavaScript, Python, Groovy, Ruby) in Java - Java