- DefaultWebBrowser
- GNOME
- Default for GNOME sessions (user-specific)
- Default for GNOME sessions (system-wide)
- Default for KDE sessions (user-specific)
- Foreign applications
- Default for foreign programs (system-wide)
- Default for foreign programs (user-specific)
- Removing alternative browsers from the system
- Opening the default browser from a script
- How to open default browser from command line Linux
- Checking default web browser:
- Opening default web browser from the command line:
- Changing default web browser:
- Conclusion:
- About the author
- Talha Saif Malik
- How to set Google Chrome as the default browser?
- 7 Answers 7
- How to launch default web browser from the terminal?
- 6 Answers 6
- How to set the Default Browser from the Command Line?
- 10 Answers 10
- DefaultWebBrowser
The default web browser in Debian’s GNOME environment is Firefox.
The default web browser in Debian’s KDE environment is Konqueror.
These can be changed to fit your needs. If you prefer a different browser (e.g. Chromium), read below to find out how to change it in your preferred desktop.
GNOME
Default for GNOME sessions (user-specific)
In the Default Applications section of the GNOME Settings, you can set your default web browser for your user in the «Web» dropdown.
Default for GNOME sessions (system-wide)
The default GNOME browser can be changed for the whole system by reconfiguring the alternative.
Default for KDE sessions (user-specific)
Under System Settings > Applications > Default Applications > Web Browser, change the «Open http and https URLs» setting to «in the following application» and choose your preferred browser from the dropdown list, then apply the change.
To change how htm or html files are handled when they are clicked in your file manager, change the preference under System Settings > Applications > File Associations, then search for «html» in the filetype search bar at the top. Under the «text» category, the «html» item lets you set the application preference in order. Move your favorite browser to the top.
Foreign applications
Default for foreign programs (system-wide)
Programs which are not designed for the user’s desktop environment do not obey the browser settings of the desktop environment (GNOME or KDE). For example, Thunderbird ignores desktop environment-specific browser settings. The default browser for generic applications can be changed for the whole system by reconfiguring the x-www-browser alternative.
Default for foreign programs (user-specific)
Some applications use xdg-open (part of xdg-utils). xdg-settings can be used to both get and change the default browser. Local settings can also be found in the users’ home in
Removing alternative browsers from the system
This method involves removing all the other browsers installed on the system, so that the desired one remains the only one. Sometimes this is not feasable (multiuser system, dependencies) and is the least elegant.
Any of the previous methods is preferred to this one, but this method can be useful for lightweight systems.
Opening the default browser from a script
If you’re writing a script or application for Debian that needs to be able to open the default browser, your best option is to use thesensible-browser wrapper from the sensible-utils package. This tests the common symlinks (x-www-browser, gnome-www-browser, www-browser, etc.) and chooses the most «sensible» browser out of them.
The environment variable BROWSER can be set to override its selection and force it to always choose your desired browser.
Источник
How to open default browser from command line Linux
Checking default web browser:
To set, change or view the default browser through a terminal or user interface is simple yet straightforward.
Write out the below-given command to know the default browser of your Linux system.
You can look into the list of other default applications, including your default browser. For performing this, there are two methods, In the first method, you can use the below-given command, and it will redirect you to the Default Application windows.
Searching “Default Applications” in the activities is considered as the second method.
The highlighted web browser in the “Web” option is already picked as the default web browser.
You can also check out the list of other available alternatives for browsing the web on your system.
The output declares that “Google Chrome” also exists as a web browser on our Ubuntu.
Opening default web browser from the command line:
Now, we will try to open the google instance in the default web browser, which is “firefox” in our case. Utilize the below-given command in your terminal if you want to do so.
Here, you can see terminal command execution successfully open a google instance in our default web browser.
Changing default web browser:
For setting any other browser as the default one, you have to execute the “xdg” settings command with the browser name at the end. We will set “Google Chrome” as the default browser on our Linux system in the following example.
Again, open any web instance by specifying its URL in the “xdg” open command. Furthermore, we have chosen “Google” for the testing.
The output states that we are successful in setting “Google Chrome” as your default browser.
Conclusion:
As Linux users, we all have various installed web browsers, which we use according to our web preferences. Still, there exists a possibility of 90% using a single web browser for browsing activities which turns to be our default web browser. In this article, we have seen opening the default browser for any web instance from the command line. Furthermore, the procedure of viewing and setting any other alternatives to your default browser is also provided.
About the author
Talha Saif Malik
Talha is a contributor at Linux Hint with a vision to bring value and do useful things for the world. He loves to read, write and speak about Linux, Data, Computers and Technology.
Источник
How to set Google Chrome as the default browser?
How can I set Google Chrome as the default browser? If I set it in the browser settings, nothing happens. The browser says it’s default, but in preferred applications in Gnome, there’s only Firefox to choose from. Clicking any link i.e in Thunderbird opens a blank Firefox window, not with the link embedded. Can I set the default browser in dconf2 or any configuration file?
7 Answers 7
Assuming you are using Unity, click on the dash button in the launcher and search for ‘System info’. Then, open ‘System info’ and move to ‘Default applications’ section. Then, click on the dropdown list next to Web. There, select ‘Google Chrome’ and it will be selected as the default web browser for your system.
You should have in the
/.config/mimeapps.list file the following lines:
Make sure these lines are under either the [Default Applications] or [Added Associations] section.
And of course, you need google-chrome installed such that google-chrome.desktop is either located at /usr/share/applications/ , /usr/local/share/applications/ or
Alternatively, you can do the following instead of editing mimeapps.list :
To check the current settings, you can use:
There are a number of places an application might figure out which browser to launch and unfortunately there is no established standard. If the other answers don’t work for you (as was the case for me with Skype) you could try:
- the $BROWSER environment variable
- /usr/bin/x-www-browser , which is configured via the alternatives mechanism: sudo update-alternatives —config x-www-browser (which is what Skype is launching it seems)
There are also the /etc/alternatives/ where you have links:
In my case Lotus Notes opened wrong browser using the link gnome-www-browser.
In Ubuntu 18.04 and later select Settings -> Details -> Default Applications.
For Kubuntu 20.04 with Plasma, you can do the following:
- Open the «Application Launcher«
- Type «Default Applications» into the searchbox
- You should see a system settings module with a star as an icon. It should actually says «Default Applications«. Select it and open it
- Select the option «Web Browser» and from there just choose «Google Chrome» as the default app for opening http and https URLs
- Click «Apply» in order to save the settings
See the preview at the following screenshot of the default applications utility.
Alternatively, you can do this from the «System Settings > Applications (under Personalization) > Default Applications«
Источник
How to launch default web browser from the terminal?
I was wondering what’s the terminal command to open the default web browser.
6 Answers 6
sensible-browser is the command you’re looking for.
Searching on Google I found the answer.
xdg-open opens a file or URL in the user’s preferred application. If a URL is provided the URL will be opened in the user’s preferred web browser. If a file is provided the file will be opened in the preferred application for files of that type. xdg-open supports file, ftp, http and https URLs.
xdg-open is part of xdg-utils package and it’s already installed on Ubuntu 10.10.
You can also use:
And it will open the URL in the default browser.
Just that you may find it useful. A fallback approach, and one liner.
|| => run if the precedent command failed (or)
&& => run only if the precedent command succeed
$var -> invoke the variable
With default Ubuntu setup only gnome-open command comes to mind.
I played around this a little. There is a problem with gnome-open — it won’t invoke the default web browser unless you specify a url. That’s a problem if you want to set up an icon or a shortcut that will always launch the browser that is set as default. Other times you might need to set it as a parameter for some programs that require a link to a web browser and don’t work well with gnome-open (e.g.: acroread ). You might solve this by using either x-www-browser or gnome-www-browser system links that you can set up through update-alternatives , but those are system wide settings, not user specific (and they are not synchronized with the values set through gnome-default-applications-properties . All this can be solved by opening the sensible-browser executable (which is actually a script):
and adding this at the beginning:
That will make sensible-browser always launch the user-specified default web browser. (I found out that gnome-default-applications-properties changes some gconf keys according to the browser that is currently set. The default browser value can be obtained from any of these keys so I went for /desktop/gnome/url-handlers/http/command and used it to fill the $BROWSER variable (the value is stripped of the «%s» part). )
Источник
How to set the Default Browser from the Command Line?
Tried to set the default browser using the GUI tools but this didn’t work overall. Is there a way to configure the system wide default browser from command line?
10 Answers 10
Execute the following command in terminal,to change the default browser.
sudo update-alternatives —config x-www-browser
Sample output:
Press enter to keep the default[*].
Right now I have firefox as my default web browser.
If i want google-chrome as default browser then I will type 3 and hit enter.
Note:
If you want to configure a commandline browser,then you have to configure
sudo update-alternatives —config www-browser
Alternate way is to add the following line export BROWSER=/usr/bin/firefox to your
Add the above line in the last,
Alternative GUI Method:
- You can also set the default browser in Gnome applications,type the following in terminal and press Enter gnome-default-applications-properties
- It will Open a Window.Now you can choose your preferred browser to set it default.
The already suggested methods might not work for some app (e.g. HipChat).
It depends a bit on what «default browser» exactly means, i.e. for what purpose you want to change the browser. Some programs ignore any system-wide settings and use their own settings.
That said, you can set the default browser for all programs starting the browser with the generic sensible-browser command by exporting the BROWSER variable, e.g. add a line to the file
The other generic way of calling a browser is x-www-browser , this one is handled by the Debian «alternatives» system:
If you want to configure a commandline-only browser like lynx, you have to configure www-browser instead.
Источник