googler - Google from the command-line
Contents
Colors
googler allows you to customize the color scheme via a six-letter string, reminiscent of BSD LSCOLORS.
The six letters represent the colors of
- indices
- titles
- URLs
- metadata/publishing info (Google News only)
- abstracts
- prompts
respectively. The six-letter string is passed in either as the argument to the --colors option, or as the
value of the environment variable GOOGLER_COLORS.
We offer the following colors/styles:
┌────────┬───────────────────────────────────────────────────┐
│ Letter │ Color/Style │
├────────├───────────────────────────────────────────────────┤
│ a │ black │
│ b │ red │
│ c │ green │
│ d │ yellow │
│ e │ blue │
│ f │ magenta │
│ g │ cyan │
│ h │ white │
│ i │ bright black │
│ j │ bright red │
│ k │ bright green │
│ l │ bright yellow │
│ m │ bright blue │
│ n │ bright magenta │
│ o │ bright cyan │
│ p │ bright white │
│ A-H │ bold version of the lowercase-letter color │
│ I-P │ bold version of the lowercase-letter bright color │
│ x │ normal │
│ X │ bold │
│ y │ reverse video │
│ Y │ bold reverse video │
└────────┴───────────────────────────────────────────────────┘
The default colors string is GKlgxy, which stands for
- bold bright cyan indices
- bold bright green titles
- bright yellow URLs
- cyan metadata/publishing info
- normal abstracts
- reverse video prompts
Note that
- Bright colors (implemented as \x1b[90m - \x1b[97m) may not be available in all color-capable terminal
emulators;
- Some terminal emulators draw bold text in bright colors instead;
- Some terminal emulators only distinguish between bold and bright colors via a default-off switch.
Please consult the manual of your terminal emulator as well as
https://en.wikipedia.org/wiki/ANSI_escape_code for details.
Description
googler is a command-line tool to search Google (web, news, videos and site search) from the terminal.
Google site search works too. googler shows the title, URL and text context for each result. Results are
fetched in pages. Next or previous page navigation is possible using keyboard shortcuts. Results are
indexed and a result URL can be opened in a browser using the index number. There is no configuration
file as aliases serve the same purpose for this utility. Supports sequential searches in a single
instance.
Features
* Google Search, Google Site Search, Google News
* Fast and clean (no ads, stray URLs or clutter), custom color
* Navigate result pages from omniprompt, open URLs in browser
* Effortless keyword-based site search with googler @t add-on
* Search and option completion scripts for Bash, Zsh and Fish
* Fetch n results in a go, start at the n<sup>th</sup> result
* Disable automatic spelling correction and search exact keywords
* Specify duration, country/domain (default: worldwide/.com), language
* Google keywords (e.g. filetype:mime, site:somesite.com) support
* Open the first result directly in browser (as in I'm Feeling Lucky)
* Non-stop searches: fire new searches at omniprompt without exiting
* HTTPS proxy, User Agent, TLS 1.2 (default) support
* Comprehensive documentation, man page with handy usage examples
* Minimal dependencies
Environment
BROWSER
Overrides the default browser. Ref: http://docs.python.org/library/webbrowser.htmlGOOGLER_COLORS
Refer to the COLORS section.
DISABLE_PROMPT_COLOR
Force a plain omniprompt if you are facing issues with colors at the prompt.
https_proxy
Refer to the --proxy option.
DISABLE_URL_EXPANSION
Show the domain names in search results instead of the expanded URL.
Examples
1. Google helloworld:
googlerhelloworld
2. Fetch 15results updated within the last 14months, starting from the 3rdresult for the keywords
junglebook in site imdb.com:
googler-n15-s3-tm14-wimdb.comjunglebook
3. Read recent news on gadgets:
googler-Ngadgets
4. Fetch results on IPL cricket from GoogleIndia server in English:
googler-cin-lenIPLcricket
5. Search quotedtext:
googlerit\'sa\"beautifulworld\"inspring
6. Search for a specificfiletype:
googlerinstrumentalfiletype:mp3
7. Disable automaticspellingcorrection, e.g. fetch results for googler instead of google:
googler-xgoogler
8. I'mfeelinglucky search:
googler-jleatherjackets
9. Websitespecific search:
googler-wamazon.com-webay.comdigitalcamera
Site specific search continues at omniprompt.
10. Alias to find definitionsofwords:
aliasdefine='googler-n2define'
11. Look up n, p, o, O, q, gkeywords or a result index at the omniprompt: as the omniprompt recognizes
these keys or index strings as commands, you need to prefix them with g, e.g.,
gnggkeywordsg1
12. Input and output redirection:
googler-Chelloworld<input>output
Note that -C is required to avoid printing control characters (for colored output).
13. Pipe output:
googler-Chelloworld|teeoutput
14. Use a customcolorscheme, e.g., one warm color scheme designed for Solarized Dark:
googler--colorsbjdxxygoogleGOOGLER_COLORS=bjdxxygooglergoogle
15. Tunnel traffic through an HTTPSproxy, e.g., a local Privoxy instance listening on port 8118:
googler--proxylocalhost:8118google
By default the environment variable https_proxy is used, if defined.
16. Quote multiple search keywords to auto-complete (using completion script):
googler'hellow<TAB>Googler @T
googler@t is a convenient add-on to Google Site Search with unique keywords. While googler has an
integrated option to search a site, it could be simplified further with aliases. The file googler_at
(https://github.com/jarun/googler/blob/master/auto-completion/googler_at/googler_at) contains a list of
website search aliases. To source it, run:
sourcegoogler_at
or
.googler_at
With googler@t, the following command searches Wikipedia for hexspeak:
@whexspeak
Other googler options can be combined. The shell can be configured to be source the file at start-up for
further convenience.
All the aliases start with the @ symbol (hence the name googler@t) and there is minimum chance they will
conflict with any shell commands. Users can add new aliases to the file.
Home
https://github.com/jarun/googler
License
Copyright © 2008 Henri Hakkinen
Copyright © 2015-2021 Arun Prakash Jana <engineerarun@gmail.com>
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent
permitted by law.
Version 4.3.2 21 Jan 2021 GOOGLER(1)
Name
googler - Google from the command-line
Omniprompt Keys
n,p Fetch the next or previous set of search results.
index Open the result corresponding to index in browser.
f Jump to the first page.
o[index|range|a...]
Open space-separated result indices, numeric ranges (sitelinks unsupported in ranges) or all
indices, if 'a' is specified, in the browser. Open the current search in the browser, if no
arguments.
O[index|range|a...]
Works similar to key 'o', but tries to ignore text-based browsers (even if BROWSER is set) and
open links in a GUI browser.
gkeywords
Initiate a new Google search for keywords with original options. This key should be used to search
omniprompt keys (including itself) and indices.
cindex
Copy url to clipboard.
u Toggle url expansion.
q,^D,doubleEnter
Exit googler.
? Show omniprompt help.
* Any other string initiates a new search with original options.
Options
-h,--help
Show help text and exit.
-s,--start=N
Start at the Nth result.
-n,--count=N
Show N results (default 10).
-N,--news
Show results from news section.
-c,--tld=TLD
Country-specific search with top-level domain .TLD, e.g., in for India.
-l,--lang=LANG
Search for the language LANG, e.g., fi for Finnish.
-g,--geoloc=CC
Country-specific geolocation search with country code CC, e.g. 'in' for India. Country codes are
the same as top-level domains.
-x,--exact
Disable automatic spelling correction. Search exact keywords.
-C,--nocolor
Disable color output.
--colors=COLORS
Set output colors. Refer to the COLORS section below for details.
-j,--first,--lucky
Open the first result in a web browser; implies --noprompt. Feeling Lucky?
-t,--time=dN
Time limit search [h5 (5 hrs), d5 (5 days), w5 (5 weeks), m5 (5 months), y5 (5 years)].
-w,--site=SITE
Search a site using Google.
-e,--exclude=EXCLUDE
Exclude site from results.
--unfilter
Do not omit similar results.
-p,--proxy=PROXY
Tunnel traffic through an HTTP proxy. PROXY is of the form
[http://][user:password@]proxyhost[:port]. The proxy server must support HTTP CONNECT tunneling
and must not block port 443 for the relevant Google hosts. If a proxy is not explicitly given, the
https_proxy environment variable (if available) is used instead.
--noua Disable user agent. Results are fetched faster.
--notweak
Disable TCP optimizations. Negotiate Transport Layer Security protocol instead of forcing TLS 1.2
(on Python 3.4 and above). Should be used only in case of connection issues.
--json Output in JSON format; implies --noprompt.
--url-handler=UTIL
Custom script or command-line utility to open urls with.
--show-browser-logs
Do not suppress browser output when opening result in browser; that is, connect stdout and stderr
of the browser to googler's stdout and stderr instead of /dev/null. By default, browser output is
suppressed (due to certain graphical browsers spewing messages to console) unless the BROWSER
environment variable is a known text-based browser: elinks, links, lynx, w3m or www-browser.
--np,--noprompt
Perform search and exit; do not prompt for further interactions.
-u,--upgrade
Perform in-place self-upgrade. By default, the latest stable version is used. However, the latest
git master is used instead if --include-git is also supplied. This mechanism is not available on
Windows (including Cygwin), and if you installed googler with a package manager, this mechanism
may have been disabled by your packager at packaging or install time.
--include-git
See --upgrade.
-v,--version
Show version number and exit.
-d,--debug
Enable debugging.
Reporting Bugs
https://github.com/jarun/googler/issues
Synopsis
googler[OPTIONS][KEYWORD[KEYWORD...]]
