The UNIX command line’s
file utility, present in OS X’s Terminal, has a handful of nifty file-identification tricks up its sleeve, my current favorite being automatic MIME type discovery with the
-i flag. From the man page:
-i Causes the file command to output mime type strings rather than the more traditional human readable ones. Thus it may say ``text/plain; charset=us-ascii'' rather than ``ASCII text''. In order for this option to work, file changes the way it handles files recognised by the command itself (such as many of the text file types, directories etc), and makes use of an alterna- tive ``magic'' file. (See ``FILES'' section, below).
It reacts rather hilariously to directories, though.
Chloe:~/Desktop clarko$ file -i "naked ladies" naked ladies: application/x-not-regular-file
Not a regular file, huh? You bet it’s not. I’m almost compelled to start serving random files from my server with that MIME type, throwing in an
x-friggin-awesome-file or two just for good measure.