This question already has an answer here:
I have a PDF file with extension
$ file sample - output
sample: PDF document, version 1.4.)
What is the mechanism of filetype detection in Linux? Windows uses file suffix. I know that there are mime types. Does all popular file formats contain their mimetype in HEX code?