Saturday, April 10, 2010

Google via the command line

Sometimes opening a terminal is a lot faster than opening a browser. If you like me, then you will enjoy having some extra supercow powers at the command line.

Here is how to set up Google on the command line.

1. Install the surfraw essentials

apt-get install surfraw surfraw-extra w3m

2. Setup surfraw
sudo gedit /etc/surfraw.conf

Change the following:

SURFRAW_graphical=no

SURFRAW_text_browser=/usr/bin/w3m

save.

3. Now you have three choices:

A)  You can stick with the default action, which is:
sr google <subject>

B) You can add an alias to your bashrc
gedit /home/<user>/.bashrc

ADD under aliases section:
alias google="sr google"

Save

C) You can add the surfraw ELVIS   dirctory to yout PATH variable

usually /usr/lib/surfraw/ or /usr/local/lib/surfraw/

eg. PATH=/usr/lib/surfraw/:$PATH

This is probably not such a good option since it will also give you instant access to the 80 or so "Elvi" which are  in the surfraw directory and part of the Surfraw suite. Since  some of the commands might conflict with commands already on your system,  we might want to first check to see which Surfraw "Elvi" commands and powers you need and which ones you don't.

Remove the ELVIS  you don't need by deleting or moving the ELVIS from the /usr/lib/surfraw/ and placing it in /usr/local/lib/surfraw/ or vice versa. You really only want one surfraw directory in your path!!!


That's right ELVIS isn't dead, he just lives on as the Shell Users' Revolutionary Front Against the World wide web.

You can still command ELVIS to do your bidding.

More info

2 comments:

  1. [...] application that provides access to google services via the command line. In April we showed you how to do this, the unofficial way using surfraw. Now you can do it with the blessing of the worlds most popular search engine company, [...]

    ReplyDelete