Directories keep opening in Firefox when I use xdg-open. I do not want this.

I did:

xdg-mime default dolphin.desktop application/x-directory


xdg-mime default dolphin.desktop inode/directory

Yet, when I try

xdg-open /local

I still get a firefox window. Why is this? I even double checked with

xdg-mime query default inode/directory


xdg-mime query default inode/directory

and both of those commands result in


I don't know if it would make a difference If I have used ssh to control the machine that I am referring to (I am not working on the machine that I am giving these commands, I have used ssh to control it via the terminal of my current machine).

The default program for directories on the machine I am sitting at is File Browser, not dolphin or Firefox, so it seems irrelevant.

  • 4
    You can try to debug by setting the XDG_UTILS_DEBUG_LEVEL env variable to a value greater than 1. If you are using bash: XDG_UTILS_DEBUG_LEVEL=2 xdg-mime query default inode/directory. On my machine, xdg-mime default updated a different file what xdg-mime query was reading. Solved it by removing $HOME/.config/mimeapps.list. – psmith Feb 22 '16 at 14:47
  • @psmith Thank you! I've spent at least an hour trying to debug something similar. I had the same issue with different files on Fedora 22. – Mark Mar 24 '16 at 10:43

In my case the change wouldn't work:

$ xdg-mime default evince.desktop application/pdf

Running with debugging on will show you the files queried:

$ XDG_UTILS_DEBUG_LEVEL=2 xdg-mime query default application/pdf
Checking /usr/local/share//applications/defaults.list and /usr/local/share//applications/mimeinfo.cache
Checking /usr/local/share//applications/defaults.list and /usr/local/share//applications/mimeinfo.cache
Checking /usr/share//applications/defaults.list and /usr/share//applications/mimeinfo.cache

Looking in that last file (where the match was found) gave me a hint:

$ grep application/pdf /usr/share/applications/mimeinfo.cache

It's not called evince.desktop anymore, now it's org.gnome.Evince.desktop!

Once again, now using the new name:

$ xdg-mime default org.gnome.Evince.desktop application/pdf

$ XDG_UTILS_DEBUG_LEVEL=2 xdg-mime query default application/pdf
Checking ~/.config/mimeapps.list

Much better!

  • thanks, it solved my problem. – John Z. Li Dec 11 '19 at 7:44

For me, further to running xdg-mime default caja.desktop inode/directory, it was running

update-desktop-database ~/.local/share/applications/

which finally updated the default application.

After this, running xdg-mime query default inode/directory now showed the new default application.

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.