Setting default browser in system


There are 4 different browsers installed in my system and I want to set iceweasel as default browser. So, I select iceweasel as the default one with the command below:

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

But sometimes urls opened with another browser. What is the reason for this unstable behaviour?


When you set default browser with update-alternatives on x-www-browser keyword it just replace the /usr/bin/x-www-browser symbolic link. After that, if a program or script has a routine like that for opening browser:


It will be opened on your selected browser.

But mosf of the programs doesn’t rely on x-www-browser executable, they use xdg-open for this (see manpage of xdg-open) If some other browser selected for xdg-open, programs using this facility will open urls in the browser which is default for xdg-open. You can learn the default browser with:

xdg-settings get default-web-browser

You see something like that google-chrome.desktop, iceweasel.desktop etc. not just the name of the browser. For example if you want to change selected browser to iceweasel, you can do this with:

xdg-settings set default-web-browser iceweasel.desktop

And if you want to list other available .desktop files, you can list directory entries for /usr/share/applications