Whenever you create a new file, whether using your office application, digital camera or video editor, a set of metadata fields are – most of the time – created as well on your new file. These metadata fields are hidden and you can’t see them in the file itself, but they might be revealing a lot of information about you and how you created that file.
Such metadata may include:
- The creation or modification date of that file.
- The name of the software which was used to create it.
- The username of the operating system when the file was created.
- A unique identifier that points to the software license used by the file creator.
- In the case of digital cameras, photos may include lens information, camera type and other info.
- Much more depending on the file format.
These metadata fields are quite revealing, which could impact your privacy and help unwanted people identify your real identity (if you were using an anonymous one) and reveal extra information about you, which is perhaps not what you want.
This article will show you how you can see file metadata on Linux, and how to strip and remove them as well if you wish to.
View and Remove File Metadata Using Linux Command Line
The best way to do that on Linux is using the “exiftool” command line program. It is an open source program licensed under the GPL 3 license, and exists in most Linux distributions repositories by default.
To install it on Ubuntu, run:
sudo apt install libimage-exiftool-perl
On Fedora, run:
sudo dnf install perl-Image-ExifTool
For other Linux distributions, just search for
exiftool in your distribution’s repositories to find the package.
Once installed, you can now run the tool on any file that exists on your system using the following format to view its metadata fields:
exiftool -s <path_to_file>
For example, see this picture and how it displays metadata information:
To remove a specific metadata field from the file, simply run the following command (Yes, there is a space after the
exiftool -<TAG_Name>= <path_to_file>
Basically, you are telling the tool that you want to unset the desired field value, which is why we are just not assigning any value to the metadata field after the
= sign. We just leave it empty.
An example command on that would be:
exiftool -CreateDate= '/home/mhsabbagh/Downloads/seagull.mp4'
If you run the
exiftool -s command again on the file, you will see that the metadata field we stripped is now empty of value:
You can now run the same command again multiple times for any metadata fields that you want to strip from your files.
In this way, no one will be able to use that information to hijack your privacy or identify you, and you can share your files safely over the network with anyone you want without having to worry about your identity.
Hanny is a computer science & engineering graduate with a master degree, and an open source software developer. He has created a lot of open source programs over the years, and maintains separate online platforms for promoting open source in his local communities.
Hanny is the founder of FOSS Post.
FOSS Post has been providing high-quality content about open source and Linux software for around 7 years now. All of our content is free so that you can enjoy it whenever you like. However, consider buying us a cup of coffee by joining our Patreon campaign or doing a one-time donation to support our efforts!
You can take a number of interesting and exciting quizzes that the FOSS Post team prepared about various open source software from FOSS Quiz.