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

applicationbrowserhtmlmime-types

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

Best Answer

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

Related Question