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 =
symbol):
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.
That’s it!
With a B.Sc and M.Sc in Computer Science & Engineering, Hanny brings more than a decade of experience with Linux and open-source software. He has developed Linux distributions, desktop programs, web applications and much more. All of which attracted tens of thousands of users over many years. He additionally maintains other open-source related platforms to promote it in his local communities.
Hanny is the founder of FOSS Post.