1. Overview

Duplicate photos are one of the frequent problems that waste storage space and complicate photo searching. Of course, we can check for duplicate photos manually and delete them, but this can be time-consuming and impractical. A better option is to use different Linux tools for searching and deleting such photos.

In this tutorial, we’ll show how to locate and delete duplicate photos in Linux using the command line and GUI tools such as FDUPES, dupeGuru, digiKam, and others.

2. Using digiKam

digiKam is an open-source and free Linux application that’s used to manage photo collections. It’s also available on Windows and macOS, as well as multiple Linux distributions. We can use digiKam to find duplicate photos. Furthermore, digiKam uses a similarity range with lower and upper limits and a search filter to identify identical photos.

Let’s first install digiKam using the apt package manager:

$ sudo apt install digikam

After installing digiKam, we can open it from the Applications menu or by running the digikam command in the terminal:

$ digikam

When we launch digiKam for the first time, the installation wizard is displayed. Here, in the installation wizard, we can specify the location of our image collection, and we can also choose other settings. However, it’s recommended to use the default settings.

Once we’ve finished configuring the digiKam installation wizard, we can look for duplicate photos in our specified Linux directory. To find such photos, we need to open digiKam and click on the Find duplicates option:

finding duplicate photos on digiKam tool

The search might take some time to finish, depending on how many images are stored in the collection. After that, all the photos with duplicates will appear in the left sidebar. When we pick one from the left sidebar, the duplicate images for the photo we picked will be shown in the right sidebar:

viewing duplicate photos on digiKam tool

Furthermore, we can delete the duplicate photos by clicking the Remove Duplicates option:

removing duplicate photos on digiKam tool

We can also open these photos in the file manager and delete them manually one by one if we prefer.

3. Using FDUPES

Unlike digiKam, FDUPES is a command-line tool. It’s free and open-source, and we can use FDUPES to perform various functions, such as searching directories recursively, identifying duplicate content, comparing file sizes, and others.

We can also use FDUPES to find and delete photos that are copies of others. Furthermore, FDUPES looks for duplicates using different criteria, such as file size, MD5 hash, and filenames, among others.

Let’s first install FDUPES on our Linux system using the apt install command:

$ sudo apt install fdupes

After installing FDUPES, we can search for duplicate files in a specified directory. For example, to find duplicate photos in the ~/Pictures directory, we use the fdupes command with the -r option:

$ fdupes -r ~/Pictures
/home/user/Pictures/pexels-pixabay-36717.jpg
/home/user/Pictures/pexels-pixabay-36717(1).jpg

/home/user/Pictures/pexels-mali-maeder-101667.jpg
/home/user/Pictures/pexels-mali-maeder-101667 (copy).jpg

Moreover, we can also delete the duplicate photos using the fdupes command with the -rd option:

$ fdupes -rd ~/Pictures
Set 1 of 2:

[+] /home/user/Pictures/pexels-mali-maeder-101667.jpg
[-] /home/user/Pictures/pexels-mali-maeder-101667 (copy).jpg

Set 2 of 2:

1 [+] /home/user/Pictures/pexels-sam-rana-800005.jpg
2 [-] /home/user/Pictures/pexels-sam-rana-800005 (copy).jpg

Here, we need to choose which photos we want to keep and which ones we want to remove. The files that are to be kept will have a + sign in front, while the files that are to be removed will have a sign. Finally, to remove the photos, we can press the delete button on the keyboard.

4. Using rdfind

rdfind is another free and open-source command-line tool that’s similar to FDUPES. We can use this tool to find and remove duplicate photos in Linux. The rdfind command is more effective than other tools as it compares photos based on the content rather than just the name.

Let’s install rdfind using the apt package manager:

$ sudo apt install rdfind

We can now find the duplicate photos in a specified Linux directory using the rdfind command:

