How to set default browser in Debian via command line

When you click on a link to open any website, it opens in the default browser set by the operating system. Most Linux distributions ship with the Mozilla Firefox browser installed and configured by default. Therefore, if you have never changed the default settings, all your links or URLs will always be open in Mozilla Firefox. However, if you do not like your default browser, there is a way to change it. Linux allows you to change the default browser to open links to websites. First, you will need to install a new browser before setting it by default.

It is very simple to change the default web browser from the graphical user interface. All you have to do is open settings application go to the details select tab Default apps tab, and then select the desired browser from the drop-down menu.

However, in this article we will explain how to set the default browser on Debian using the command line. We will use update alternatives A utility for updating one of the installed browsers by default. This can be very useful for users who access remotely and only have access from the command line.

We used the Debian 10 OS to describe the procedure mentioned in this article.

How to set default browser using command line?

To open a command line or terminal application in Debian 10, go to the “Actions” tab in the upper left corner of the desktop. Then in the search bar enter Terminal when the terminal icon appears, click on it to open.

Now in Terminal run the following command as sudo:

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

You will see a conclusion similar to the one below. From the output, you can see a list of installed browsers on your system. The symbol (*) before the selection numbers indicates the current default browser.

To change the default browser, select the number for the web browser and press Enter to set it as the new default parameter.

Set default browser via command line

The above list by default contains browsers from / Usr / bin catalog. However, if browsers are located in some other place, they can be added to the list of alternatives.

For example, you have a Chromium browser located at / Rigging / drawer instead of / Usr / bin catalog. Using the command below, you can set it as the default browser and also add it to the list of update alternatives for future use.

                      $ sudo update-alternatives --install /usr/bin/x-www-browser x-www-browser /snap/bin/chromium 200

That’s all there is to it! I hope this will be useful when you need to install the default browser on your system using the command line.

How to set default browser in Debian via command line

Related Posts