Linux: command to open URL in default browser

后端 未结 10 1887
青春惊慌失措
青春惊慌失措 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 17:58

    ###1     Desktop's -or- Console use:
    sensible-browser $URL; # Opinion: best. Target preferred APP.
    # My-Server translates to: w3m [options] [URL or filename] 
    ## [ -z "$BROWSER" ] && echo "Empty"
    # Then, Set the BROWSER environment variable to your desired browser.
    
    ###2     Alternative 
    # Desktop (if [command-not-found] out-Dated)
    x-www-browser http://tv.jimmylandstudios.xyz # firefox
    
    ###3     !- A Must Know -!
    # Desktop (/usr/share/applications/*.desktop)
    xdg-open $URI # opens about anything on Linux (w/ .desktop file)
    

提交回复
热议问题