Tried to set the default browser using the GUI tools but this didn't work overall. Is there a way to configure the system wide default browser from command line?
Tried to set the default browser using the GUI tools but this didn't work overall. Is there a way to configure the system wide default browser from command line?
Execute the following command in terminal,to change the default browser.
sudo update-alternatives --config x-www-browser
Sample output:
Press enter to keep the default[*].
Right now I have firefox as my default web browser.
If i want google-chrome as default browser then I will type 3 and hit enter.
Note:
If you want to configure a commandline browser,then you have to configure
sudo update-alternatives --config www-browser
Alternate way is to add the following line
export BROWSER=/usr/bin/firefox
to your~/.bashrc
Add the above line in the last,
Alternative GUI Method:
The already suggested methods might not work for some app (e.g. HipChat).
I've had to do:
It depends a bit on what "default browser" exactly means, i.e. for what purpose you want to change the browser. Some programs ignore any system-wide settings and use their own settings.
That said, you can set the default browser for all programs starting the browser with the generic
sensible-browser
command by exporting theBROWSER
variable, e.g. add a line to the file~/.bashrc
:The other generic way of calling a browser is
x-www-browser
, this one is handled by the Debian "alternatives" system:If you want to configure a commandline-only browser like lynx, you have to configure
www-browser
instead.Googlers, to do this fully scripted (no interaction whatsoever) in a setup script:
…and similary for your favorite editor:
The top two answers here both look promising, yet only one of them worked for me. Have you ever wondered why? For the sake of completeness, this is an official wiki page from Debian:
sudo update-alternatives --config x-www-browser
only shows installed application trough apt-get, for manual installation you can use
Try the following commands:
Additional to those answer google-chrome has usually a symbolic link to the channel-specific version:
For me, today, running Gnome 3,
~/.config/mimeapps.list
is what controlsgnome-open <url>
and Java'sDesktop.getDesktop().browse(new URI(url))
. This is what changes there when I rungnome-control-center
(the "Details" applet in the settings application from the top right menu) and change Default Applications, Web from Google Chrome to Firefox ESR:As hoped, I could revert that from the command line with:
perl -i -wpe 's@x-scheme-handler/http(s?)=firefox-esr.desktop@x-scheme-handler/http$1=google-chrome.desktop@' ~/.config/mimeapps.list
... and put it back with:
perl -i -wpe 's@x-scheme-handler/http(s?)=google-chrome.desktop@x-scheme-handler/http$1=firefox-esr.desktop@' ~/.config/mimeapps.list
For me,
sensible-browser
seems to just call/usr/bin/gnome-www-browser
, which symlinks to/etc/alternatives/gnome-www-browser
, which symlinks to the browser. To change it, I needed to do this:You should put the full path to the browser that you want to use in place of
~/bin/firefox
.Now, when I run
sensible-browser https://example.com
, Firefox opens as expected.