Linux File Type to Opening Program Mappings

I learned a few useful things while helping a chap troubleshoot a problem in #ubuntu-us-mi today. It seems that VLC had taken over as the default program for opening folders and directories on his Ubuntu computer, and he couldn’t figure out how to fix it. He found that if he uninstalled VLC, then the folders opened correctly again, but this was not really a solution as he needed VLC.

After some Googling, I found out where the default programs for each file type are specified, and also where the user-specific programs are set:

System Defaults: /usr/share/applications
User Specific: ~/.local/share/applications

Most GUI programs that can open a file have a .desktop entry in those folders. The actual file type to program mappings are in the following text files:

System Default: /usr/share/applications/defaults.list
User-Specific Overrides: ~/.local/share/applications/mimeapps.list

My mimeapps.list looks like this (note that I have both Ubuntu and Kubuntu installed):
[Added Associations]
application/x-shellscript=gedit.desktop;
application/x-extension-grab=gedit.desktop;
image/x-pcx=firefox.desktop;
application/x-php=gedit.desktop;
application/x-aspx=gedit.desktop;
application/x-executable=userapp-mono-63I5PU.desktop;
application/x-config=gedit.desktop;
text/x-python=gedit.desktop;userapp-mono-63I5PU.desktop;wine.desktop;openoffice.org-writer.desktop;kde4-kate.desktop;gvim.desktop;

In his mimeapps.list, the user had a line like:

inode/directory=vlc.desktop;nautilus-folder-handler.desktop;

After deleting that entry in his mimeapps.list normal behavior was restored.

One other observation is that the line was unchanged when VLC was uninstalled. So Gnome simply skipped over the vlc.desktop when it couldn’t find the program and used the next one in line to open folders.

This entry was posted in grlug, linux, planet-ubuntu-users, tech, wmlug. Bookmark the permalink.