I think xdg-open
is the command you are looking for.
NAME
xdg-open - opens a file or URL in the user's preferred application
SYNOPSIS
xdg-open {file | URL}
xdg-open {--help | --manual | --version}
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.
eg: xdg-open index.php
This will open index.php in gedit(if you are using gnome).
If you want to open a url in browser
xdg-open http://google.com
this will open google.com in your default browser.
xdg-open
is a wrapper script - it will use the desktop environment's tool (gio open
, gvfs-open
, kde-open
, gnome-open
, dde-open
, exo-open
, and a host of other such tools). It is also installed by default, and very likely to work on past, current and future versions (on the other hand, gvfs-open
and gnome-open
have been deprecated, and may be unavailable in future releases).
I go to the start menu, then:
System Settings->Default Applications->Web Browser
and then I tell it to open http/https in:
google-chrome
Now links in choqok (or any other kde application) are opened in chrome,
also, if I do alt+f2
and type "man:file"
for instance, the man page opens in chrome.
I also modified the default email client so that emails are launched using gmail using the following command:
google-chrome "https://mail.google.com/mail/?view=cm&fs=1&tf=1&to="%t
Best Answer
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~/.bashrc
Add the above line in the last,
Alternative GUI Method: