Set the Default Browser with xdg-settings

Use xdg-settings set default-web-browser to change the system default browser from the terminal, on GNOME, KDE, XFCE and more.

LinuxbrowserdefaultxdgsettingsLow risk
Run `xdg-settings set default-web-browser firefox.desktop` to make Firefox the default browser.

01Command

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

02What it does

The argument is the .desktop filename of the browser — find candidates with `ls /usr/share/applications | grep -i browser` or `xdg-settings check default-web-browser firefox.desktop` to verify the current value. This works across GNOME, KDE, XFCE and Cinnamon because xdg-settings translates to the right backend for each desktop. Opening links from other apps (mail client, terminal) will now use the browser you set.

03Risk

RiskLow risk
Requirementsxdg-utils (preinstalled on all major distros). .desktop filename must exist in /usr/share/applications/ or ~/.local/share/applications/.
!Warning: The .desktop name must match exactly (e.g. firefox_firefox.desktop on Snap installs); a wrong name makes the command fail or leaves links opening with the old browser.

04Undo

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

05Sources

  • xdg-settings(1) - Linux manual page
    Ubuntu Manpages · technical · 2026-09-17
    Evidence: xdg-settings get/set default-web-browser manages the default web browser in a desktop-environment-independent way, supporting GNOME, KDE, XFCE and others.

Last verified: 2026-09-18 · Category: System & Settings