Linux: command to open URL in default browser

后端 未结 10 1727
青春惊慌失措
青春惊慌失措 2020-12-07 17:47

What command we have to execute (from Java, but that should not matter) on Linux (different common distributions) to open a given URL in the default browser?

相关标签:
10条回答
  • 2020-12-07 18:04

    For opening a URL in the browser through the terminal, CentOS 7 users can use gio open command. For example, if you want to open google.com then gio open https://www.google.com will open google.com URL in the browser.

    xdg-open https://www.google.com will also work but this tool has been deprecated, Use gio open instead. I prefer this as this is the easiest way to open a URL using a command from the terminal.

    0 讨论(0)
  • 2020-12-07 18:07

    I believe the simplest method would be to use Python:

    python -m webbrowser "http://www.example.com/"
    
    0 讨论(0)
  • 2020-12-07 18:11

    The most cross-distribution one is xdg-open http://stackoverflow.com

    0 讨论(0)
  • 2020-12-07 18:14

    on ubuntu you can try gnome-open.

    $ gnome-open http://www.google.com

    0 讨论(0)
提交回复
热议问题