File associations in Linux (Gnome and Mailcap)

Linux
Author

Vinh Nguyen

Published

March 3, 2011

File associations in Linux can be tricky. On my Gnome-based Ubuntu machine, I can associate a filetype by right-clicking a file in Nautilus, and slecting "Open with". To modify the defaults using config files, this post describes it well. Basically, the two main locations to check out are /usr/share/applications/defaults.list and ~/.local/share/applications/. File associations made using these methods apply to the commands gnome-open and xdg-open as well.

File associations in the command line is mainly done via MIME types (I think). At least file associations in conkeror, org-mode's org-open-at-point (also look at org-file-app), and the see commands are done by MIME. MIME handlers are defined in a user's ~/.mailcap file.

I think this information is enough to modify default apps throughout Linux. Do see this post where I outline how I launch all my files using Emacs' dired mode. Now I can launch apps more uniformly in Nautlius, Emacs, and on the command line based on configuring default apps.