• RSS
  • subscribe
  • twitter

How to Set the Default Browser on Ubuntu From the Command-Line

My Ubuntu 9.04 “Jaunty” will soon explode with the growing number of web browsers I dump into it each day and punctually each newly installed web browser has this message when you run it the very first time run it; “Make me your default browser”. I just ignore the message cause I’m never really sure which browser should be the default --at times i change the default twice, thrice a day. The easy way to do it on my Ubuntu is from the command-line, its faster and easier than using the GUI tool.  

To change the default or re-confirm the default browser drop the line of code in the terminal (command-line) , we’ll use the update-alternatives command.

1
$ sudo update-alternatives –config x-www-browser

You’ll see something very similar to what I have below

1
2
3
4
5
6
7
8
9
10
11
There are 5 alternatives which provclasse `x-www-browser’.

  Selection    Alternative
———————————————–
          1    /usr/bin/firefox-3.0
          2    /usr/bin/firefox-3.5
          3    /usr/bin/google-chrome
*+        4    /usr/bin/opera
          5    /usr/bin/chromium-browser

Press enter to keep the default[*], or type selection number:

Right now I have Opera 10 browser as my default web browser

If I want, say google-chrome as default browser then just type-in 3 and hit enter. You’re done. Till the next time you want to change your default browser.

7 Comments;

  1. Martin Kaba
    2:35 am on September 17th, 2009

    How to Set the Default Browser on Ubuntu From the Command-Line http://su.pr/7nnVpL

  2. ???
    9:05 am on September 17th, 2009

    How to Set the Default Browser on Ubuntu From the Command-Line http://j.mp/AwJEl

  3. lefty.crupps
    1:48 pm on September 17th, 2009

    This changes the system’s default browser, but does this affect the users? If so, wouldn’t it affect every user’s account on that computer?

    On a single-user computer that is no big deal, but GNU/Linux is a multi-user OS. I would be very annoyed to sit down and learn that someone has changed my browser so that their own default is changed as well.

  4. Sanay Jay
    2:17 pm on September 17th, 2009

    @LEFTY.CRUPPS: Well, just take off the “sudo” so you don’t use the admin account and it won’t affect the other users in a multi-user system.

  5. Bharat Ojay
    9:06 pm on September 17th, 2009

    How to Set the Default Browser on Ubuntu From the Command-Line http://su.pr/7nnVpL

  6. lefty.crupps
    2:16 pm on September 18th, 2009

    > just take off the “sudo” so you don’t use the
    > admin account and it won’t affect the other users

    This doesn’t work, as the command is designed only to be run as root (aka the admin account).

    In KDE the default browser is changed in System Settings > Default Applications; from the command line one would have to edit the file ~/.kde/share/config/kdeglobals and change the line for
    > BrowserApplication[$e]=!/usr/bin/whatever

    to read, to set Iceweasel as default for example:
    > BrowserApplication[$e]=!/usr/bin/iceweasel

    For GNOME, I have no idea.

  7. Gemma
    12:52 am on June 16th, 2011

    I’m completely clueless about linux, so sorry if this is a really dumb question, but I tried to change it using this and when I type in “config” it says “command not found”… even though it shows it as one of the commands right before it says that. What should I do?