Launch Default Web Browser From Console

Interesting, never realize there are so many ways. I should update my way of writing step-by-step guide.

1. sensible-browser
$ sinsible-browser http://google.com
$ man sensible-browser | grep DESCRIPTION -A 3
DESCRIPTION
sensible-editor, sensible-pager and sensible-browser make sensible decisions on which editor, pager, and web browser to call, respectively. Programs in Debian can use these scripts as their default editor, pager, or web browser or emulate their behavior.

2. xdg-open
$ xdg-open http://google.com
$ man xdg-open | grep DESCRIPTION -A 3
DESCRIPTION
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.

3. x-www-browser
$ x-www-browser http://google.com
$ man x-www-browser
No manual entry for x-www-browser
See 'man 7 undocumented' for help when manual pages are not available.

$ ls -l `which x-www-browser`
lrwxrwxrwx 1 root root 31 Feb 22 21:08 /usr/bin/x-www-browser -> /etc/alternatives/x-www-browser

$ ls -l /etc/alternatives/x-www-browser
lrwxrwxrwx 1 root root 29 Feb 23 04:10 /etc/alternatives/x-www-browser -> /usr/bin/google-chrome-stable

No wonder, is Debian alternative system.
$ sudo update-alternatives --list x-www-browser
/usr/bin/google-chrome-stable
/usr/bin/iceweasel
/usr/bin/midori

4. gnome-open
$ gnome-open http://google.com
$ man gnome-open | grep DESCRIPTION -A 2
DESCRIPTION
This program opens files using file handlers configured in GNOME.

No comments:

Post a Comment