how to remove duplicate files on linux
Once installed, you can search duplicate files using the below command:
For recursively searching within a folder, use -r option
fdupes -r /home
This will only list the duplicate files and do not delete them by itself. You can manually delete the duplicate files or use -d option to delete them.
fdupes -d /path/to/folder
This won’t delete anything on its own but will display all the duplicate files and gives you an option to either delete files one by one or select a range to delete it. If you want to delete all files without asking and preserving the first one, you can use the noprompt -N option.
FDUPES: finding and removing duplicate files
In the above screenshot, you can see the -d command showing all the duplicate files within the folder and asking you to select the file which you want to preserve.
There are many other ways and tools to find and delete duplicate files in Linux. Personally, I prefer the FDUPES command line tool; it’s simple and takes no resources.