Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A ruby gem to give you the power of Google Search in your command line.
Ruby
branch: master

README.md

google

The power of Google Search in your command line.

The CLI displays results from the Google Web Search API, allows you to page through the results, and choose a page to view, all without leaving the command line.

Hosted on RubyGems.

Screenshot of `google` in action!

Installation

gem install google # Requires Ruby 1.9

Usage Examples

Typing google --help will list all the available commands. They are also listed here.

The google gem is a simple tool to search Gooogle with via a CLI.
Usage:
    google [options] "my search query string here"
where [options] are:
        --page, -p <i>:   Start by showing the <i>th result page. (Default: 1)
        --size, -s <i>:   Show <i> results on each SERP. Must be between 1 and 8. (Default: 4)
      --result, -r <i>:   Skip the SERP and show the <i>th result.
           --lucky, -l:   I'm feeling lucky! Skip the SERP and show the first result. (Alias to --result 1)
  --no-readability, -e:   Filter the results through readability to get rid of extra content. (Default: true)
     --no-markdown, -m:   Change the results from raw HTML to markdown. (Default: true)
         --version, -v:   Print the version and exit.
            --help, -h:   Show this information and exit.

I'm Feeling Lucky into Less

google -l 'how to install nvidia drivers debian squeeze' | less

Search on a single site

google 'site:randsinrepose.com NADD'

Vanity Search

google '"Kerrick Long" -inurl:kerrick -inurl:kerricklong'

Features

  • You have access to all the search operators you've come to know and love in Google Search.

  • If using the --lucky or --result flags, you can pipe the results into any other unix command.

  • Results are filtered through Readability, so you only get the relevant content. (Shoutout to Ruby Readability!)

  • Results are shown in markdown for a good balance between legibility and document heirarchy. (Shoutout to reverse_markdown!)

  • Results pages are formatted to look like a Google SERP, including colors, domains, descriptions, and bold search matches. (Shoutout to formatador!)

  • You can pipe a result into another unix command! At the prompt, type the number of the result, followed by a pipe as normal. Note that utilities such as less and more that need to control the display don't work.

For example,

Enter N or P for pagination, E or Q to quit, or a number to see that result.
> 3 | espeak -a 200 -v en-us

Supported Ruby Versions

This library has only been tested against Ruby 1.9.3. Other versions might be supported, but they haven't been tested.

Notable Forks

  • 21croissants/google: Google Search in your command line, then copy a search result link to your clipboard (OS X, Linux, Win)

Acknowledgements

This gem is Powered by Google.

Copyright

Copyright (c) 2012 Kerrick Long. See LICENSE for details.

Dependencies

Something went wrong with that request. Please try again.