Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

as a Linux user, I see that some applications can request a path to be opened and this causes a file manager to be launched. I'd like to do this programmatically, but how can I know which is the default file manager? Is there a way to find this info? Any environment variable? By "file manager", I mean applications that allow you to administer your files: create, rename, create folders, etc., like Nautilus (in GNOME) or Dolphin (in KDE).

Thanks in advance!

share|improve this question
add comment

3 Answers

up vote 3 down vote accepted

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.

share|improve this answer
    
I was thinking there might be an environment variable for this, and actually thought about defining one. Nice answer, thank you very much. –  Mauren Aug 23 '12 at 19:35
    
I think you mean XFCE instead of XDG? –  Gerhard Burger Mar 18 at 15:36
    
add comment

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.

share|improve this answer
    
Thanks for the hint. I will try to use this to solve my problem. –  Mauren Aug 23 '12 at 19:36
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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