Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

When I do

xdg-open demo.odt

Libre Office opens - as it should. When I do

xdg-open http://askubuntu.com

my browser opens - as it should. But now I'd like to have a command where I do

mime-based-xdg-open http://www.someserver/demo.odt

and Libre Office would open with the URL on the command line. Is there a way to figure out what xdg-open would use for a specific extension or mime-type? Then I could construct a script that does the rest.

share|improve this question

1 Answer 1


xdg-mime query default MIMETYPE

to get your desktop's default app for opening files with mime-type MIMETYPE

To get the mime-type of file FILE (not an URL) use

xdg-mime query filetype FILE
share|improve this answer

Your Answer


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.