Is there a way to open Chrome (or other browser) using terminal?
$ chrome www.google.com ?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
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
To open your default browser to a specific URL, run
If you need to run Chrome and close the terminal window afterward, run
google-chrome http://www.google.com </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.
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).
In a terminal, drop the next and hit Return
The next command will open youtube.com in your preferred web browser:
Simply drop the next command in a terminal, hit Return and choose wisely:
sudo update-alternatives --config x-www-browser
In the next example I am choosing
luakit as my default browser. You can change your default web browser as many times as you wish.
geppettvs@T400:~$ sudo update-alternatives --config x-www-browser There are 5 choices for the alternative x-www-browser (providing /usr/bin/x-www-browser). Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/bin/google-chrome-stable 200 auto mode 1 /usr/bin/firefox 40 manual mode 2 /usr/bin/google-chrome-stable 200 manual mode 3 /usr/bin/konqueror 30 manual mode 4 /usr/bin/luakit 10 manual mode 5 /usr/bin/xlinks2 69 manual mode Press enter to keep the current choice[*], or type selection number: 4 update-alternatives: using /usr/bin/luakit to provide /usr/bin/x-www-browser (x-www-browser) in manual mode
If you wish to keep your web browser running just after you close your terminal, simply add an ampersand symbol at the end of your command:
sensible-browser [parameters] &