How to Quickly Remove Metadata From Files on Linux

When you create a file, all kinds of supplementary metadata are added to it. Anyone with access to the file can read this information, which may contain details you may not want others to know.


How to delete metadata from files on Linux.


Metadata is hidden in the headers of most computer files, giving context to the data the files contain. It indicates the type of data stored in the file – regardless of the file extension. It will likely include the creation date, the username of the file’s creator, and the tool used to create the file.

If the file is a photograph, the metadata includes details about the camera or phone model and settings used, and if the photographer hasn’t turned off location tagging, it provides a precise set of coordinates of where they took the picture Has. If you’re taking a golden hour selfie in your bedroom with your brand new iPhone 14 Pro Max, you probably don’t want to broadcast that information out into the world.

It’s very easy to view the metadata for any file type on Linux, and ExifTool is a free utility that can help you with that.

Run the following to install ExifTool on Debian-derived distributions, including Ubuntu:

sudo apt install exiftool

ExifTool is also available in the Arch User Repository (AUR) and Arch users can download it from there.

To see what metadata a file contains, open a terminal and type:

exiftool /path/to/file

ExifTool works with any file that stores metadata, including Word documents, PDFs, images, scripts, and text files – although the amount of information available will vary widely.

Since all of this information is available to anyone who has access to your files, it is reasonable that you would want to remove them. ExifTool can do the work for you.

To remove all redundant file metadata:

exiftool -all= /path/to/file

This removes all but the most basic of metadata like the file’s creation date, file type, and MIME type, without which it would be difficult to open the file.

It saves the original file with metadata intact under a new filename with the suffix _Original. You can delete them with:

rm /path/to/file_original

Metadata can reveal more than just your location and the exact price of your phone. As the author of a widely shared document, you may not want anyone to know your PC login or the version of the word processor you used to create the file. An attacker can use both of these pieces of information to compromise your security. The less information you give away, the better.

If you’re really serious about your online security, you should use an operating system that’s specifically designed for privacy-conscious users.

Leave a Reply

Your email address will not be published. Required fields are marked *