I'm curious how file association management is implemented in Linux. Where is the related information stored? How do I modify it (I'm interested in non-KDE-based ways; I know there's a system configuration page for that in KDE)?

Links to corresponding articles/documentation will be appreciated :)


Most desktop environments use Freedesktop.org MIME Actions spec. Every program has a .desktop file in /usr/share/applications and/or ~/.local/share/applications, providing information about the program and the MIME types it accepts. User's own preferences are kept in ~/.local/share/applications/defaults.list.

URI schemes, such as http: or mailto:, are simply listed as special x-scheme-handler/scheme MIME types. (Older programs may still be using GNOME- or KDE-specific URI scheme databases, though.)

Some "traditional" mail programs, such as Alpine or Mutt, still use the older ~/.mailcap file for determining the best tool to view attachments with. This is partially because they are purely terminal-based, and require different mechanisms.


You can look at the manual (and the actual shell script) for xdg-open. It does check if you are using KDE, Gnome, lxde, and passes the file on to kde-open and so on. If you aren't running any of those, it looks them up using xdg-mime. You can look up information on how this work at freedesktop.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.