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?
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/mimeinfo.cache. The tool which allows to edit it is
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.
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.