-
-
Notifications
You must be signed in to change notification settings - Fork 139
/
ddgr.1
344 lines (344 loc) · 8.97 KB
/
ddgr.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
.TH "DDGR" "1" "29 Dec 2023" "Version 2.2" "User Commands"
.SH NAME
ddgr \- DuckDuckGo from the terminal
.SH SYNOPSIS
.B ddgr [OPTIONS] [KEYWORD [KEYWORD ...]]
.SH DESCRIPTION
.B ddgr
is a command-line tool to search DuckDuckGo (html version). \fBddgr\fR shows the title, URL and text context for each result. Results are fetched in pages. Keyboard shortcuts are available for page navigation. 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.
.PP
.B Features
.PP
* Fast and clean; custom color
* Designed for maximum readability at minimum space
* Instant answers (supported by DDG html version)
* Custom number of results per page
* Navigation, browser integration
* Search and option completion scripts (Bash, Fish, Zsh)
* DuckDuckGo Bangs (along with completion)
* Open the first result in browser (I'm Feeling Ducky)
* REPL for continuous searches
* Keywords (e.g. `filetype:mime`, `site:somesite.com`)
* Limit search by time, specify region, disable safe search
* HTTPS proxy support, optionally disable User Agent
* Do Not Track set by default
* Supports custom url handler script or cmdline utility
* Thoroughly documented, man page with examples
* Minimal dependencies
.SH OPTIONS
.TP
.BI "-h, --help"
Show help text and exit.
.TP
.BI "-n, --num=" N
Show N results per page (default 10). N must be between 0 and 25. N=0 disables fixed paging and shows actual number of results fetched per page.
.TP
.BI "-r, --reg=" REG
Region-specific search e.g. 'us-en' for US (default); visit https://duckduckgo.com/params.
.TP
.BI "-C, --nocolor"
Disable color output.
.TP
.BI "--colors=" COLORS
Set output colors. Refer to the \fBCOLORS\fR section below for details.
.TP
.BI "-j, --ducky"
Open the first result in a web browser; implies \fB--noprompt\fR. Feeling Ducky?
.TP
.BI "-t, --time=" SPAN
Time limit search [d=past day, w=past week, m=past month, y=past year] (default=any time).
.TP
.BI "-w, --site=" SITE
Search a site using DuckDuckGo.
.TP
.BI "-x, --expand"
Expand URLs instead of showing only the domain name (default).
.TP
.BI "-p, --proxy=" URI
Tunnel traffic through an HTTP proxy. \fIURI\fR is of the form \fI[http[s]://][user:pwd@]host[:port]\fR. The proxy server must support HTTP CONNECT tunneling and must not block port 443 for the relevant DuckDuckGo hosts. If a proxy is not explicitly given, the \fIhttps_proxy\fR or \fIHTTPS_PROXY\fR environment variable (if available) is used instead.
.TP
.BI "--unsafe"
Disable safe search.
.TP
.BI "--noua"
Disable user agent. Results are fetched faster.
.TP
.BI "--json"
Output in JSON format; implies \fB--noprompt\fR.
.TP
.BI "--gb, --gui-browser"
Open a bang directly in a GUI browser.
.TP
.BI "--np, --noprompt"
Perform search and exit; do not prompt for further interactions.
.TP
.BI "--rev, --reverse"
List the entries in reversed order.
.TP
.BI "--url-handler=" UTIL
Custom script or command-line utility to open urls with.
.TP
.BI "--show-browser-logs"
Do not suppress browser output when opening result in browser; that is, connect stdout and stderr of the browser to ddgr'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 \fBBROWSER\fR environment variable is a known text-based browser: elinks, links, lynx, w3m or www-browser.
.TP
.BI "-v, --version"
Show version number and exit.
.TP
.BI "-d, --debug"
Enable debugging.
.SH OMNIPROMPT KEYS
.TP
.BI "n, p, f"
Fetch the next, previous or first set of search results.
.TP
.BI "index"
Open the result corresponding to index in browser.
.TP
.BI o " [index|range|a ...]"
Open space-separated result indices, numeric ranges or all indices, if 'a' is specified, in the browser.
.TP
.BI 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.
.TP
.BI d " keywords"
Initiate a new DuckDuckGo search for \fIkeywords\fR with original options. This key should be used to search omniprompt keys (including itself) and indices.
.TP
.BI "x"
Toggle url expansion.
.TP
.BI "c index"
Copy url to clipboard.
.TP
.BI "q, ^D, double Enter"
Exit ddgr.
.TP
.BI "?"
Show omniprompt help.
.TP
.BI *
Any other string initiates a new search with original options.
.SH COLORS
\fBddgr\fR allows you to customize the color scheme via a six-letter string, reminiscent of BSD \fBLSCOLORS\fR. The six letters represent the colors of
.IP - 2
indices
.PD 0 \" Change paragraph spacing to 0 in the list
.IP - 2
titles
.IP - 2
URLs
.IP - 2
metadata/publishing info
.IP - 2
abstracts
.IP - 2
prompts
.PD 1 \" Restore paragraph spacing
.TP
respectively. The six-letter string is passed in either as the argument to the \fB--colors\fR option, or as the value of the environment variable \fBDDGR_COLORS\fR.
.TP
We offer the following colors/styles:
.TS
tab(;) box;
l|l
-|-
l|l.
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
.TE
.TP
.TP
The default colors string is \fIoCdgxy\fR, which stands for
.IP - 2
bright cyan indices
.PD 0 \" Change paragraph spacing to 0 in the list
.IP - 2
bold green titles
.IP - 2
yellow URLs
.IP - 2
cyan metadata/publishing info
.IP - 2
normal abstracts
.IP - 2
reverse video prompts
.PD 1 \" Restore paragraph spacing
.TP
Note that
.IP - 2
Bright colors (implemented as \ex1b[90m - \ex1b[97m) may not be available in all color-capable terminal emulators;
.IP - 2
Some terminal emulators draw bold text in bright colors instead;
.IP - 2
Some terminal emulators only distinguish between bold and bright colors via a default-off switch.
.TP
Please consult the manual of your terminal emulator as well as \fIhttps://en.wikipedia.org/wiki/ANSI_escape_code\fR for details.
.SH ENVIRONMENT
.TP
.BI BROWSER
Overrides the default browser. Ref:
.I http://docs.python.org/library/webbrowser.html
.TP
.BI DDGR_COLORS
Refer to the \fBCOLORS\fR section.
.TP
.BI DISABLE_PROMPT_COLOR
Force a plain omniprompt if you are facing issues with colors at the prompt.
.TP
.BI "HTTPS_PROXY, https_proxy"
Refer to the \fB--proxy\fR option.
.SH EXAMPLES
.PP
.IP 1. 4
DuckDuckGo \fBhello world\fR:
.PP
.EX
.IP
.B ddgr hello world
.EE
.PP
.IP 2. 4
\fBI'm Feeling Ducky\fR search:
.PP
.EX
.IP
.B ddgr -j lucky ducks
.EE
.PP
.IP 3. 4
\fBDuckDuckGo Bang\fR search 'hello world' in Wikipedia:
.PP
.EX
.IP
.B ddgr !w hello world
.B ddgr \e!w hello world // bash-specific, need to escape ! on bash
.EE
.PP
.IP "" 4
Bangs work at the omniprompt too. To look up bangs, visit https://duckduckgo.com/bang?#bangs-list.
.PP
.IP 4. 4
\fBBang alias\fR to fire from the cmdline, open results in a GUI browser and exit:
.PP
.EX
.IP
.B alias bang='ddgr --gb --np'
.IP
.B bang !w hello world
.B bang \e!w hello world // bash-specific, need to escape ! on bash
.EE
.PP
.IP 5. 4
\fBWebsite specific\fR search:
.PP
.EX
.IP
.B ddgr -w amazon.com digital camera
.EE
.PP
.IP "" 4
Site specific search continues at omniprompt.
.EE
.PP
.IP 6. 4
Search for a \fBspecific file type\fR:
.PP
.EX
.IP
.B ddgr instrumental filetype:mp3
.EE
.PP
.IP 7. 4
Fetch results on IPL cricket from \fBIndia\fR in \fBEnglish\fR:
.PP
.EX
.IP
.B ddgr -r in-en IPL cricket
.EE
.PP
.IP "" 4
To find your region parameter token visit https://duckduckgo.com/params.
.PP
.IP 8. 4
Search \fBquoted text\fR:
.PP
.EX
.IP
.B ddgr it\(rs's a \(rs\(dqbeautiful world\(rs\(dq in spring
.EE
.PP
.IP 9. 4
Show \fBcomplete urls\fR in search results (instead of only domain name):
.PP
.EX
.IP
.B ddgr -x ddgr
.EE
.PP
.IP 10. 4
Use a \fBcustom color scheme\fR, e.g., one warm color scheme designed for Solarized Dark:
.PP
.EX
.IP
.B ddgr --colors bjdxxy hello world
.IP
.B DDGR_COLORS=bjdxxy ddgr hello world
.EE
.PP
.IP 11. 4
Tunnel traffic through an \fBHTTPS proxy\fR, e.g., a local Privoxy instance listening on port 8118:
.PP
.EX
.IP
.B ddgr --proxy localhost:8118 hello world
.EE
.PP
.IP "" 4
By default the environment variable \fIhttps_proxy\fR (or \fIHTTPS_PROXY\fR) is used, if defined.
.EE
.PP
.IP 12. 4
Look up \fBn\fR, \fBp\fR, \fBo\fR, \fBO\fR, \fBq\fR, \fBd keywords\fR or a result index at the \fBomniprompt\fR: as the omniprompt recognizes these keys or index strings as commands, you need to prefix them with \fBd\fR, e.g.,
.PP
.EX
.PD 0
.IP
.B d n
.IP
.B d d keywords
.IP
.B d 1
.PD
.EE
.SH AUTHOR
Arun Prakash Jana <[email protected]>
.SH HOME
.I https://github.com/jarun/ddgr
.SH REPORTING BUGS
.I https://github.com/jarun/ddgr/issues
.SH LICENSE
Copyright \(co 2016-2024 Arun Prakash Jana <[email protected]>
.PP
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
.br
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.