How to Install ExifTool on Ubuntu 22.04 or 20.04

For those who work with metadata, ExifTool is an indispensable tool. This command-line application, written in Perl, offers a comprehensive solution for reading, writing, and editing metadata across various files. This guide focuses on how to install ExifTool on Ubuntu 22.04 Jammy Jellyfish or the older stable release of Ubuntu 20.04 Focal Fossa.

Key Features of ExifTool:

  • Format Support: ExifTool is compatible with a wide array of formats, including but not limited to JPEG, TIFF, audio, video, and PDF files.
  • Customization: The tool allows you to customize output formats and select specific metadata tags for extraction.
  • Batch Processing: ExifTool can handle multiple files simultaneously, streamlining the metadata editing process.
  • Cross-Platform: Whether you’re using Windows, macOS, or Linux, ExifTool has you covered.

You have two primary options for installing ExifTool on Ubuntu: using the default Ubuntu repository, which is straightforward but may not offer the latest version, or manually downloading and installing the most recent release.

With this foundational knowledge of ExifTool’s capabilities and installation methods, you’re well-prepared to proceed with the following detailed installation steps.

Section 1: Install ExifTool on Ubuntu 22.04 or 20.04 via APT

Step 1: Update Ubuntu System Packages Before ExifTool Installation

To begin the installation of ExifTool on your Ubuntu system, it is imperative to ensure that the system’s package list and the existing software packages are up to date. This ensures that you install ExifTool on Ubuntu 22.04 or 20.04 in a secure environment, and it helps avoid any conflicts with other software. Run the following command to update the package list and upgrade the installed packages:

sudo apt update && sudo apt upgrade

Step 2: Install ExifTool on Ubuntu 22.04 or 20.04

ExifTool is conveniently available in the default Ubuntu repositories. This is advantageous as it makes the installation process seamless and straightforward without adding any third-party repositories.

Execute the following command in your terminal to install ExifTool:

sudo apt install exiftool

This command retrieves and installs the ExifTool package from the Ubuntu repository. It is noteworthy that, although using the APT repository for installation is efficient and effortless, it might not always offer the most recent version of ExifTool. However, the version provided in the Ubuntu repositories is quite competent for general purposes and routine metadata operations.

Section 2: Install ExifTool on Ubuntu 22.04 or 20.04 via Archive Method

Step 1: Download ExifTool on Ubuntu 22.04 or 20.04

For those adept at using the command line and prefer to have the latest build of ExifTool, installing it via an archive download is an optimal choice. This method doesn’t depend on third-party repositories and ensures you obtain the latest version directly from the source.

To start, use the wget command to download the latest version of ExifTool from the official website. Note that you need to replace {version} with the actual version number:

wget https://exiftool.org/Image-ExifTool-{version}.tar.gz

Step 2: Extract ExifTool on Ubuntu

After the download is complete, extract the contents of the archive using the gzip and tar commands. Then, navigate to the extracted directory. Again, replace {version} with the actual version number:

gzip -dc Image-ExifTool-*.tar.gz | tar -xf -
cd Image-ExifTool-{version}

Step 3: Generate the Makefile on Ubuntu for ExifTool

Before you can install ExifTool, you need to generate a Makefile. A Makefile is a set of directives used by the make utility to build executable programs from source code. Use the perl command to generate the Makefile:

perl Makefile.PL

You should see output similar to this:

Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for Image::ExifTool
Writing MYMETA.yml and MYMETA.json

In case this command doesn’t work, it might be because Perl is not installed on your Ubuntu system. Install Perl by executing:

sudo apt install perl

Step 4: Install ExifTool on Ubuntu 22.04 or 20.04

Finally, with the Makefile generated, use the make command to build and install ExifTool:

sudo make install

You should see an output indicating that the installation process is appending installation information to a directory on your system.

Appending installation info to /usr/local/lib/x86_64-linux-gnu/perl/x.x.x/perllocal.pod

Section 3: Getting Started with Basic ExifTool Commands on Ubuntu

In this section, let’s dive into some fundamental ExifTool commands that are widely used. For those new to ExifTool, these commands will serve as a strong foundation for further exploration and mastery of this powerful tool.

View Metadata

One of the first things you might want to do with ExifTool is to view a file’s metadata. It’s simple; use the exiftool command followed by the file name.

exiftool example.jpg

This command displays all the metadata associated with the image example.jpg.

Extract Specific Metadata

Often, you might only be interested in specific pieces of metadata. You can do this by specifying the metadata field’s name after the exiftool command.

exiftool -Model -DateTimeOriginal example.jpg

This example extracts the camera model and the original date and time when the photo was taken from example.jpg.

Modify Metadata

Modifying metadata is also a breeze with ExifTool. For instance, you can change the image’s author name by using the following command:

exiftool -artist=me a.jpg b.jpg c.jpg

Remember that altering metadata should be done carefully, especially in a professional setting, to avoid misrepresenting or losing important data.

Copy Metadata Between Files

You can also use ExifTool to copy metadata from one file to another. This can be useful when applying the same metadata to multiple files.

exiftool -TagsFromFile source.jpg target.jpg

This command copies all the metadata from source.jpg to target.jpg.

Remove Metadata

There might be scenarios where you need to remove metadata from a file. You can use the following command to remove all metadata:

exiftool -all= example.jpg

This will remove all metadata from example.jpg.

Export Metadata to a File

Exporting metadata to an external file can be useful for various purposes, such as analysis or record-keeping.

exiftool -j -g1 -fileOrder -FileName -Directory -mimetype -fast2 example.jpg > metadata.json

This example exports metadata from example.jpg to a JSON file named metadata.json.

Remember to consult the ExifTool documentation for detailed information on its myriad of options and functionalities. As you begin using these commands, you’ll realize the versatility and robustness of ExifTool in handling metadata.

Conclusion

In this guide, we meticulously walked through the installation of ExifTool on Ubuntu 22.04-20.04, taking into account different avenues through which it can be achieved. Notably, we discussed the installation through the Ubuntu APT Repository, which is straightforward and perfect for those who prefer the stability of their system packages. We also covered a more advanced method involving archive downloads, which is ideal for those wanting the latest ExifTool version. Additionally, we dived into some basic but highly functional ExifTool commands that form the cornerstone of everyday usage. Armed with this knowledge, you are well on your way to exploiting ExifTool to its fullest potential in managing and manipulating metadata.