Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

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

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.)

share|improve this question
up vote 6 down vote accepted

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

share|improve this answer
Thx that did the trick – Paul Taylor Nov 29 '12 at 18:33

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.