4 ms·
UNIX systems, like Mac OS and Linux, use file[0] (or libmagic behind it), to determine the format of the file. (or shebang, if the file has one.) [0] https://e
by tiagod 3y ago
UNIX systems, like Mac OS and Linux, use file[0] (or libmagic behind it), to determine the format of the file. (or shebang, if the file has one.)
[0] https://en.m.wikipedia.org/wiki/File_(command) https://en.m.wikipedia.org/wiki/File_(command)
- wongarsu 3y agoFile extensions were the primary way to determine file type in VMS and CP/M. Consequently MS-DOS and Windows inherited that behavior. As you said, UNIX always went with heuristics based on the file content instead (and is the primary reason many file formats have fixed bytes to aid that process). And the web standarized on mime types transferred in the metadata, with how to set them correctly left as an exercise to the reader. Which usually means they are set based on file extension because that's faster.