in reply to Cross-platform open document

Linux uses MIME types, see Internet media type

On my system (Slackware 13.0) there is a MIME database in /usr/share/mime

Update:

"GNU/Linux" systems with GNOME or KDE, use MIME types to determine the type of the file and from the system and user preferences choose the application used to open that file, if a mapping if defined for that particular type of file.

Replies are listed 'Best First'.
Re^2: Cross-platform open document
by afoken (Chancellor) on Feb 28, 2010 at 18:29 UTC

    To be precise: No, Linux does not use MIME types.

    Linux is "just" an operating system kernel. The userland tools around it do not use the MIME types, either. The Free Desktop Project uses MIME types, so desktop environments like Gnome and KDE that use that standard can use the shared MIME database. But as I already said, not every desktop environment uses that standard or the database.

    Oh, and there is no information in /usr/share/mime about which application is able to open a resource (file) with any given MIME type. Just look at /usr/share/mime/text/html.xml. If /usr/share/mime was the right place to look at, I should be able to find the name of my prefered browser in that file. But there is no application listed at all, and that is not the purpose of this database.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

      True, not "Linux" but "GNU/Linux" as a generic name for the entire system, more specifically those systems with GNOME or KDE.

      Of course CLI tools doesn't need and can't use MIME, that is only for graphical desktop interface apps.

      The database is for "looking up the correct MIME type..."

      The user preferences (such as a user's preferred application for handling files of a particular type) are stored in the home dir of the user.

      "There is no information in /usr/share/mime about which application is able to open a resource (file) with any given MIME type."

      Not entirely true, from the link you provided:

      "It may be used to store static information, such as that files of a certain type may be viewed with a particular application."

      Regards, Stefan

        CLI tools doesn't need and can't use MIME, that is only for graphical desktop interface apps

        My mutt (which I wouldn't consider a graphical desktop app) nicely makes use of MIME types... :)  — more specifically, it uses ~/.mailcap and/or /etc/mailcap plus ~/.mime.types and/or /etc/mime.types for viewing/handling attachments.

        </nitpick>