I'm working on different Linux distributions.

In my .bashrc I'd like to set up an alias that opens a window of the default file manager (e.g. nautilus, nemo, pacman, ...).

Is there a way find out what the file-manager of a session is? (It does also depends on the session, doesn't it?)

  • 9
    xdg-open . works in all desktop environments using the default file manager
    – Rahul
    Commented Aug 9, 2016 at 12:14

2 Answers 2


As comments have already stated, you're probably better off with xdg-open (no alias needed), but to answer the question: You can use xdg-mime to query and set default applications. To get the default file manager:

xdg-mime query default inode/directory

Read more about this topic in the xdg-mime manual or the Arch Wiki.


No, you can't.

Or at least there's no simple magic command for guessing what's the current desktop's default file manager.

All what xdg-open or xdg-mime query will do or tell you, is what has been associated to the desktop object type "folder" (inode/directory type), for the action "open". This is neither what defines a file manager in general, nor what defines what's the desktop's default one or what you expect.

What is associated to the inode/directory type could be whatever application you've installed that associates itself to directories (audacious does it - is that the file manager you'd expect? it's not the only one).

  • KDE even calls the setting default applications -> file manager. It is safe to assume that next to no one would choose audacious as default file manager. I've flagged your answer, as it is kind of opposite to a constructive answer. Commented Mar 9, 2022 at 5:38
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Mar 9, 2022 at 5:41
  • The tool associated with the action "open" for directories is the default file manager. That is precisely how it is defined, how else? If the user has changed the default, then that is what they want to open. It's the same mechanism that decides what to do if a user double clicks on a directory on their Window Manager's desktop.
    – terdon
    Commented Mar 9, 2022 at 10:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .