For different purpose, we often have multiple browsers installed on our system.
Like I use Chromium browser as daily driver, and Firefox for banking and financial transactions. Also most of us don't want to open every link on a single browser.
That's when you need to set a system default web browser for daily usage, and install few other for other tasks.
In this article I'll discuss about how you can set default browser on any Linux distributions.
This could be done in many different ways with varying results. I'll discuss about some of the most used techniques. Let's get started.
Contents
Set default browser with xdg-settings
To change default browser on Linux, use the xdg-settings command.
As an example, to set Chromium as system default browser, use
xdg-settings set default-web-browser chromium-browser.desktop
You can get list of available applications under the /usr/share/application directory.
Another example, to set Falkon as default browser, use the command below.
xdg-settings set default-web-browser org.kde.falkon.desktop
Note: If the $BROWSER environment variable is already set, the above commands with XDG wont work. You need to unset it first. Use unset BROWSER
to unset it.
You can get the currently set default browser by running this command. > xdg-settings get default-web-browser
Change default browser with update-alternatives
Another command is update-alternatives
.
To change default browser, run the update-alternatives command like below.
sudo update-alternatives --config x-www-browser
Obviously the command will ask for the user password, after that it will list all available browsers on your system with a numbered list.
From that list. choose your preferred browser and set it via the particular number.
As example I choose 0 to set Falkon as default, which was the already default by the way.
Note that this command uses sudo, so the change is system wide.
Conclusion
Application defaults can be set or changed very easily via some graphical programs too. These tools are preinstalled if you're using a full-blown Gnome or KDE desktop.
SO, that's all about how you can change default browser for Linux using the command line tools. Leave comments if you've any suggestions or question.
Leave a Reply