Setup Default Browser for Non-GUI Applications in Ubuntu Linux (x-www-browser)

KDE and Gnome provide GUI to setup the default browser in Ubuntu. However for the default browser settings to be accessible in bash scripts, a further step is required. That is to setup x-www-browser.

Set the default x-www-browser using the update-alternatives command.

sudo update-alternatives --config x-www-browser

Enter the number corresponding to the browser you want as your default browser.