How to change priorities of x-www-browser – update-alternatives

If you have multiple browsers installed on your Linux systems such as Ubuntu or Debian, then we can use the Update alternatives command to change their priority. 

Update Alternatives is the command available on Linux to change the default program preference using the terminal. We can use it to create, remove, maintain, and display information about the symbolic links comprising the Debian alternatives system.

Although, sometimes even after changing the app’s default value, still it not works. For example, you set Chrome as the default browser, and at the time of opening some link on the system, it selects firefox.

It is because of the priority value set by the apps on our system. Here we learn the command to change the priority of applications using the Update Alternatives command.

Check for Installed Browsers on your Linux

Let’s first check for what are the installed browsers on our system. For that we can see:

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

If you get an error:

update-alternatives: error: no alternatives for x-www-browser

Then this means, you would have only one installation of the browser. Try to install one more. For example, by default firefox will only be there, you should install some other browser as well.

Check for Installed Browsers on your Linux

Change the priority of the x-www-browser

Now, to change the priority of the browser you want, for example, let’s say you want to change the Chrome stable’s priority from 200 to 30, then the command syntax will be like this:

sudo update-alternatives --install /usr/bin/x-www-browser x-www-browser path-to-browser  priority_number

The above syntax is just, for example, to use it you have to add the path to the browser that priority you want to change along with the priority number you want to assign.


sudo update-alternatives --install /usr/bin/x-www-browser x-www-browser /usr/bin/google-chrome-stable 30
Change the priority of the x www browser

Other Articles:

How to install Google Chrome in RHEL 9 / 8 Linux
Install Python 3.9 or 3.8 on Ubuntu 22.04 LTS Jammy JellyFish
Installing VMware Workstation 17 Player on Ubuntu 22.04 LTS
6 Best Ubuntu Linux Alternatives for Beginners

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.