How to Find and Remove Duplicate Photos in Linux

Got too many duplicate photos in your collection? Here's how to identify and get rid of them by using digiKam in Linux. Should also work on Windows.
Warp Terminal

Clicked too many similar photos? Have saved the same photo in different folders? I know that feel.

You click photos on camera, send it through WhatsApp. Now you back up the images and you have two copies of the photos from the gallery and WhatsApp. It is annoying, cluttered and takes extra space unnecessarily.

I came across this issue while going through my father-in-law’s photo collection. Here’s what I did to find the duplicate photos and remove them.

Find and remove duplicate photos with digiKam

digiKam is a free and open source utility for managing photo collections. It is primarily aimed at photographers but you do not need to be a professional camera person for using it.

Let me show you how you can use this tool for finding duplicate photos and if you feel like it, remove the duplicate ones.

Step 1

First thing first, install digiKam. It is a popular application and you should be able to install it from the software center or using the package manager of your distribution.

digikam software center
Install digikam from the software center

Step 2

When you start digiKam for the first time, it asks for the location of your image collection. Then it creates a SQLite database and then imports the images.

digikam initial setup 1

Step 3

Now that you have imported your photos, go to Tools->Find Duplicates from the file menu.

find duplicates digikam
From the file menu, go to Tools->Find Duplicates

Step 4

It will take some time depending on the number of images you have in your collection. After that, you should see all the photos that have duplicate images in the left sidebar. It also shows the duplicate photos for the selected image in the right sidebar.

duplicate images found with digikam
Duplicate images found with digiKam

In the screenshot above, there are four copies of the same photo that I have selected in the left sidebar. You can see one of the images is labelled as ‘Reference image’. But it is up to you to believe which is original and which is duplicate.

By default, the duplicate photos are divided into sections based on their location, i.e. folders. You may change that by going to View->Separate Items in the file menu.

To delete the duplicate photos, select the image(s) in the right sidebar and then hit the delete button.

You can repeat this by selecting the image in the left sidebar and then delete the duplicates one by one. Too time taking? There is a trick to delete multiple duplicates at a time.

Deleting multiple duplicates images in digiKam

If you want to delete duplicate photos for more than images at the same time, select all the images from the left sidebar.

Now, go to the file menu -> View -> Sort Items and select By Similarity.

remove multiple duplicate photos
Removing multiple duplicate photos

This will put all the referenced images at the bottom. You can select all the images in the right sidebar that are NOT labelled as duplicate and press the delete button.

Bonus Tip: There is a trash bin for restoring deleted photos

Accident happens. It is common to accidentally delete the wrong photos. This is why images are never really deleted by digiKam immediately. Instead, it creates a hidden .dtrash folder in the same folder where your photos are stored and moves the ‘deleted’ photos here.

Even on the application interface, you can see the Trash folder. You can find your ‘deleted’ photos here and restore the ones you want.

trash option digikam
Trash folder in digiKam

I hope you like this quick tutorial on finding and removing duplicate images in Linux. On a similar note, you may want to know about using GUI tools for finding duplicate files in your Linux system.

Have questions or suggestions? Please leave a comment below.

About the author
Abhishek Prakash

Abhishek Prakash

Created It's FOSS 11 years ago to share my Linux adventures. Have a Master's degree in Engineering and years of IT industry experience. Huge fan of Agatha Christie detective mysteries 🕵️‍♂️

Become a Better Linux User

With the FOSS Weekly Newsletter, you learn useful Linux tips, discover applications, explore new distros and stay updated with the latest from Linux world

It's FOSS

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to It's FOSS.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.