Home Beginner's Guide How to change default browser on Linux

How to change default browser on Linux

This guide provides a step-by-step process on how to change your default browser in Linux. By the end of this guide, you'll have the knowledge to customize your Linux web browsing experience to align with your preferences.

by Kiran Kumar
changing your default browser in linux

Now, this might seem like a trivial task, but believe me, when you’re bouncing between numerous applications, a streamlined browsing experience can significantly boost your productivity. Before we dive in, let’s talk about web browsers for a bit. We all have our preferences, right?

Personally, I have a soft spot for Firefox due to its commitment to privacy. However, I can’t deny the speed and simplicity that Chrome brings to the table, even if I grumble about its occasional heavy resource usage. But no matter what browser warms your heart, Linux accommodates it. That’s the beauty of this OS.

Understanding the need for a default browser

Why bother setting a default browser? Why not just click on your browser of choice each time? Well, it comes down to how integrated our online and offline work has become. Clicking on links in emails, documents, chat apps, they should lead to your preferred browser, offering a consistent, smooth experience. And to ensure that, setting a default browser is vital.

Finding your current default browser

Before you change your default browser, it’s a good idea to check what your current one is. It might already be the one you prefer!

To do this in Linux, open your terminal. You can typically find it in your applications menu or launch it using the keyboard shortcut Ctrl+Alt+T.

Enter the following command and hit enter:

xdg-settings get default-web-browser
display current default web browser

Finding default web browser

This command will display the current default browser. If it’s already your favorite one, you’re all set! If not, let’s move forward.

Will xdg-settings command work on all Linux distros?

The xdg-settings command is part of the xdg-utils package, which is designed to provide a standardized way of managing settings across different Linux distributions. The package is typically installed by default on most distributions that use the X Window System, including Ubuntu, Fedora, Debian, and many others. Therefore, in many cases, the command xdg-settings get default-web-browser should work.

However, there can be exceptions. Some lightweight distributions or those designed for more advanced users might not include xdg-utils by default. In such cases, you might need to install the xdg-utils package first. For instance, in Arch Linux, you would use the command sudo pacman -S xdg-utils to install it.

Furthermore, even though xdg-utils is intended to be universal, not all desktop environments adhere strictly to XDG standards. So, the xdg-settings command might not work in some less common or highly customized environments.

Lastly, remember that xdg-settings is specific to graphical environments. If you’re using a non-graphical, command-line-only interface, you wouldn’t use xdg-settings to manage your default applications.

Installing a new browser

Is your browser of choice installed on your system? If it’s not, you’ll need to do this first. As an example, let’s install Firefox, which is not always included by default in every Linux distribution.


First, update your package list:

sudo apt-get update

Next, install Firefox:

sudo apt-get install firefox
installing firefox on pop! os

Installing Firefox on Pop!_OS

Just replace ‘firefox’ with the package name of your desired browser if you’re looking to install something different.

Changing your default browser on Ubuntu

Once your desired browser is installed, it’s time to set it as default. The command varies slightly depending on the browser.

If you want to set Firefox as your default, use:

xdg-settings set default-web-browser firefox.desktop
changing default to firefox and verifying it

Changing default to Firefox and verifying it

Or if you prefer Google Chrome:

xdg-settings set default-web-browser google-chrome.desktop

You might need to replace ‘firefox.desktop’ or ‘google-chrome.desktop’ with the actual name of your browser’s .desktop file, particularly for less common browsers.


In Fedora, you can use the GNOME GUI to change your default browser, similar to the GNOME example I previously gave. However, if you prefer the terminal, here’s how you’d do it:

Install your browser of choice using dnf, the package manager in Fedora. For example, to install Firefox, you would use:

sudo dnf install firefox

Changing your default browser on Fedora

Set your default browser using the xdg-settings command, just like in Ubuntu. The .desktop file names should be the same across distributions:

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

Arch Linux

Install your browser using pacman, the package manager in Arch Linux. For Firefox:

sudo pacman -S firefox

The xdg-settings command isn’t installed by default in Arch Linux, but you can use it by installing xdg-utils:

sudo pacman -S xdg-utils

Changing your default browser on Arch Linux

Then, you can set your default browser as usual:

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


Install your browser using zypper, the package manager in openSUSE. For Firefox:

sudo zypper install firefox

Changing your default browser on openSUSE

Set your default browser using xdg-settings. The command should be available by default in openSUSE:

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

Verifying the change

After you’ve set your default browser, it’s always a good idea to verify the change. Use the command you initially used to find your default browser:

xdg-settings get default-web-browser
changing default browser from firefox to chrome and verifying it

Changing default browser from Firefox to Chrome and verifying it

If the change was successful, it should display your new default browser.

