Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

On my Gentoo box running without a desktop environment, every time I try to open a file the system tries to open it with Firefox. I understand that without a desktop environment "open file" cannot function correctly, but why is everything opened with Firefox? If I want to, can I change it to something else?

share|improve this question
    
How are you trying to open the file? Under most unices, this is a per-application concept, not a generic OS concept. –  Gilles Dec 21 '10 at 20:31
    
@Gilles I tried in various ways: double-clicking from pcmanfm, clicking from the downloaded section of chromium, executing xdg-open. Firefox always comes up. –  phunehehe Dec 22 '10 at 1:17
    
Chromium and xdg-open both use the FreeDesktop database. I don't know about pcmanfm. –  Gilles Dec 22 '10 at 18:53

2 Answers 2

up vote 5 down vote accepted

Usually this information is handled in 2 places:

  • Application .desktop files advertise what program can open
  • MIME database which specifies what application should be used to open file with specific MIME

The MIME database can be customized by editing .local/share/applications/mimeapps.list and .local/share/applications/mimeinfo.cache. The tool which allows to edit it is xdg-mime from x11-misc/xdg-utils. Please beware that man states it can be used only from inside desktop session.

Edit Please note that some applications, like Firefox, do not respect the MIME database settings.

share|improve this answer
    
That's the FreeDesktop MIME database. Other applications might use the system database (/etc/mailcap, ~/.mailcap); Firefox has its own proprietary database. –  Gilles Dec 22 '10 at 18:54
    
I know it under name of MIME database (sounds completely different then FreeDesktop MIME database). As Freedesktop is set of standards for X desktop environments I don't think I was wrong to present is as standard - and I did mentioned not all apps respect it. –  Maciej Piechotka Dec 22 '10 at 19:00
    
Thanks for the right direction. The default application list is at .local/share/applications/defaults.list (which is also what xdg-mime edits). –  phunehehe Feb 15 '11 at 15:35

The command file -i <filename> might be useful for the cases when one does not know the specific mime type of a particular file. Once established it may be used as an input to xdg-mime utility to set the default open command.

dev-perl/File-MimeInfo ebuild constains mimeopen utility. It is a wrapper around the mentioned above commands.

share|improve this answer

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.