How to launch default web browser from the terminal? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)How to open file with default application from command line?Browse internet inside terminalCan't open Chrome as default browser from terminalOpening the file browser from terminalHow to set the Default Browser from the Command Line?Terminal command to open URL's in default and non-default browserUsing Terminal as a web browserOpen URL in default browser (Chromium) from terminal and give browser focusCan't open Chrome as default browser from terminalOpen Ubuntu Browser from TerminalHow to web-scrape using Ubuntu terminal?How do I launch Tor browser on specific web page from command line?Can I use Terminal emulator on the Web Browser in Ubuntu?

Around usage results

Using audio cues to encourage good posture

How to react to hostile behavior from a senior developer?

Generate an RGB colour grid

また usage in a dictionary

How to tell that you are a giant?

Is it ethical to give a final exam after the professor has quit before teaching the remaining chapters of the course?

Wu formula for manifolds with boundary

What does this Jacques Hadamard quote mean?

Does classifying an integer as a discrete log require it be part of a multiplicative group?

Amount of permutations on an NxNxN Rubik's Cube

Do wooden building fires get hotter than 600°C?

What would be the ideal power source for a cybernetic eye?

How to find all the available tools in mac terminal?

How would a mousetrap for use in space work?

Irreducible of finite Krull dimension implies quasi-compact?

Is "Reachable Object" really an NP-complete problem?

How could we fake a moon landing now?

Fantasy story; one type of magic grows in power with use, but the more powerful they are, they more they are drawn to travel to their source

What do you call the main part of a joke?

Is it a good idea to use CNN to classify 1D signal?

Compare a given version number in the form major.minor.build.patch and see if one is less than the other

Is it common practice to audition new musicians 1-2-1 before rehearsing with the entire band?

How come Sam didn't become Lord of Horn Hill?



How to launch default web browser from the terminal?



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)How to open file with default application from command line?Browse internet inside terminalCan't open Chrome as default browser from terminalOpening the file browser from terminalHow to set the Default Browser from the Command Line?Terminal command to open URL's in default and non-default browserUsing Terminal as a web browserOpen URL in default browser (Chromium) from terminal and give browser focusCan't open Chrome as default browser from terminalOpen Ubuntu Browser from TerminalHow to web-scrape using Ubuntu terminal?How do I launch Tor browser on specific web page from command line?Can I use Terminal emulator on the Web Browser in Ubuntu?



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








80















I was wondering what's the terminal command to open the default web browser.










