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.
Run `xdg-settings set default-web-browser firefox.desktop` to make Firefox the default browser.
01Command
Command
$ xdg-settings set default-web-browser firefox.desktop02What 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
!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.desktop05Sources
- xdg-settings(1) - Linux manual pageEvidence: 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