How do get an html file to open in preferred application from command line on linux?

I have an xterm window open and an html file I want to do something like

open test.html

and that will start my preferred browser with the test.html file loaded.

(I'm looking for a solution that will work for any Linux desktop machine without me needing to know which browser app they have installed.)


That's OS/distribution/desktop-environment dependent, but in many places, you'll find a xdg-open command that does just that.

  • Thx that did the trick – Paul Taylor Nov 29 '12 at 18:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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