Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I do

xdg-open demo.odt

Libre Office opens - as it should. When I do


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


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.