Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question

3 Answers 3

up vote 13 down vote accepted

Execute the following command in terminal,to change the default browser.

sudo update-alternatives --config x-www-browser

Sample output:

karthick@Ubuntu-desktop:~$ sudo update-alternatives --config x-www-browser 
There are 3 choices for the alternative x-www-browser (providing /usr/bin/x-www-browser).

  Selection    Path                    Priority   Status
------------------------------------------------------------
  0            /usr/bin/google-chrome   200       auto mode
* 1            /usr/bin/firefox         40        manual mode
  2            /usr/bin/google-chrome   200       manual mode
  3            /usr/bin/opera           90        manual mode
  • 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,

    enter code here

Alternative GUI Method:

  • You can also set the default browser in Gnome applications,type the following in terminal and press Enter gnome-default-applications-properties
  • It will Open a Window.Now you can choose your preferred browser to set it default. alt text
share|improve this answer
1  
Another brilliant answer. :-) –  Stefano Palazzo Dec 8 '10 at 13:42
    
My gnome-www-browser is a link to epiphany, my x-www-browser is a link to chromium, but the right click in the terminal (gnome-terminal and terminator) opens the url with firefox :( –  Arpad Horvath Apr 10 '12 at 8:51

Try the following commands:

sudo update-alternatives --config x-www-browser
sudo update-alternatives --config www-browser
share|improve this answer

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 the BROWSER variable, e.g. add a line to the file ~/.bashrc:

export BROWSER=/usr/bin/firefox

The other generic way of calling a browser is x-www-browser, this one is handled by the Debian "alternatives" system:

sudo update-alternatives --config x-www-browser

If you want to configure a commandline-only browser like lynx, you have to configure www-browser instead.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.