how can I change file association globally?
Seems like the answer here
is actually the easiest, specifically going to a file's properties, going to the "open with" tab, and then setting as default for that file type. Here's the picture:
This answer only works in Ubuntu 16.04 or prior; the comments have a link to a Xenial release of Ubuntu-Tweak. In newer versions of Ubuntu this will not work as Ubuntu-Tweak is no longer supported by the author.
Comments have suggested that Chris Marx answer below is the right way, but it does not resolve the answer of administrative management - for example, setting the type for many items.
Note: Ubuntu 16.04 is still LTS and Ubuntu 14.04 is not EOL
The EASIEST way for you to do this would be to install the program Ubuntu Tweak.
- How do I install Ubuntu-Tweak?
- http://www.ubuntuupdates.org/package/getdeb_apps/xenial/apps/getdeb/ubuntu-tweak
Once you have it downloaded you simply open it up, change to Admins tab and then under System choose File Type Manager. Once in here select the file category Text and using shift-click and/or control-click select all of the file types you want, then click Edit on the bottom right.
This will allow you to multi-set the mimetype opener for all of the files.
See screen:
speaking about how things works globally, for the entire system, the most important thing is
/usr/share/applications/defaults.list
which is the file that holds the associations between a given mime type and the application that is supposed to handle that kind of file.
If you don't know the mime type of a file simply use the command
mimetype
like so
mimetype img.jpg
img.jpg: image/jpeg
text files, python scripts, web pages, usually any given file has its own mime type.