17

I am configuring hotkeys for commands and want a way to open websites from the command line.

For example, how would I open YouTube directly in Firefox without first opening the browser and then entering the address for YouTube?

1
  • links2 https://jadi.gitbooks.io/lpic1/content/
    – EsmaeelE
    Dec 15, 2018 at 21:48

4 Answers 4

20

Have a look at xdg-open which uses the default program for opening the link:

xdg-open http://example.com

some documentation from Ubuntu:

xdg-open - opens a file or URL in the user’s preferred application

0
11

Use the command

firefox http://www.youtube.com

This should do it. 8 )

1
  • 1
    that did it!! just had to restart firefox. Thx :D
    – MalteK
    Feb 20, 2014 at 17:50
4

If you only need to open it in the background use:

wget http://askubuntu.com

To download a page (optionally mirror sub pages):

wget --mirror -p --convert-links -P ~/Desktop/ http://askubuntu.com/users/182026/kamil

If you want to open it and see it

and you use firefox:

firefox http://askubuntu.com

or you use google chrome

google-chrome http://askubuntu.com
9
  • oh that's a nice trick. thx a lot :D
    – MalteK
    Feb 20, 2014 at 17:52
  • I just tried it, but it doesn't work...
    – MalteK
    Feb 20, 2014 at 17:58
  • @ubuntu.stuff which one doesn't work for you?
    – kamil
    Feb 20, 2014 at 18:01
  • well the very top one. wget does not do anything...
    – MalteK
    Feb 20, 2014 at 18:05
  • Indeed, it does, but you're not seeing what happened. do you want to save the page?
    – kamil
    Feb 20, 2014 at 18:13
3

If you want to use the web page from an xterm/command line then you can install lynx on Ubuntu 12.04 LTS. I have lynx-cur installed.

apt-get install lynx-cur

I don't think you need any special repositories,

lynx http://askubuntu.com

I use it to do screen scrapes

wget can be used as follows if you want to look at what is going by:

wget -O- -S http://askubuntu.com | more

This will send the output to stdout, and give you the server-response info

Not the answer you're looking for? Browse other questions tagged .