Pages

02 January 2013

302. Surfraw on debian (and goosh)

I like shells, so I was pretty chuffed to discover this: http://goosh.org
This is basically a google shell simulator running in a gui browser -- not a true shell in any respect, so while it's really neat, but not terribly useful in itself. See below for how to get it set up.

It got me looking for true command line alternatives though, such as surfraw. While it was originally started by Julian Assange in 2000 it has been maintained by others during the past ten years.

Regardless, surfraw really does bring the power of the command line and the web together in a useful way.

To get set up with surfraw, do
sudo apt-get install surfraw
sr wikipedia surfraw

which opens a new window in your default browser -- e.g. chromium if that's what you have. This means that while you shoot of your command in the terminal, you'll then have to switch to your desktop environment. To force surfraw to use a more sensible alternative, e.g. w3m, install w3m and then create ~/.surfraw.conf and put
SURFRAW_text_browser=w3m SURFRAW_text_browser_args=-dump SURFRAW_graphical=no
in it. The -dump allows you to grep through the output but makes the whole experience less interactive -- remove that line to make things open properly in w3m instead.

w3m takes a bit of getting used to, so a cheat sheet might help: http://wiki.titan2x.com/index.php?title=W3m_cheat_sheet

A lot of it makes sense if you're used to vim though.

The next step is to explore what modules (elvi) are available e.g.
sr -elvi
acronym -- Look for acronyms definitions (www.acronymfinder.com) ask -- Question the web using Ask Jeeves (www.ask.com) bbcnews -- Search BBC News (news.bbc.co.uk) bing -- Search the web using Microsoft's Bing (www.bing.com) currency -- Convert currencies with the Universal Currency Converter (www.xe.net/ucc) debbugs -- Search the debian BTS (bugs.debian.org) duckduckgo -- Securely search the web using duckduckgo (www.duckduckgo.com) google -- Search the web using Google (www.google.com) pgpkeys -- Search the PGP key database scholar -- Search Google Scholar (scholar.google.com) wikipedia -- Search the free encyclopedia wikipedia youtube -- Search YouTube (www.youtube.com)

Hours of fun to be had:
sr wikipedia surfraw|less
sr google -results=100 -q "nwchem cosmo"|grep verahill

etc. It's probably not going to change your life, but time will tell whether there's an advantage of using surfraw over just (e)links or w3m.


Goosh
There's an unofficial script which will help you install it. If you haven't got $EDITOR set, you can do export EDITOR=/usr/bin/vim or export EDITOR=/usr/bin/nano first. For some reason the value set using update-alternatives --config editor doesn't translate into $EDITOR. The editor is needed to edit the config file during installation.
cd ~/tmp
wget "https://raw.github.com/tolecnal/goosh-installer/master/goosh.sh"
chmod +x goosh.sh
./goosh.sh
sudo mkdir /var/www/goosh
sudo cp $HOME/goosh/index.php /var/www/goosh

and open http://localhost/goosh in your browser. This offers  basically no advantage over just navigating to http://goosh.org

No comments:

Post a Comment