How to find the default file manager?

There is no such thing as a "Default File Manager for Linux". It all depends how you might be trying to open one. If you ask XDG, then you'll have to check what XDG thinks this file manager should be. Same deal for any other "environment", such as Gnome, or KDE. If you have all of them installed, it's perfectly possible (and fine) for each of them to have a different "default file manager".

The case for default apps seems to come mainly from Windows. Over there, we only have one environment, the one Windows presents us with. As such, the notion of a default application is indeed effectively system wide. This is not the case with Linux.

What you might perceive as default apps under Linux, such as what is stored in the $EDITOR environment variable, is not as much a "true" default app, as simply a convention used by a lot of people who write system tools and scripts. Feel free to define $FILEMANAGER, if that suits your use case.


Use the xdg-mime command to this. xdg should be desktop-environment agnostic (eg xdg-open will pass the arguments on to the correct file opener). To get the default file manager use:

xdg-mime query default inode/directory

Source


You can use xdg-open <DIR> to launch the file manager on a directory. You might be able to query some xdg application to find out what file manager is used.


i just came accross the same problem. (i would rather like to comment but my reputation isnt high enough)

i tried xdg-open and it startet EasyTag which is a id3-tag-editor (somehow funny) :-)

i tried Gerhard Burgers answer

xdg-mime query default inode/directory

and that returned dolphin.desktop in my case.

so in my case the correct solution was (replacing ".dektop" with ""):

xdg-mime query default inode/directory | sed 's/.desktop//g'

but i only testet this on this system i am running