share|improve this question






























    80















    I was wondering what's the terminal command to open the default web browser.










    share|improve this question


























      80












      80








      80


      17






      I was wondering what's the terminal command to open the default web browser.










      share|improve this question
















      I was wondering what's the terminal command to open the default web browser.







      command-line






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Apr 25 '14 at 12:41









      Braiam

      52.7k20138225




      52.7k20138225










      asked Oct 19 '10 at 10:39









      LucaLuca

      1,30211013




      1,30211013




















          7 Answers
          7






          active

          oldest

          votes


















          87














          sensible-browser is the command you're looking for.






          share|improve this answer























          • What about the differences between sensible-utils package and the system of alternatives found in /etc/alternatives and modified by update-alternatives?

            – enzotib
            Oct 19 '10 at 12:59






          • 7





            For me sensible-browser opens Opera instead pf default Chrome. xdg-open works as expected.

            – incrop
            Jun 17 '14 at 15:12






          • 2





            what @Incrop said is still true for Ubuntu 16.04, this opens Firefox instead of my default browser Chromium.

            – Andreas Hacker
            Mar 16 '17 at 10:58







          • 2





            sensible-browser doesn't follow user preference configured in unity-control-centre. xdg-open does.

            – Tankman六四
            Feb 5 '18 at 0:58


















          70














          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.






          share|improve this answer























          • what does xdg stand for? Its hard to remember without knowing that.

            – Thupten
            Jul 13 '14 at 14:42






          • 1





            XDG stands for X Desktop Group aka freedesktop.org

            – Luca
            Jul 13 '14 at 19:05











          • Still still works on a default Ubuntu 16.04 installation.

            – Andreas Hacker
            Mar 16 '17 at 11:20






          • 1





            if the user once configured to open html files with a text editor by default, this will not work. OP asks for a way to open the web browser, not the default application for html files (even though by default it's the same)

            – Blauhirn
            Jun 29 '17 at 16:48












          • This will work on any gnu/linux distro that has x-server window manager (that is just about all of them - eg debian, *buntu, fedora, manjaro, Arch etc)

            – flurbius
            Dec 27 '17 at 19:58


















          13














          You can also use:



          x-www-browser http://some-url.org


          And it will open the URL in the default browser.






          share|improve this answer


















          • 2





            for me, in Ubuntu 16.04, this will open Firefox even though Chromium is set as the default browser in the "Default Applications" setting.

            – Andreas Hacker
            Mar 16 '17 at 10:56


















          4














          With default Ubuntu setup only gnome-open command comes to mind.



          gnome-open http://askubuntu.com





          share|improve this answer


















          • 4





            With default Ubuntu setup, sensible-browser and xdg-open commands work as well.

            – marenostrum
            Oct 19 '10 at 12:38






          • 1





            The advantage is that you can use gnome-open for almost all file-types, URIs and directories. It's one command to learn, instead of trying to remember about obscure commands like sensible-browser

            – Stefan Lasiewski
            Oct 21 '10 at 18:19






          • 6





            @Stefan Lasiewski: xdg-open should do the same thing - actually, it will call gnome-open, or kde-open, or whatever, depending on your desktop environment. Thus it's more portable.

            – Piskvor
            Aug 22 '11 at 14:37











          • in Ubuntu 16.04, gnome-open is not installed by default

            – Andreas Hacker
            Mar 16 '17 at 10:55






          • 1





            gnome-open is dependent on gnome desktop, better off using xdg as its more common

            – flurbius
            Dec 27 '17 at 19:59


















          2














          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-browserexecutable (which is actually a script):



          sudo gedit $(which sensible-browser)


          and adding this at the beginning:



          #!/bin/bash
          BROWSER=$(gconftool -g /desktop/gnome/url-handlers/http/command)
          export BROWSER="$BROWSER//""%s""/"


          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). )






          share|improve this answer




















          • 1





            I wouldn't recommend editing /usr/bin/sensible-browser as this answer recommends. This change will be overwritten on a system upgrade.

            – Gilles
            Feb 21 '14 at 11:53











          • rather than try to install a modified script on a users system, a more realistic solution is to use xdg-open as per Luca's answer. If you specify a html file or a URL it WILL open the browser - if you supply something else it will open an appropriate application for that type of resource. I doubt there is any good reason to open some file with a browser when it will be better handled by some other application, either by default or in accordance with the users explicit choice. If you must, you can force the browser to open it with x-www-browser (see Benjamin's answer)

            – flurbius
            Dec 27 '17 at 20:34


















          0














          Just that you may find it useful. A fallback approach, and one liner.



          URL="www.url.com/some"; xdg-open $URL || sensible-browser $URL || x-www-browser $URL || gnome-open $URL


          Good reading for the no familiar with the logical operators
          https://www.howtogeek.com/269509/how-to-run-two-or-more-terminal-commands-at-once-in-linux/.





          share










          New contributor




          Mohamed Allal is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.



























            -1














            Follow below commands :




            1. $ type -a Firefox : This gives path to firefox application


            2. $ /usr/bin/firefox www.facebook.com : This opens a tab with www.facebook.com





            share|improve this answer




















            • 3





              Firefox is not always the default web browser

              – storm
              Jan 18 at 8:05











            • ofcourse, we can use another browser, as per the choice

              – Simpy Parveen
              Jan 18 at 18:26











            • Why wouldn't you just run firefox directly instead of getting the path and then running the path? At any rate, the answer misses the point: the question is about running the default browser, not Firefox.

              – Olorin
              Jan 21 at 1:25











            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "89"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f8252%2fhow-to-launch-default-web-browser-from-the-terminal%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            7 Answers
            7






            active

            oldest

            votes








            7 Answers
            7






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            87














            sensible-browser is the command you're looking for.






            share|improve this answer























            • What about the differences between sensible-utils package and the system of alternatives found in /etc/alternatives and modified by update-alternatives?

              – enzotib
              Oct 19 '10 at 12:59






            • 7





              For me sensible-browser opens Opera instead pf default Chrome. xdg-open works as expected.

              – incrop
              Jun 17 '14 at 15:12






            • 2





              what @Incrop said is still true for Ubuntu 16.04, this opens Firefox instead of my default browser Chromium.

              – Andreas Hacker
              Mar 16 '17 at 10:58







            • 2





              sensible-browser doesn't follow user preference configured in unity-control-centre. xdg-open does.

              – Tankman六四
              Feb 5 '18 at 0:58















            87














            sensible-browser is the command you're looking for.






            share|improve this answer























            • What about the differences between sensible-utils package and the system of alternatives found in /etc/alternatives and modified by update-alternatives?

              – enzotib
              Oct 19 '10 at 12:59






            • 7





              For me sensible-browser opens Opera instead pf default Chrome. xdg-open works as expected.

              – incrop
              Jun 17 '14 at 15:12






            • 2





              what @Incrop said is still true for Ubuntu 16.04, this opens Firefox instead of my default browser Chromium.

              – Andreas Hacker
              Mar 16 '17 at 10:58







            • 2





              sensible-browser doesn't follow user preference configured in unity-control-centre. xdg-open does.

              – Tankman六四
              Feb 5 '18 at 0:58













            87












            87








            87







            sensible-browser is the command you're looking for.






            share|improve this answer













            sensible-browser is the command you're looking for.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Oct 19 '10 at 10:50









            EvanEvan

            4,2381717




            4,2381717












            • What about the differences between sensible-utils package and the system of alternatives found in /etc/alternatives and modified by update-alternatives?

              – enzotib
              Oct 19 '10 at 12:59






            • 7





              For me sensible-browser opens Opera instead pf default Chrome. xdg-open works as expected.

              – incrop
              Jun 17 '14 at 15:12






            • 2





              what @Incrop said is still true for Ubuntu 16.04, this opens Firefox instead of my default browser Chromium.

              – Andreas Hacker
              Mar 16 '17 at 10:58







            • 2





              sensible-browser doesn't follow user preference configured in unity-control-centre. xdg-open does.

              – Tankman六四
              Feb 5 '18 at 0:58

















            • What about the differences between sensible-utils package and the system of alternatives found in /etc/alternatives and modified by update-alternatives?

              – enzotib
              Oct 19 '10 at 12:59






            • 7





              For me sensible-browser opens Opera instead pf default Chrome. xdg-open works as expected.

              – incrop
              Jun 17 '14 at 15:12






            • 2





              what @Incrop said is still true for Ubuntu 16.04, this opens Firefox instead of my default browser Chromium.

              – Andreas Hacker
              Mar 16 '17 at 10:58







            • 2





              sensible-browser doesn't follow user preference configured in unity-control-centre. xdg-open does.

              – Tankman六四
              Feb 5 '18 at 0:58
















            What about the differences between sensible-utils package and the system of alternatives found in /etc/alternatives and modified by update-alternatives?

            – enzotib
            Oct 19 '10 at 12:59





            What about the differences between sensible-utils package and the system of alternatives found in /etc/alternatives and modified by update-alternatives?

            – enzotib
            Oct 19 '10 at 12:59




            7




            7





            For me sensible-browser opens Opera instead pf default Chrome. xdg-open works as expected.

            – incrop
            Jun 17 '14 at 15:12





            For me sensible-browser opens Opera instead pf default Chrome. xdg-open works as expected.

            – incrop
            Jun 17 '14 at 15:12




            2




            2





            what @Incrop said is still true for Ubuntu 16.04, this opens Firefox instead of my default browser Chromium.

            – Andreas Hacker
            Mar 16 '17 at 10:58






            what @Incrop said is still true for Ubuntu 16.04, this opens Firefox instead of my default browser Chromium.

            – Andreas Hacker
            Mar 16 '17 at 10:58





            2




            2





            sensible-browser doesn't follow user preference configured in unity-control-centre. xdg-open does.

            – Tankman六四
            Feb 5 '18 at 0:58





            sensible-browser doesn't follow user preference configured in unity-control-centre. xdg-open does.

            – Tankman六四
            Feb 5 '18 at 0:58













            70














            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.






            share|improve this answer























            • what does xdg stand for? Its hard to remember without knowing that.

              – Thupten
              Jul 13 '14 at 14:42






            • 1





              XDG stands for X Desktop Group aka freedesktop.org

              – Luca
              Jul 13 '14 at 19:05











            • Still still works on a default Ubuntu 16.04 installation.

              – Andreas Hacker
              Mar 16 '17 at 11:20






            • 1





              if the user once configured to open html files with a text editor by default, this will not work. OP asks for a way to open the web browser, not the default application for html files (even though by default it's the same)

              – Blauhirn
              Jun 29 '17 at 16:48












            • This will work on any gnu/linux distro that has x-server window manager (that is just about all of them - eg debian, *buntu, fedora, manjaro, Arch etc)

              – flurbius
              Dec 27 '17 at 19:58















            70














            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.






            share|improve this answer























            • what does xdg stand for? Its hard to remember without knowing that.

              – Thupten
              Jul 13 '14 at 14:42






            • 1





              XDG stands for X Desktop Group aka freedesktop.org

              – Luca
              Jul 13 '14 at 19:05











            • Still still works on a default Ubuntu 16.04 installation.

              – Andreas Hacker
              Mar 16 '17 at 11:20






            • 1





              if the user once configured to open html files with a text editor by default, this will not work. OP asks for a way to open the web browser, not the default application for html files (even though by default it's the same)

              – Blauhirn
              Jun 29 '17 at 16:48












            • This will work on any gnu/linux distro that has x-server window manager (that is just about all of them - eg debian, *buntu, fedora, manjaro, Arch etc)

              – flurbius
              Dec 27 '17 at 19:58













            70












            70








            70







            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.






            share|improve this answer













            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.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Oct 19 '10 at 10:50









            LucaLuca

            1,30211013




            1,30211013












            • what does xdg stand for? Its hard to remember without knowing that.

              – Thupten
              Jul 13 '14 at 14:42






            • 1





              XDG stands for X Desktop Group aka freedesktop.org

              – Luca
              Jul 13 '14 at 19:05











            • Still still works on a default Ubuntu 16.04 installation.

              – Andreas Hacker
              Mar 16 '17 at 11:20






            • 1





              if the user once configured to open html files with a text editor by default, this will not work. OP asks for a way to open the web browser, not the default application for html files (even though by default it's the same)

              – Blauhirn
              Jun 29 '17 at 16:48












            • This will work on any gnu/linux distro that has x-server window manager (that is just about all of them - eg debian, *buntu, fedora, manjaro, Arch etc)

              – flurbius
              Dec 27 '17 at 19:58

















            • what does xdg stand for? Its hard to remember without knowing that.

              – Thupten
              Jul 13 '14 at 14:42






            • 1





              XDG stands for X Desktop Group aka freedesktop.org

              – Luca
              Jul 13 '14 at 19:05











            • Still still works on a default Ubuntu 16.04 installation.

              – Andreas Hacker
              Mar 16 '17 at 11:20






            • 1





              if the user once configured to open html files with a text editor by default, this will not work. OP asks for a way to open the web browser, not the default application for html files (even though by default it's the same)

              – Blauhirn
              Jun 29 '17 at 16:48












            • This will work on any gnu/linux distro that has x-server window manager (that is just about all of them - eg debian, *buntu, fedora, manjaro, Arch etc)

              – flurbius
              Dec 27 '17 at 19:58
















            what does xdg stand for? Its hard to remember without knowing that.

            – Thupten
            Jul 13 '14 at 14:42





            what does xdg stand for? Its hard to remember without knowing that.

            – Thupten
            Jul 13 '14 at 14:42




            1




            1





            XDG stands for X Desktop Group aka freedesktop.org

            – Luca
            Jul 13 '14 at 19:05





            XDG stands for X Desktop Group aka freedesktop.org

            – Luca
            Jul 13 '14 at 19:05













            Still still works on a default Ubuntu 16.04 installation.

            – Andreas Hacker
            Mar 16 '17 at 11:20





            Still still works on a default Ubuntu 16.04 installation.

            – Andreas Hacker
            Mar 16 '17 at 11:20




            1




            1





            if the user once configured to open html files with a text editor by default, this will not work. OP asks for a way to open the web browser, not the default application for html files (even though by default it's the same)

            – Blauhirn
            Jun 29 '17 at 16:48






            if the user once configured to open html files with a text editor by default, this will not work. OP asks for a way to open the web browser, not the default application for html files (even though by default it's the same)

            – Blauhirn
            Jun 29 '17 at 16:48














            This will work on any gnu/linux distro that has x-server window manager (that is just about all of them - eg debian, *buntu, fedora, manjaro, Arch etc)

            – flurbius
            Dec 27 '17 at 19:58





            This will work on any gnu/linux distro that has x-server window manager (that is just about all of them - eg debian, *buntu, fedora, manjaro, Arch etc)

            – flurbius
            Dec 27 '17 at 19:58











            13














            You can also use:



            x-www-browser http://some-url.org


            And it will open the URL in the default browser.






            share|improve this answer


















            • 2





              for me, in Ubuntu 16.04, this will open Firefox even though Chromium is set as the default browser in the "Default Applications" setting.

              – Andreas Hacker
              Mar 16 '17 at 10:56















            13














            You can also use:



            x-www-browser http://some-url.org


            And it will open the URL in the default browser.






            share|improve this answer


















            • 2





              for me, in Ubuntu 16.04, this will open Firefox even though Chromium is set as the default browser in the "Default Applications" setting.

              – Andreas Hacker
              Mar 16 '17 at 10:56













            13












            13








            13







            You can also use:



            x-www-browser http://some-url.org


            And it will open the URL in the default browser.






            share|improve this answer













            You can also use:



            x-www-browser http://some-url.org


            And it will open the URL in the default browser.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Aug 22 '11 at 9:50









            BenjaminBenjamin

            1,78773045




            1,78773045







            • 2





              for me, in Ubuntu 16.04, this will open Firefox even though Chromium is set as the default browser in the "Default Applications" setting.

              – Andreas Hacker
              Mar 16 '17 at 10:56












            • 2





              for me, in Ubuntu 16.04, this will open Firefox even though Chromium is set as the default browser in the "Default Applications" setting.

              – Andreas Hacker
              Mar 16 '17 at 10:56







            2




            2





            for me, in Ubuntu 16.04, this will open Firefox even though Chromium is set as the default browser in the "Default Applications" setting.

            – Andreas Hacker
            Mar 16 '17 at 10:56





            for me, in Ubuntu 16.04, this will open Firefox even though Chromium is set as the default browser in the "Default Applications" setting.

            – Andreas Hacker
            Mar 16 '17 at 10:56











            4














            With default Ubuntu setup only gnome-open command comes to mind.



            gnome-open http://askubuntu.com





            share|improve this answer


















            • 4





              With default Ubuntu setup, sensible-browser and xdg-open commands work as well.

              – marenostrum
              Oct 19 '10 at 12:38






            • 1





              The advantage is that you can use gnome-open for almost all file-types, URIs and directories. It's one command to learn, instead of trying to remember about obscure commands like sensible-browser

              – Stefan Lasiewski
              Oct 21 '10 at 18:19






            • 6





              @Stefan Lasiewski: xdg-open should do the same thing - actually, it will call gnome-open, or kde-open, or whatever, depending on your desktop environment. Thus it's more portable.

              – Piskvor
              Aug 22 '11 at 14:37











            • in Ubuntu 16.04, gnome-open is not installed by default

              – Andreas Hacker
              Mar 16 '17 at 10:55






            • 1





              gnome-open is dependent on gnome desktop, better off using xdg as its more common

              – flurbius
              Dec 27 '17 at 19:59















            4














            With default Ubuntu setup only gnome-open command comes to mind.



            gnome-open http://askubuntu.com





            share|improve this answer


















            • 4





              With default Ubuntu setup, sensible-browser and xdg-open commands work as well.

              – marenostrum
              Oct 19 '10 at 12:38






            • 1





              The advantage is that you can use gnome-open for almost all file-types, URIs and directories. It's one command to learn, instead of trying to remember about obscure commands like sensible-browser

              – Stefan Lasiewski
              Oct 21 '10 at 18:19






            • 6





              @Stefan Lasiewski: xdg-open should do the same thing - actually, it will call gnome-open, or kde-open, or whatever, depending on your desktop environment. Thus it's more portable.

              – Piskvor
              Aug 22 '11 at 14:37











            • in Ubuntu 16.04, gnome-open is not installed by default

              – Andreas Hacker
              Mar 16 '17 at 10:55






            • 1





              gnome-open is dependent on gnome desktop, better off using xdg as its more common

              – flurbius
              Dec 27 '17 at 19:59













            4












            4








            4







            With default Ubuntu setup only gnome-open command comes to mind.



            gnome-open http://askubuntu.com





            share|improve this answer













            With default Ubuntu setup only gnome-open command comes to mind.



            gnome-open http://askubuntu.com






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Oct 19 '10 at 10:51









            kounryusuikounryusui

            88121015




            88121015







            • 4





              With default Ubuntu setup, sensible-browser and xdg-open commands work as well.

              – marenostrum
              Oct 19 '10 at 12:38






            • 1





              The advantage is that you can use gnome-open for almost all file-types, URIs and directories. It's one command to learn, instead of trying to remember about obscure commands like sensible-browser

              – Stefan Lasiewski
              Oct 21 '10 at 18:19






            • 6





              @Stefan Lasiewski: xdg-open should do the same thing - actually, it will call gnome-open, or kde-open, or whatever, depending on your desktop environment. Thus it's more portable.

              – Piskvor
              Aug 22 '11 at 14:37











            • in Ubuntu 16.04, gnome-open is not installed by default

              – Andreas Hacker
              Mar 16 '17 at 10:55






            • 1





              gnome-open is dependent on gnome desktop, better off using xdg as its more common

              – flurbius
              Dec 27 '17 at 19:59












            • 4





              With default Ubuntu setup, sensible-browser and xdg-open commands work as well.

              – marenostrum
              Oct 19 '10 at 12:38






            • 1





              The advantage is that you can use gnome-open for almost all file-types, URIs and directories. It's one command to learn, instead of trying to remember about obscure commands like sensible-browser

              – Stefan Lasiewski
              Oct 21 '10 at 18:19






            • 6





              @Stefan Lasiewski: xdg-open should do the same thing - actually, it will call gnome-open, or kde-open, or whatever, depending on your desktop environment. Thus it's more portable.

              – Piskvor
              Aug 22 '11 at 14:37











            • in Ubuntu 16.04, gnome-open is not installed by default

              – Andreas Hacker
              Mar 16 '17 at 10:55






            • 1





              gnome-open is dependent on gnome desktop, better off using xdg as its more common

              – flurbius
              Dec 27 '17 at 19:59







            4




            4





            With default Ubuntu setup, sensible-browser and xdg-open commands work as well.

            – marenostrum
            Oct 19 '10 at 12:38





            With default Ubuntu setup, sensible-browser and xdg-open commands work as well.

            – marenostrum
            Oct 19 '10 at 12:38




            1




            1





            The advantage is that you can use gnome-open for almost all file-types, URIs and directories. It's one command to learn, instead of trying to remember about obscure commands like sensible-browser

            – Stefan Lasiewski
            Oct 21 '10 at 18:19





            The advantage is that you can use gnome-open for almost all file-types, URIs and directories. It's one command to learn, instead of trying to remember about obscure commands like sensible-browser

            – Stefan Lasiewski
            Oct 21 '10 at 18:19




            6




            6





            @Stefan Lasiewski: xdg-open should do the same thing - actually, it will call gnome-open, or kde-open, or whatever, depending on your desktop environment. Thus it's more portable.

            – Piskvor
            Aug 22 '11 at 14:37





            @Stefan Lasiewski: xdg-open should do the same thing - actually, it will call gnome-open, or kde-open, or whatever, depending on your desktop environment. Thus it's more portable.

            – Piskvor
            Aug 22 '11 at 14:37













            in Ubuntu 16.04, gnome-open is not installed by default

            – Andreas Hacker
            Mar 16 '17 at 10:55





            in Ubuntu 16.04, gnome-open is not installed by default

            – Andreas Hacker
            Mar 16 '17 at 10:55




            1




            1





            gnome-open is dependent on gnome desktop, better off using xdg as its more common

            – flurbius
            Dec 27 '17 at 19:59





            gnome-open is dependent on gnome desktop, better off using xdg as its more common

            – flurbius
            Dec 27 '17 at 19:59











            2














            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-browserexecutable (which is actually a script):



            sudo gedit $(which sensible-browser)


            and adding this at the beginning:



            #!/bin/bash
            BROWSER=$(gconftool -g /desktop/gnome/url-handlers/http/command)
            export BROWSER="$BROWSER//""%s""/"


            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). )






            share|improve this answer




















            • 1





              I wouldn't recommend editing /usr/bin/sensible-browser as this answer recommends. This change will be overwritten on a system upgrade.

              – Gilles
              Feb 21 '14 at 11:53











            • rather than try to install a modified script on a users system, a more realistic solution is to use xdg-open as per Luca's answer. If you specify a html file or a URL it WILL open the browser - if you supply something else it will open an appropriate application for that type of resource. I doubt there is any good reason to open some file with a browser when it will be better handled by some other application, either by default or in accordance with the users explicit choice. If you must, you can force the browser to open it with x-www-browser (see Benjamin's answer)

              – flurbius
              Dec 27 '17 at 20:34















            2














            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-browserexecutable (which is actually a script):



            sudo gedit $(which sensible-browser)


            and adding this at the beginning:



            #!/bin/bash
            BROWSER=$(gconftool -g /desktop/gnome/url-handlers/http/command)
            export BROWSER="$BROWSER//""%s""/"


            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). )






            share|improve this answer




















            • 1





              I wouldn't recommend editing /usr/bin/sensible-browser as this answer recommends. This change will be overwritten on a system upgrade.

              – Gilles
              Feb 21 '14 at 11:53











            • rather than try to install a modified script on a users system, a more realistic solution is to use xdg-open as per Luca's answer. If you specify a html file or a URL it WILL open the browser - if you supply something else it will open an appropriate application for that type of resource. I doubt there is any good reason to open some file with a browser when it will be better handled by some other application, either by default or in accordance with the users explicit choice. If you must, you can force the browser to open it with x-www-browser (see Benjamin's answer)

              – flurbius
              Dec 27 '17 at 20:34













            2












            2








            2







            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-browserexecutable (which is actually a script):



            sudo gedit $(which sensible-browser)


            and adding this at the beginning:



            #!/bin/bash
            BROWSER=$(gconftool -g /desktop/gnome/url-handlers/http/command)
            export BROWSER="$BROWSER//""%s""/"


            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). )






            share|improve this answer















            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-browserexecutable (which is actually a script):



            sudo gedit $(which sensible-browser)


            and adding this at the beginning:



            #!/bin/bash
            BROWSER=$(gconftool -g /desktop/gnome/url-handlers/http/command)
            export BROWSER="$BROWSER//""%s""/"


            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). )







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Feb 21 '14 at 11:52









            Gilles

            45.6k13102142




            45.6k13102142










            answered Feb 25 '11 at 13:15







            user11456














            • 1





              I wouldn't recommend editing /usr/bin/sensible-browser as this answer recommends. This change will be overwritten on a system upgrade.

              – Gilles
              Feb 21 '14 at 11:53











            • rather than try to install a modified script on a users system, a more realistic solution is to use xdg-open as per Luca's answer. If you specify a html file or a URL it WILL open the browser - if you supply something else it will open an appropriate application for that type of resource. I doubt there is any good reason to open some file with a browser when it will be better handled by some other application, either by default or in accordance with the users explicit choice. If you must, you can force the browser to open it with x-www-browser (see Benjamin's answer)

              – flurbius
              Dec 27 '17 at 20:34












            • 1





              I wouldn't recommend editing /usr/bin/sensible-browser as this answer recommends. This change will be overwritten on a system upgrade.

              – Gilles
              Feb 21 '14 at 11:53











            • rather than try to install a modified script on a users system, a more realistic solution is to use xdg-open as per Luca's answer. If you specify a html file or a URL it WILL open the browser - if you supply something else it will open an appropriate application for that type of resource. I doubt there is any good reason to open some file with a browser when it will be better handled by some other application, either by default or in accordance with the users explicit choice. If you must, you can force the browser to open it with x-www-browser (see Benjamin's answer)

              – flurbius
              Dec 27 '17 at 20:34







            1




            1





            I wouldn't recommend editing /usr/bin/sensible-browser as this answer recommends. This change will be overwritten on a system upgrade.

            – Gilles
            Feb 21 '14 at 11:53





            I wouldn't recommend editing /usr/bin/sensible-browser as this answer recommends. This change will be overwritten on a system upgrade.

            – Gilles
            Feb 21 '14 at 11:53













            rather than try to install a modified script on a users system, a more realistic solution is to use xdg-open as per Luca's answer. If you specify a html file or a URL it WILL open the browser - if you supply something else it will open an appropriate application for that type of resource. I doubt there is any good reason to open some file with a browser when it will be better handled by some other application, either by default or in accordance with the users explicit choice. If you must, you can force the browser to open it with x-www-browser (see Benjamin's answer)

            – flurbius
            Dec 27 '17 at 20:34





            rather than try to install a modified script on a users system, a more realistic solution is to use xdg-open as per Luca's answer. If you specify a html file or a URL it WILL open the browser - if you supply something else it will open an appropriate application for that type of resource. I doubt there is any good reason to open some file with a browser when it will be better handled by some other application, either by default or in accordance with the users explicit choice. If you must, you can force the browser to open it with x-www-browser (see Benjamin's answer)

            – flurbius
            Dec 27 '17 at 20:34











            0














            Just that you may find it useful. A fallback approach, and one liner.



            URL="www.url.com/some"; xdg-open $URL || sensible-browser $URL || x-www-browser $URL || gnome-open $URL


            Good reading for the no familiar with the logical operators
            https://www.howtogeek.com/269509/how-to-run-two-or-more-terminal-commands-at-once-in-linux/.





            share










            New contributor




            Mohamed Allal is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.
























              0














              Just that you may find it useful. A fallback approach, and one liner.



              URL="www.url.com/some"; xdg-open $URL || sensible-browser $URL || x-www-browser $URL || gnome-open $URL


              Good reading for the no familiar with the logical operators
              https://www.howtogeek.com/269509/how-to-run-two-or-more-terminal-commands-at-once-in-linux/.





              share










              New contributor




              Mohamed Allal is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.






















                0












                0








                0







                Just that you may find it useful. A fallback approach, and one liner.



                URL="www.url.com/some"; xdg-open $URL || sensible-browser $URL || x-www-browser $URL || gnome-open $URL


                Good reading for the no familiar with the logical operators
                https://www.howtogeek.com/269509/how-to-run-two-or-more-terminal-commands-at-once-in-linux/.





                share










                New contributor




                Mohamed Allal is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.










                Just that you may find it useful. A fallback approach, and one liner.



                URL="www.url.com/some"; xdg-open $URL || sensible-browser $URL || x-www-browser $URL || gnome-open $URL


                Good reading for the no familiar with the logical operators
                https://www.howtogeek.com/269509/how-to-run-two-or-more-terminal-commands-at-once-in-linux/.






                share










                New contributor




                Mohamed Allal is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.








                share


                share








                edited 3 mins ago





















                New contributor




                Mohamed Allal is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.









                answered 9 mins ago









                Mohamed AllalMohamed Allal

                1012




                1012




                New contributor




                Mohamed Allal is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.





                New contributor





                Mohamed Allal is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.






                Mohamed Allal is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.





















                    -1














                    Follow below commands :




                    1. $ type -a Firefox : This gives path to firefox application


                    2. $ /usr/bin/firefox www.facebook.com : This opens a tab with www.facebook.com





                    share|improve this answer




















                    • 3





                      Firefox is not always the default web browser

                      – storm
                      Jan 18 at 8:05











                    • ofcourse, we can use another browser, as per the choice

                      – Simpy Parveen
                      Jan 18 at 18:26











                    • Why wouldn't you just run firefox directly instead of getting the path and then running the path? At any rate, the answer misses the point: the question is about running the default browser, not Firefox.

                      – Olorin
                      Jan 21 at 1:25















                    -1














                    Follow below commands :




                    1. $ type -a Firefox : This gives path to firefox application


                    2. $ /usr/bin/firefox www.facebook.com : This opens a tab with www.facebook.com





                    share|improve this answer




















                    • 3





                      Firefox is not always the default web browser

                      – storm
                      Jan 18 at 8:05











                    • ofcourse, we can use another browser, as per the choice

                      – Simpy Parveen
                      Jan 18 at 18:26











                    • Why wouldn't you just run firefox directly instead of getting the path and then running the path? At any rate, the answer misses the point: the question is about running the default browser, not Firefox.

                      – Olorin
                      Jan 21 at 1:25













                    -1












                    -1








                    -1







                    Follow below commands :




                    1. $ type -a Firefox : This gives path to firefox application


                    2. $ /usr/bin/firefox www.facebook.com : This opens a tab with www.facebook.com





                    share|improve this answer















                    Follow below commands :




                    1. $ type -a Firefox : This gives path to firefox application


                    2. $ /usr/bin/firefox www.facebook.com : This opens a tab with www.facebook.com






                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Jan 18 at 6:48









                    Nisse Engström

                    283256




                    283256










                    answered Jan 18 at 4:43









                    Simpy ParveenSimpy Parveen

                    11




                    11







                    • 3





                      Firefox is not always the default web browser

                      – storm
                      Jan 18 at 8:05











                    • ofcourse, we can use another browser, as per the choice

                      – Simpy Parveen
                      Jan 18 at 18:26











                    • Why wouldn't you just run firefox directly instead of getting the path and then running the path? At any rate, the answer misses the point: the question is about running the default browser, not Firefox.

                      – Olorin
                      Jan 21 at 1:25












                    • 3





                      Firefox is not always the default web browser

                      – storm
                      Jan 18 at 8:05











                    • ofcourse, we can use another browser, as per the choice

                      – Simpy Parveen
                      Jan 18 at 18:26











                    • Why wouldn't you just run firefox directly instead of getting the path and then running the path? At any rate, the answer misses the point: the question is about running the default browser, not Firefox.

                      – Olorin
                      Jan 21 at 1:25







                    3




                    3





                    Firefox is not always the default web browser

                    – storm
                    Jan 18 at 8:05





                    Firefox is not always the default web browser

                    – storm
                    Jan 18 at 8:05













                    ofcourse, we can use another browser, as per the choice

                    – Simpy Parveen
                    Jan 18 at 18:26





                    ofcourse, we can use another browser, as per the choice

                    – Simpy Parveen
                    Jan 18 at 18:26













                    Why wouldn't you just run firefox directly instead of getting the path and then running the path? At any rate, the answer misses the point: the question is about running the default browser, not Firefox.

                    – Olorin
                    Jan 21 at 1:25





                    Why wouldn't you just run firefox directly instead of getting the path and then running the path? At any rate, the answer misses the point: the question is about running the default browser, not Firefox.

                    – Olorin
                    Jan 21 at 1:25

















                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Ask Ubuntu!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f8252%2fhow-to-launch-default-web-browser-from-the-terminal%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Möglingen Índice Localización Historia Demografía Referencias Enlaces externos Menú de navegación48°53′18″N 9°07′45″E / 48.888333333333, 9.129166666666748°53′18″N 9°07′45″E / 48.888333333333, 9.1291666666667Sitio web oficial Mapa de Möglingen«Gemeinden in Deutschland nach Fläche, Bevölkerung und Postleitzahl am 30.09.2016»Möglingen

                    Virtualbox - Configuration error: Querying “UUID” failed (VERR_CFGM_VALUE_NOT_FOUND)“VERR_SUPLIB_WORLD_WRITABLE” error when trying to installing OS in virtualboxVirtual Box Kernel errorFailed to open a seesion for the virtual machineFailed to open a session for the virtual machineUbuntu 14.04 LTS Virtualbox errorcan't use VM VirtualBoxusing virtualboxI can't run Linux-64 Bit on VirtualBoxUnable to insert the virtual optical disk (VBoxguestaddition) in virtual machine for ubuntu server in win 10VirtuaBox in Ubuntu 18.04 Issues with Win10.ISO Installation

                    Torre de la Isleta Índice Véase también Referencias Bibliografía Enlaces externos Menú de navegación38°25′58″N 0°23′02″O / 38.43277778, -0.3838888938°25′58″N 0°23′02″O / 38.43277778, -0.38388889Torre de la Illeta de l’Horta o Torre Saleta. Base de datos de bienes inmuebles. Patrimonio Cultural. Secretaría de Estado de CulturaFicha BIC Torre de la Illeta de l’Horta. Dirección General de Patrimonio Cultural. Generalitat ValencianaLugares de interés. Ayuntamiento del CampelloTorre de la Isleta en CastillosNet.org