Xdg-open not opening file manager Nautilus as default instead open VLC

xdg-open . always used to open Nautilus file manager unless if I open a video or image file then it would open respective application. But its been changing itself. It then started to open in Vscode and now it opens in VLC. Why its changing randomly? How do I fix it?

Please check the video snippet below. Thanks.

You can check the mime type of . with mimetype . . This should be the output:

.:     inode/directory

Now you can check the output of xdg-mime query default inode/directory. If its not nautilus, you can make it the default with:

xdg-mime default nautilus.desktop inode/directory

Also why not use nautilus /home/file.txt ?

I tried mimetype . but mimetype is not found.

I tried xdg-mime query default inode/directory and below was the output


org.gnome.Nautilus.desktop file in /usr/share/applications

Still it is not working.

Check this file:

grep "directory" ~/.config/mimeapps.list 

However… you can change the default application in nautilus.

Rightclick → “Open with Other Application”

And it will save the last application you have chosen.