How to Open HTML File Using Bash
In this article, we will learn about opening an HTML file with the default browser using Bash on Mac.
Open a HTML File Using Bash
To open a .html
file, first, we need to create a filename with the .html
extension.
Example:
We can see that we’ve created a .html
file using the touch
command. Three .html
files are available in that folder, which we see using the ls
command.
We need to open either of the available .html
files in that folder. To open the test.html
file, we need to use the following command, being in the same directory where there is the .html
file.
Command:
open ./test.html
We can also use the man
command:
man open ./test.html
Note that the default application is determined via LaunchServices
.
We can also use the open command with the -a
flag to open a file or location in any targeted application (Google Chrome).
Command:
open -a "Google Chrome" index.html