When you create a file, all kinds of supplementary metadata get added to it. Anyone with access to the file can read this information, which may include details you may not want anyone else to know.
Here’s how to clear metadata from files on Linux.
Metadata is hidden in the headers of most computer files and gives context about the data the files contain. It will state the kind of data stored in the file—regardless of the file extension. It will likely contain the creation date, the username of the file’s creator, and the tool used to create the file.
If the file is a photo, the metadata will contain details about the camera or phone model, and the settings used, and if the photographer has not disabled location tagging, it will give a precise set of coordinates of where they captured the image. If you’re taking a golden hour selfie in your bedroom on your brand new iPhone 14 Pro Max, you probably don’t want that information out in the world.
It’s very easy to view the metadata for any type of file on Linux, and ExifTool is a free utility that can help you.
To install ExifTool on Debian-derived distros, including Ubuntu, run:
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 enter:
ExifTool works on any file that stores metadata including word docs, PDFs, images, scripts, and text files—although the amount of information available will vary wildly.
With all that information available to anyone who has access to your files, it’s reasonable that you want to remove it. ExifTool can do the job for you.
To remove all the superfluous file metadata:
exiftool -all= /path/to/file
This will remove all but the most basic metadata such as the file creation date, file type, and MIME type, without which it would be difficult to open the file.
It’ll save the original file, with metadata intact, under a new filename with the suffix _original. You can delete this with:
Metadata can give away more than your location and exactly how expensive your phone is. As the author of a widely distributed 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 security online, consider using an operating system specifically developed for privacy-focused users.