Change default applications used by gnome-open, exo-open, xdg-open, gvfs-open and kde-open

It's all done with MIME types in various databases. xdg-mime can be used to query and set user values.


I had the same problem today, but more towards the gnome/cinnamon side of things.

You can query and change the default mime type like this:

gvfs-mime --query inode/directory

gvfs-mime --set inode/directory nemo.desktop

Building on @Ignacio Vazquez-Abrams answer, here are the incantations for the impatient that should cover many typical use cases:

Figure out the mime type of your file:

xdg-mime query filetype somefile.pdf

will result in application/pdf.

Set a default application to handle it:

xdg-mime default qpdfview.desktop application/pdf

where I use qdfview's desktop definition as the program to handle PDFs.