There may be different mecanisms to handle these default settings. However, other answers tend to focus on complete desktop environments, each of them with its own mecanism. Yet, these are not always installed on a system (I use OpenBox a lot), and in this case, tools such as xdg-open
may be used.
Quoting the Arch Wiki:
xdg-open is a desktop-independent tool for configuring the default applications of a user. Many applications invoke the xdg-open command internally.
At this moment, I am using Ubuntu (12.04) and xdg-open
is available. However, when you use a complete desktop environment such as GNOME, xdg-open
acts as a simple forwarder, and relays the file requests to your DE, which is then free to handle it as it wants (see other answers for GNOME and Nautilus, for instance).
Inside a desktop environment (e.g. GNOME, KDE, or Xfce), xdg-open simply passes the arguments to that desktop environment's file-opener application (gvfs-open, kde-open, or exo-open, respectively), which means that the associations are left up to the desktop environment.
... which brings you back to the other answers in that case. Still, since this is Unix & Linux, and not Ask Ubuntu:
When no desktop environment is detected (for example when one runs a standalone window manager, e.g. Openbox), xdg-open will use its own configuration files.
All in all:
|-- no desktop env. > handle directly.
User Request > xdg-open > --|
|-- desktop env. > pass information to the DE.
If the first case, you'll need to configure xdg-open
directly, using the xdg-mime
command (which will also allow you to see which application is supposed to handle which file). In the second case...
|-- GNOME? > gvfs-open handles the request.
|
Info. from xdg-open > --|-- KDE? > kde-open handles the request.
|
|-- XFCE? > exo-open handles the request.
... you'll need to configure the file-opener associated with your desktop environment. In some cases, configuration made through xdg-mime
may be redirected to the proper configuration tool in your environment.