4

I have a PDF file with extension .pdf. If I remove .pdf - the file is still recognized as PDF file ($ 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?

yanpas
  • 257

1 Answers1

5

The detection is done through libmagic which looks for specific byte sequences with magic numbers.

don_crissti
  • 82,805
Jesusaur
  • 354