1GOOGLER(1) User Commands GOOGLER(1)
2
3
4
6 googler - Google from the command-line
7
9 googler [OPTIONS] [KEYWORD [KEYWORD ...]]
10
12 googler is a command-line tool to search Google (Web & News) from the
13 terminal. Google site search works too. googler shows the title, URL
14 and text context for each result. Results are fetched in pages. Next or
15 previous page navigation is possible using keyboard shortcuts. Results
16 are indexed and a result URL can be opened in a browser using the index
17 number. There is no configuration file as aliases serve the same pur‐
18 pose for this utility. Supports sequential searches in a single
19 instance.
20
21 Features
22
23 * Google Search, Google Site Search, Google News
24 * Fast and clean (no ads, stray URLs or clutter), custom color
25 * Navigate result pages from omniprompt, open URLs in browser
26 * Effortless keyword-based site search with googler @t add-on
27 * Search and option completion scripts for Bash, Zsh and Fish
28 * Fetch n results in a go, start at the n<sup>th</sup> result
29 * Disable automatic spelling correction and search exact keywords
30 * Specify duration, country/domain (default: worldwide/.com), lan‐
31 guage
32 * Google keywords (e.g. filetype:mime, site:somesite.com) support
33 * Open the first result directly in browser (as in I'm Feeling Lucky)
34 * Non-stop searches: fire new searches at omniprompt without exiting
35 * HTTPS proxy, User Agent, TLS 1.2 (default) support
36 * Comprehensive documentation, man page with handy usage examples
37 * Minimal dependencies
38
40 -h, --help
41 Show help text and exit.
42
43 -s, --start=N
44 Start at the Nth result.
45
46 -n, --count=N
47 Show N results (default 10).
48
49 -N, --news
50 Show results from news section.
51
52 -c, --tld=TLD
53 Country-specific search with top-level domain .TLD, e.g., in for
54 India.
55
56 -l, --lang=LANG
57 Search for the language LANG, e.g., fi for Finnish.
58
59 -x, --exact
60 Disable automatic spelling correction. Search exact keywords.
61
62 -C, --nocolor
63 Disable color output.
64
65 --colors=COLORS
66 Set output colors. Refer to the COLORS section below for
67 details.
68
69 -j, --first, --lucky
70 Open the first result in a web browser; implies --noprompt.
71 Feeling Lucky?
72
73 -t, --time=dN
74 Time limit search [h5 (5 hrs), d5 (5 days), w5 (5 weeks), m5 (5
75 months), y5 (5 years)].
76
77 -w, --site=SITE
78 Search a site using Google.
79
80 --unfilter
81 Do not omit similar results.
82
83 -p, --proxy=PROXY
84 Tunnel traffic through an HTTP proxy. PROXY is of the form
85 [http://][user:password@]proxyhost[:port]. The proxy server must
86 support HTTP CONNECT tunneling and must not block port 443 for
87 the relevant Google hosts. If a proxy is not explicitly given,
88 the https_proxy environment variable (if available) is used
89 instead.
90
91 --noua Disable user agent. Results are fetched faster.
92
93 --notweak
94 Disable TCP optimizations. Negotiate Transport Layer Security
95 protocol instead of forcing TLS 1.2 (on Python 3.4 and above).
96 Should be used only in case of connection issues.
97
98 --json Output in JSON format; implies --noprompt.
99
100 --url-handler=UTIL
101 Custom script or command-line utility to open urls with.
102
103 --show-browser-logs
104 Do not suppress browser output when opening result in browser;
105 that is, connect stdout and stderr of the browser to googler's
106 stdout and stderr instead of /dev/null. By default, browser out‐
107 put is suppressed (due to certain graphical browsers spewing
108 messages to console) unless the BROWSER environment variable is
109 a known text-based browser: elinks, links, lynx, w3m or www-
110 browser.
111
112 --np, --noprompt
113 Perform search and exit; do not prompt for further interactions.
114
115 -u, --upgrade
116 Perform in-place self-upgrade. By default, the latest stable
117 version is used. However, the latest git master is used instead
118 if --include-git is also supplied. This mechanism is not avail‐
119 able on Windows (including Cygwin), and if you installed googler
120 with a package manager, this mechanism may have been disabled by
121 your packager at packaging or install time.
122
123 --include-git
124 See --upgrade.
125
126 -v, --version
127 Show version number and exit.
128
129 -d, --debug
130 Enable debugging.
131
133 n, p Fetch the next or previous set of search results.
134
135 index Open the result corresponding to index in browser.
136
137 f Jump to the first page.
138
139 o [index|range|a ...]
140 Open space-separated result indices, numeric ranges (sitelinks
141 unsupported in ranges) or all indices, if 'a' is specified, in
142 the browser. Open the current search in the browser, if no argu‐
143 ments.
144
145 O [index|range|a ...]
146 Works similar to key 'o', but tries to ignore text-based
147 browsers (even if BROWSER is set) and open links in a GUI
148 browser.
149
150 g keywords
151 Initiate a new Google search for keywords with original options.
152 This key should be used to search omniprompt keys (including
153 itself) and indices.
154
155 c index
156 Copy url to clipboard.
157
158 u Toggle url expansion.
159
160 q, ^D, double Enter
161 Exit googler.
162
163 ? Show omniprompt help.
164
165 * Any other string initiates a new search with original options.
166
168 googler @t is a convenient add-on to Google Site Search with unique
169 keywords. While googler has an integrated option to search a site, it
170 could be simplified further with aliases. The file googler_at
171 (https://github.com/jarun/googler/blob/master/auto-comple‐
172 tion/googler_at/googler_at) contains a list of website search aliases.
173 To source it, run:
174
175 source googler_at
176
177 or
178
179 . googler_at
180
181 With googler @t, the following command searches Wikipedia for hexspeak:
182
183 @w hexspeak
184
185 Other googler options can be combined. The shell can be configured to
186 be source the file at start-up for further convenience.
187
188 All the aliases start with the @ symbol (hence the name googler @t) and
189 there is minimum chance they will conflict with any shell commands.
190 Users can add new aliases to the file.
191
193 googler allows you to customize the color scheme via a six-letter
194 string, reminiscent of BSD LSCOLORS. The six letters represent the col‐
195 ors of
196
197 - indices
198 - titles
199 - URLs
200 - metadata/publishing info (Google News only)
201 - abstracts
202 - prompts
203
204 respectively. The six-letter string is passed in either as the argument
205 to the --colors option, or as the value of the environment variable
206 GOOGLER_COLORS.
207
208 We offer the following colors/styles:
209
210 ┌───────┬───────────────────────────────────────────────────┐
211 │Letter │ Color/Style │
212 ├───────├───────────────────────────────────────────────────┤
213 │a │ black │
214 │b │ red │
215 │c │ green │
216 │d │ yellow │
217 │e │ blue │
218 │f │ magenta │
219 │g │ cyan │
220 │h │ white │
221 │i │ bright black │
222 │j │ bright red │
223 │k │ bright green │
224 │l │ bright yellow │
225 │m │ bright blue │
226 │n │ bright magenta │
227 │o │ bright cyan │
228 │p │ bright white │
229 │A-H │ bold version of the lowercase-letter color │
230 │I-P │ bold version of the lowercase-letter bright color │
231 │x │ normal │
232 │X │ bold │
233 │y │ reverse video │
234 │Y │ bold reverse video │
235 └───────┴───────────────────────────────────────────────────┘
236
237 The default colors string is GKlgxy, which stands for
238
239 - bold bright cyan indices
240 - bold bright green titles
241 - bright yellow URLs
242 - cyan metadata/publishing info
243 - normal abstracts
244 - reverse video prompts
245
246 Note that
247
248 - Bright colors (implemented as \x1b[90m - \x1b[97m) may not be
249 available in all color-capable terminal emulators;
250
251 - Some terminal emulators draw bold text in bright colors
252 instead;
253
254 - Some terminal emulators only distinguish between bold and
255 bright colors via a default-off switch.
256
257 Please consult the manual of your terminal emulator as well as
258 https://en.wikipedia.org/wiki/ANSI_escape_code for details.
259
261 BROWSER
262 Overrides the default browser. Ref:
263 http://docs.python.org/library/webbrowser.html
264
265 GOOGLER_COLORS
266 Refer to the COLORS section.
267
268 DISABLE_PROMPT_COLOR
269 Force a plain omniprompt if you are facing issues with
270 colors at the prompt.
271
272 https_proxy
273 Refer to the --proxy option.
274
275 DISABLE_URL_EXPANSION
276 Show the domain names in search results instead of the
277 expanded URL.
278
280 1. Google hello world:
281
282 googler hello world
283
284 2. Fetch 15 results updated within the last 14 months, starting
285 from the 3rd result for the keywords jungle book in site
286 imdb.com:
287
288 googler -n 15 -s 3 -t m14 -w imdb.com jungle book
289
290 3. Read recent news on gadgets:
291
292 googler -N gadgets
293
294 4. Fetch results on IPL cricket from Google India server in
295 English:
296
297 googler -c in -l en IPL cricket
298
299 5. Search quoted text:
300
301 googler it\'s a \"beautiful world\" in spring
302
303 6. Search for a specific file type:
304
305 googler instrumental filetype:mp3
306
307 7. Disable automatic spelling correction, e.g. fetch results
308 for googler instead of google:
309
310 googler -x googler
311
312 8. I'm feeling lucky search:
313
314 googler -j leather jackets
315
316 9. Website specific search:
317
318 googler -w amazon.com -w ebay.com digital camera
319
320 Site specific search continues at omniprompt.
321
322 10. Alias to find definitions of words:
323
324 alias define='googler -n 2 define'
325
326 11. Look up n, p, o, O, q, g keywords or a result index at the
327 omniprompt: as the omniprompt recognizes these keys or index
328 strings as commands, you need to prefix them with g, e.g.,
329
330 g n
331 g g keywords
332 g 1
333
334 12. Input and output redirection:
335
336 googler -C hello world < input > output
337
338 Note that -C is required to avoid printing control charac‐
339 ters (for colored output).
340
341 13. Pipe output:
342
343 googler -C hello world | tee output
344
345 14. Use a custom color scheme, e.g., one warm color scheme
346 designed for Solarized Dark:
347
348 googler --colors bjdxxy google
349
350 GOOGLER_COLORS=bjdxxy googler google
351
352 15. Tunnel traffic through an HTTPS proxy, e.g., a local Privoxy
353 instance listening on port 8118:
354
355 googler --proxy localhost:8118 google
356
357 By default the environment variable https_proxy is used, if
358 defined.
359
360 16. Quote multiple search keywords to auto-complete (using com‐
361 pletion script):
362
363 googler 'hello w<TAB>
364
366 Henri Hakkinen
367 Arun Prakash Jana <engineerarun@gmail.com>
368 Zhiming Wang <zmwangx@gmail.com>
369
371 https://github.com/jarun/googler
372
374 https://github.com/jarun/googler/issues
375
377 Copyright © 2008 Henri Hakkinen
378 Copyright © 2015-2019 Arun Prakash Jana <engineerarun@gmail.com>
379
380 License GPLv3+: GNU GPL version 3 or later
381 <http://gnu.org/licenses/gpl.html>.
382 This is free software: you are free to change and redistribute
383 it. There is NO WARRANTY, to the extent permitted by law.
384
385
386
387Version 4.0 27 Nov 2019 GOOGLER(1)