Comment by filefile

11 years ago

Not sure I agree with this recommendation... shared-mime-info database usually trails file(1) database by several years. Case in point: pcap-ng file format was added to file(1) in 2011; was added to mime-info database in 2013.

Also, file --mime FILENAME gets you the mime type.

The file database is not extensible. This means it will not recognize file formats specific to your setup, etc. With the shared-mime-info database, you can have user-wide and system-wide extensions to the database, so installed programs can (and do) install their own mime types. If you need to deal with, for example, a custom image or archive format you can also set that up.

Additionally, the shared-mime-info database is much better curated than the file mime database; file has a lot of wrong mime types (I have gotten a dozen or so fixed so far). If there are file types that are missing from shared-mime-info, please report them on https://bugs.freedesktop.org/ (there are guidelines for good mime type reports, follow those and you can get a fix merged in very fast).