How to change the applications associated with certain file-types for gnome-open, exo-open, xdg-open, gvfs-open and kde-open?

  1. Is there a way by editing config files or by a command-line command?
  2. Is there a way to do this using a GUI?

For both questions: How to do it per user basis, how to do it system-wide?


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.