8

My question is not specific to just the web browser but other things like mail/calender/opening PDF/zip/other file extensions.

So how can I change default browser using terminal? I've tried these 2 commands and

update-alternatives --set gnome-www-browser /usr/bin/google-chrome-stable
update-alternatives --set x-www-browser /usr/bin/google-chrome-stable

According to

update-alternatives --get-selections | grep browser

Google Chrome is supposedly my default browser.

enter image description here

But when I go to System Settings, Firefox is listed as the default.

enter image description here

When I double-click a simple HTML I created using vi, the file opens up in Firefox. I restarted Ubuntu but I get the same behavior.

so what am I doing wrong? Thank you.

edit1: I've also tried update-alternatives --config gnome-www-browser/x-ww-browser. no effect

enter image description here

edit2: According to update-alternatives, firefox is not assigned to anything!

enter image description here

mrjayviper
  • 1,555

1 Answers1

14

That settings cannot be changed by update-alternatives. It's controlled by xdg-settings. You can use this command to change the default from command line

xdg-settings set default-web-browser google-chrome.desktop
Anwar
  • 76,649
  • how about other defaults? mail/GUI editor/zip files and other file extensions. – mrjayviper Sep 22 '16 at 08:58
  • Is your question about browsers or changing all file association? – Anwar Sep 22 '16 at 09:57
  • I was using browser as an example since it was the I'm working on first. But I intend change the default for others after I'm done with browser. – mrjayviper Sep 22 '16 at 11:00
  • 1
    This is insane. Ubuntu left the update-alternatives method in place even though it seems to have no effect, then added the xdg-settings, and that doesn't seem to provide an easy way to get available options...? – moodboom Apr 16 '18 at 14:13
  • Unfortunately, xdg-settings doesn't influence some things -- e.g. the sensible-browser wrapper. Any hints on that? – lindes Feb 24 '22 at 20:11