View Full Version : [SOLVED] Open website in browser using terminal?
mdpalow
December 14th, 2007, 07:34 PM
Is there a terminal command that would allow you to open a browser and go to a specific website?
thank you...
cnr437
December 14th, 2007, 07:52 PM
lynx or curl
Natr0n
December 14th, 2007, 07:53 PM
[insert browser of choice here] "www.thewebsite.com"
Should work pretty much the same for any browser as far as I know. Do not include the brackets.
mdpalow
December 14th, 2007, 08:02 PM
thank you Natr0n...
Geez... I did that, but just realized when I scrolled through my previous commands I had a space in the name that was messing it up.
hmm, I'm wondering though - what if you didn't want the command to be browser specific? I have a feeling that's not going to work without a script checking to see what browser you're running..
Any thoughts?
LaRoza
December 14th, 2007, 08:14 PM
For Ubuntu, expect Firefox to be installed, so you can use:
firefox http://ubuntuforums.org
engla
December 14th, 2007, 08:15 PM
The command
x-www-browser should point to the user's preferred browser.
mdpalow
December 14th, 2007, 08:23 PM
Thanks LaRoza...
I'm just wondering how many people don't use Firefox and therefore might uninstall it in favor of say.... opera.
mdpalow
December 14th, 2007, 08:25 PM
The command
x-www-browser should point to the user's preferred browser.
now that's what I was hoping for... thanks.
One question about this command. I ran it and it brought up Opera, which surprised me a bit. Granted, I had downloaded Opera the other night just to take a look at it.
Do you think 'x-www-browser' brought up Opera because it was the last browser I installed?
thanks...
LaRoza
December 14th, 2007, 10:34 PM
Thanks LaRoza...
I'm just wondering how many people don't use Firefox and therefore might uninstall it in favor of say.... opera.
I didn't know of x-www-browser.
I use Opera myself, and have uninstalled Firefox on Ubuntu before.
You might have made Opera your default.
pedro_orange
December 15th, 2007, 12:21 AM
Browser companies like you using their browser, so usually in the install somewhere it says "Make x default browser"
Would be interesting to know where 'buntu saved this information.
jpkotta
December 15th, 2007, 07:52 PM
You can change x-www-browser with update-alternatives. The setting is implemented as /usr/bin/x-www-browser symlinked to the desired browser binary, IIRC. I think any package that uses the Debian alternatives system makes that package the default when it is installed.
You can set it with
sudo update-alternatives --config x-www-browser
I've seen a few programs that look at the BROWSER environment variable.
engla
December 17th, 2007, 09:10 PM
Yes well I think I was wrong. That would start the system's preferred browser.
I'll go back and make it even simpler. I think this command is really going to respect the user's settings
gnome-open <uri>
This general command will handle any file path or url, file paths being opened in their default applications of course. (And OTOH, this is gnome-specific :( )
Edit: Hehe, one more try?
xdg-open <uri>
This should be desktop-independent since that is what freedesktop and xdg stand for. However, this is from the package 'xdg-utils' and I'm not certain it is universally available.
mdpalow
December 18th, 2007, 08:27 PM
hi engla,
Thank you for this post.
I had actually unsubscribed from it because I thought it had been resolved (hence the late thank you), but I just came back and saw your solution and it's actually a very good one.
thanks again...
Endolith
December 12th, 2008, 11:34 PM
Wait. Which is the correct way to open the browser, if you're writing a system script?
x-www-browser is a symlink to a symlink to a symlink and is global for all users
gnome-open is for gnome only
exo-open is for XFCE only?
kde-open is for KDE only?
xdg-open is supposed to be cross-desktop, and apparently calls all of the above depending on your desktop
Are there others? Which is the canonical way to open a URL in the user's preferred browser?
mssever
December 12th, 2008, 11:48 PM
Wait. Which is the correct way to open the browser, if you're writing a system script?
x-www-browser is a symlink to a symlink to a symlink and is global for all users
gnome-open is for gnome only
exo-open is for XFCE only?
kde-open is for KDE only?
xdg-open is supposed to be cross-desktop, and apparently calls gnome-open if you use Gnome?
Are there others? Which is the canonical way to open a URL in the user's preferred browser?
My preference is xdg-open, since it's the most flexible. x-www-browser isn't user-configurable. The others are desktop-specific. xdg-open seems to be the best of all worlds.
zeezam
December 15th, 2008, 11:41 PM
Trying to open a website with opera over ssh but got failed to open the X server.
I try with
/path/opera -fullscreen -display=user:0 &
any ideas?
mssever
December 16th, 2008, 01:51 AM
Trying to open a website with opera over ssh but got failed to open the X server.
I try with
/path/opera -fullscreen -display=user:0 &
any ideas?
Just use the same command to open opera as you would if you were opening it on the local machine. SSH automatically sets $DISPLAY to the correct value, so you don't need to manually specify it. Of course, this presupposes that you're using the SSH option ForwardX11.
zeezam
December 16th, 2008, 08:25 AM
Just use the same command to open opera as you would if you were opening it on the local machine. SSH automatically sets $DISPLAY to the correct value, so you don't need to manually specify it. Of course, this presupposes that you're using the SSH option ForwardX11.
Just got;
ERROR: ld.so: object 'libjvm.so' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object 'libawt.so' from LD_PRELOAD cannot be preloaded: ignored.
opera: cannot connect to X server
opera: Fatal error on creating Qt application object
Endolith
December 16th, 2008, 04:21 PM
You are using ssh -X, right?
nathand28
December 16th, 2008, 09:17 PM
Simple, use
gnome-open "website"
Without the quotes and use http:// or https:// at the start.
(EDIT) Looked at the post above by Engel, and he already posted this.
Endolith
December 16th, 2008, 09:20 PM
Simple, use
gnome-open "website"
Without the quotes and use http:// or https:// at the start.
xdg-open does the same thing, but works in Gnome, KDE, etc.
mssever
December 16th, 2008, 09:34 PM
Simple, use
gnome-open "website"
Without the quotes and use http:// or https:// at the start.
Better to leave the quotes there. Many URLs include characters that have special meaning to the shell and will cause problems if not quoted.
zeezam
December 17th, 2008, 09:34 AM
You are using ssh -X, right?
No, I tried with that and then opera starts on my computer even if I run the command in terminal via ssh on another computer. I want to start the browser on the remote computer.
mssever
December 17th, 2008, 10:02 PM
No, I tried with that and then opera starts on my computer even if I run the command in terminal via ssh on another computer. I want to start the browser on the remote computer.
Wait. You're trying to make the window for the opera installed on your local machine appear on a remote machine? If so, I have no idea how to do that. My instructions were for opening a remote opera's window on the local machine.
zeezam
December 29th, 2008, 08:50 AM
Wait. You're trying to make the window for the opera installed on your local machine appear on a remote machine? If so, I have no idea how to do that. My instructions were for opening a remote opera's window on the local machine.
Ok.
With firefox is it this parameter:
/usr/bin/firefox --display=:0.0
zeezam
January 5th, 2009, 05:44 PM
Ok.
With firefox is it this parameter:
/usr/bin/firefox --display=:0.0
Any?
Zugzwang
January 5th, 2009, 06:12 PM
Any?
You're in the wrong forum here (this one is about programming). Anyway, for security, you might need to be the user who is logged in at that machine locally at the moment.
junke1990
September 15th, 2009, 05:42 PM
you can if you add -Y to the -X ;)
Fhernd
August 1st, 2010, 08:57 PM
I prefer this method (using Google Chrome):
Alt + F2
Type the next command on the textfield:
google-chrome http://www.feedly.com/
Then activate the Run in terminal checkbox.
Lastly, click on Run button (Alt+R).
Regards.
shantiq
December 15th, 2011, 07:12 PM
an intersting trick if you have compiz [can also be done with metacity and no doubt unity] installed is to open your favourite website from a hotkey
open CCSM to install
sudo apt-get install ccsm
in General tick commands box then double-click commands
and enter for example
firefox http://facebook.com
then click on key-bindings and now pick a hotkey say F4 or CTRL+F4
now simply click F4 or CTRL+F4 when you want to see facebook
samarthmath
October 17th, 2012, 06:48 AM
One more command to open the system's preferred browser is:
sensible-browser www.google.com
This works.
Powered by vBulletin® Version 4.2.2 Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.