How Ubuntu or any other Linux systems store file associations?
Is there some /etc/asscociations file? or something?
I know that I can right click on file and change it via "open with". But I'm just curious to know how it's stored internally.
Thanks
|
How Ubuntu or any other Linux systems store file associations? Is there some /etc/asscociations file? or something? I know that I can right click on file and change it via "open with". But I'm just curious to know how it's stored internally. Thanks |
||||
|
|
|
The file manager (Nautilus, by default) uses the MIME type of a file to determine which program to open it with.
When an application is installed, it can specify what MIME types it can open and the command to use to open the files in the .desktop file which is placed in For example, GIMP has the following .desktop file:
See the When the application package is installed, the system extracts this MIME type data into a more easily accessible database because looking in each .desktop file would take too long if it was done every time a file was opened. This tells the system what applications can be used for that MIME type and provides the applications in the 'Open With' list. The default is defined elsewhere. The file |
|||||||||
|
|
To supplement dv3500ea's excellent answer, I would like to add some information about what happens when you change your associations. While the defaults.list (which you can find by typing 'locate defaults.list') provides the list of applications that are associated with each MIME type, any customizations that you make are stored in your home directory, in ~/.local/share/applications/mimeapps.list. So if you add or remove associations, or change the default association, this file is updated. The GNOME Desktop System Administration Guide at http://library.gnome.org/admin/system-admin-guide/stable/ does not appear to discuss mimeapps.list, but I found the following description on http://live.gnome.org/SysAdminGuideUpdate:
|
|||
|
|
Create a file
then edit the file
I found out the mime type of Truecrypt by following running this command:
|
||||
|