$ rdfind ~/Pictures
Now scanning "/home/user/Pictures", found 13 files.
Now have 13 files in total.
Removed 0 files due to nonunique device and inode.
Total size is 8311684 bytes or 8 MiB
Removed 3 files due to unique sizes from list. 10 files left.
...

After finding a duplicate, the rdfind command automatically saves the result in a results.txt file. To view the contents of the results.txt file, we use the cat command:

$ cat results.txt
# Automatically generated
# duptype id depth size device inode priority name
DUPTYPE_FIRST_OCCURRENCE 4 0 205077 2051 655919 1 /home/user/Pictures/pexels-sam-rana-800005 (copy).jpg
DUPTYPE_WITHIN_SAME_TREE -4 0 205077 2051 655513 1 /home/user/Pictures/pexels-sam-rana-800005.jpg
...

Furthermore, we can use the -deleteduplicates flag with rdfind to delete the duplicate photos found:

$ rdfind -deleteduplicates true ~/Pictures
Now scanning "/home/user/Pictures", found 13 files.
Now have 13 files in total.
Removed 0 files due to nonunique device and inode.
Total size is 8311684 bytes or 8 MiB
Removed 3 files due to unique sizes from list. 10 files left.
...

Alternatively, we can also delete the duplicate photos manually from their file location in the file manager.

5. Using Geeqie

Geeqie is an open-source GUI-based software application that lets users view and organize images in various formats. It has many functionalities, such as zoom, thumbnail view, and filtering options. It also offers features like effective image similarity detection, comprehensive information on identical photos, and a simple user interface. We can also use the Geeqie tool to locate and delete duplicate photos.

Let’s install Geeqie using the apt package manager:

$ sudo apt install geeqie

After installing Geeqie, we can open it from the Applications menu or by running geeqie in the terminal.

To find duplicate images, we first need to specify the directory path. Next, we select all the images in the directory and right-click on them. Then, we select the Find duplicates option:

finding duplicate photos on geeqie tool

The matching photos will appear in the new Find duplicates window with some important information such as size, date, dimensions, and path:

viewing duplicate photos on geeqie tool

Additionally, we can compare images visually by selecting various search mode options from a drop-down menu. These options include name, checksum, similarity, size, and others. We can also drag and drop image files or folders to the duplicates window.

Furthermore, we can right-click on the identical photos and select the Delete option to permanently delete them:

removing duplicate photos on geeqie tool

We can also copy the path of an identical photo and remove it manually in the file manager.

6. Using dupeGuru

We can use dupeGuru, a cross-platform tool, to find and delete duplicate photos in Linux. It has a simple graphical user interface that’s easy to use. The dupeGuru tool uses a fuzzy matching algorithm to quickly find identical photos by scanning either file contents or filenames.

To install dupeGuru, we first need to add its repository:

$ sudo add-apt-repository ppa:dupeguru/ppa

After adding the repository, we can now install dupeGuru using the apt install command:

$ sudo apt install dupeguru

Once installed, we can launch dupeGuru from the Applications menu.

To find duplicate photos, we first need to add the path of the directory that we want to search. Then, we click Scan and view the results:

searching duplicate photos on dupeguru tool

Reference photos, along with their matches, will be listed in the new results window, including file size and matching percentage:

viewing duplicate photos on dupeguru tool

Here, we can go through the duplicate photo list and decide what to do with each result. Furthermore, we can remove the extra copies, rename them, or move them elsewhere.

7. Conclusion

In this article, we explored various methods for finding duplicate photos in Linux. These methods included using digiKam, Geeqie, and dupeGuru, in addition to the FDUPES and rdfind command-line tools. We also discussed how to delete such photos in Linux using these GUIs and command-line tools.

If we want to quickly find matching photos, we can use either the FDUPES or rdfind command-line tools. However, if we want to search for duplicate photos graphically, we can use a GUI-based tool such as Geeqie, digiKam, or dupeGuru.

Ultimately, we can choose any of these methods based on our requirements for finding and removing duplicate photos in Linux.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments