Published on

Setting Default Browser in Terminal using XDG

Authors

Setting Default Browser in Linux Terminal

Using xdg

  1. Install xdg-utils

    • On Debian based systems, you can install xdg-utils with

      sudo apt install xdg-utils
      
    • On Arch based systems, you can install xdg-utils with

       sudo pacman -S xdg-utils
      
  2. Set Default Browser

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

    Replace firefox.desktop with the name of your browser's desktop file.

    • You can list all available browsers with

      ls /usr/share/applications/*.desktop
      
    • To search for a specific browser, use the grep command.

      ls /usr/share/applications/*.desktop | grep -i firefox
      

      Replace firefox with the name of your browser.