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

  • See here for correct usage? – Zanna Sep 22 '16 at 5:31
  • @Zanna I've edited the original post. I forgot to say I've also tried that – mrjayviper Sep 22 '16 at 5:35
  • 1
    Please, provide text outputs rather than screenshots. It helps finding the question and improves formatting. Thanks – Anwar Sep 22 '16 at 6:49
  • If you run x-www-browser google.com it should open in whatever you set with update-alternatives – dragon788 Nov 20 '17 at 21:41

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
  • how about other defaults? mail/GUI editor/zip files and other file extensions. – mrjayviper Sep 22 '16 at 8:58
  • Is your question about browsers or changing all file association? – Anwar Sep 22 '16 at 9: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
  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.