Identifying file type without extension

less than 1 minute read

I received an email attachment, with no filename extension because of the spam filters in corporate email. I “knew” it was a legitimate file because I had just requested it from a notable researcher. Rather than bother the sender to tell me the original file extension, I determined the file type by:

file emailedfilename

which gave output

gzip compressed data, from Unix

Thus I changed the filename to be emailedfilename.tar.gz since a gzip’d file almost always contains a tar archive, and I could extract the files.

uncompress without extension

Note that tar is smart enough even with the wrong file extension to work, so I could have instead just done

tar -xf emailedfilename

Categories:

Updated:

Leave a comment