Pro tips

Now that we’ve covered the basics, let’s spice things up with some Pro Tips.

Tip 1: Finding the .desktop file name

If you’re using a less common browser and aren’t sure of the .desktop file name, don’t fret. A effective method would be to list all .desktop files in the /usr/share/applications/ directory using ls /usr/share/applications/. This command will list all .desktop files, and you can look for the name of your browser in this list.

For example, the .desktop files for Google Chrome and Firefox are usually named google-chrome.desktop and firefox.desktop, respectively. Other browsers might have different names for their .desktop files.

listing all applications

Listing all installed applications

Once you’ve identified the correct .desktop file, you can use it with the xdg-settings set default-web-browser command to set your default browser. For instance, if you found that the .desktop file for your browser is named brave-browser.desktop, you would use the command:

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

Always remember to replace brave-browser.desktop with the actual .desktop filename for your preferred browser.

Tip 2: Using GUI to set default browser

Are you more comfortable using a graphical interface than the terminal? You can change your default browser this way, too. The exact steps depend on your desktop environment.

In GNOME, for example, you would:

Go to the “Applications” overview (usually by pressing the Super/Windows key).

Search for and open “Settings” (sometimes labeled as “System Settings” or “Details”).

opening settings

Go to the “Default Applications” section.

Change the “Web” setting to your desired browser.

changing default web browser on pop os

Changing Default Web Browser on Pop_OS

This process might feel more intuitive if you’re used to other OS environments, like Windows or macOS.

Tip 3: Manually editing the .desktop file

Sometimes, you may find that the ‘xdg-settings’ command isn’t working. In that case, you can manually edit your browser’s .desktop file. It’s usually located in ‘/usr/share/applications/’.

In the file, look for a line starting with ‘MimeType=’. Make sure it includes ‘x-scheme-handler/http’ and ‘x-scheme-handler/https’. These settings tell Linux to use this browser for HTTP and HTTPS links, respectively.

For those looking for more detailed steps, let’s elaborate on manually editing the .desktop file.

Caution: Please bear in mind that editing these files should be done with caution, as incorrect changes could cause issues with your applications. Always back up the original .desktop file before making any changes.

Here’s a step-by-step guide:

Locate the .desktop file of your preferred browser. This file is typically found in /usr/share/applications/. Use the ls command to list all .desktop files:

ls /usr/share/applications/

Look for the file corresponding to your browser. For instance, Chrome’s .desktop file is usually google-chrome.desktop.

Backup the .desktop file. Before making any changes, it’s a good idea to create a backup of the .desktop file:

sudo cp /usr/share/applications/google-chrome.desktop /usr/share/applications/google-chrome.desktop.bak

Edit the .desktop file. Open the .desktop file in a text editor. I typically use nano, but you can use whatever text editor you’re comfortable with. You’ll need to use sudo to edit this file because it’s in a system directory:

sudo nano /usr/share/applications/google-chrome.desktop

Modify the MimeType line. In the .desktop file, look for a line starting with MimeType=. If it doesn’t exist, you can add it yourself. This line should include x-scheme-handler/http and x-scheme-handler/https; these settings tell Linux to use this browser for HTTP and HTTPS links, respectively. Here’s what it should look like:


If other types are already listed, you can append the new ones using semicolons.

editing google chrome desktop file

Editing google-chrome.desktop file

Save and close the file. If you’re using nano, press Ctrl+O to save the changes, then press Ctrl+X to exit the editor.

Update the system about the change. Finally, you’ll need to update the system about this change with the following command:

sudo update-desktop-database

Now, your preferred browser should be set as the default for opening HTTP and HTTPS links.

Please replace google-chrome.desktop with the actual name of your browser’s .desktop file. It’s important to ensure that you’re editing the correct .desktop file, as each application installed on your system typically has its own.


And there you have it, folks! By now, you should be proficient in setting your default browser in Linux, both through the terminal and GUI. Although Linux may feel daunting at first, I guarantee that its flexibility and depth will reward you as you learn more about it. Don’t be afraid to experiment – that’s one of the things I love most about Linux.

Lastly, remember: it’s not just about getting tasks done. It’s about shaping the system to suit you. And what could be more personal than choosing the window through which you view the web? Happy browsing!

You may also like

Leave a Comment



FOSS Linux is a leading resource for Linux enthusiasts and professionals alike. With a focus on providing the best Linux tutorials, open-source apps, news, and reviews written by team of expert authors. FOSS Linux is the go-to source for all things Linux.

Whether you’re a beginner or an experienced user, FOSS Linux has something for everyone.

Follow Us


©2016-2023 FOSS LINUX



“Linux” is the registered trademark by Linus Torvalds in the U.S. and other countries.