Is There a Way to Open Browser Using Terminal? [Duplicate]

Is there a way to open Chrome (or other browser) using terminal?

Something like: $ chrome ?

1

3 Answers

From: Terminal command to open URL's in default and non-default browser (which I don't think is a duplicate)

If you want to open Chrome to a specific URL, just run

google-chrome 

To open your default browser to a specific URL, run

xdg-open   

If you need to run Chrome and close the terminal window afterward, run

google-chrome  </dev/null >/dev/null 2>&1 & disown

>/dev/null 2>&1 will prevent messages from the browser to be outputted to the terminal's window; & will put the process into the background and disown will remove the job / process from the job list, preventing a SIGHUP signal to be propagated to it.

To do this with another browser simply replace google-chrome with that other browser's executable name.

8

sensible-browser seems to be the option you're looking for. This will run the web browser set as default on your system, you can also pass parameters on it in order to run the web browser and open the given website(s).

Usage:

In a terminal, drop the next and hit Return

sensible-browser
Robert Thorne

Robert Thorne

Automotive & Future Transportation Editor

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.