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 www.google.com
?
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 www.example.com
To open your default browser to a specific URL, run
xdg-open www.example.com
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).
Usage:
In a terminal, drop the next and hit Return
sensible-browser
Passing parameters:
The next command will open youtube.com in your preferred web browser:
sensible-browser youtube.com
How to set my favorite web browser flavour from the terminal?
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
Unattaching from terminal
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] &
Good luck!
You can open Google Chrome from terminal very surprisingly by running
google-chrome
You can also start Firefox by running
firefox
And you can add an URL as a parameter to open it too.
firefox www.askubuntu.com