Surfraw: web search from terminal

           ______  _     _  ______   _______  ______   _______  _  _  _
          / _____)(_)   (_)(_____ \ (_______)(_____ \ (_______)(_)(_)(_)
         ( (____   _     _  _____) ) _____    _____) ) _______  _  _  _
          \____ \ | |   | ||  __  / |  ___)  |  __  / |  ___  || || || |
          _____) )| |___| || |  \ \ | |      | |  \ \ | |   | || || || |
         (______/  \_____/ |_|   |_||_|      |_|   |_||_|   |_| \_____/

You might have heard the allegations about search giants recording your data or tracking it. And you might have heard about Julian Assange. Would it be surprising to know that Assange wrote a cmdline perl based tool to search Google (and many other web services) at lightning speed… a tool sans the tracking? I guess not.

Such a tool exists, written in 2000. It’s Surfraw.

Each supported search engine or database (like Google, Wikipedia, Slashdot etc.) is called an elvi in Surflaw, apparently as a tribute to Elvis (Ref: Wikipedia).

Features

  • Search tons of websites in addition to Google. To get the full list
    $ surfraw -elvi
  • Supports bookmarks
  • Supports bash completion (elvi names, options, arguments) using <Tab>
  • Use Google Translate, images, news, mps, video etc.
  • Supports safe search filter
  • Works best with text-based browsers like links, lynx, w3m

Installation

To install Surfraw on Ubuntu, run:

$ sudo apt-get install surfraw surfraw-extra

Configuration

The user-specific configuration file is ~/.surfraw.conf. The syntax is simple – defyn is used for boolean configuration variables, def for all others. Example configuration:

def SURFRAW_text_browser      /usr/bin/lynx
defyn SURFRAW_graphical       yes
def SURFRAW_graphical_browser firefox
def SURFRAW_results           10
def SURFRAW_lang              uk

Usage

Surfraw has many options, many of them specific to the elvi (search service). If you do not want to type surfraw all the time, sue the alias sr.

  • The general syntax
    sr elviname [options] search terms..
  • Search Google with multiple terms and limit results to 100
    $ sr google -results=100 foo "bar baz" bam
  • Search Wikipedia
    $ sr wikipedia surfraw
  • Search a phrase
    $ sr austlii -method=phrase dog like
  • Get a rhyming word
    $ surfraw rhyme Julian
  • Search a RFC about mime
    $ sr rfc s/mime
  • Translate a word
    $ sr translate logiciel

Webpage: Surfraw (with love, from Julian Assange)

One thought on “Surfraw: web search from terminal”

Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s