@builder.io/dev-tools-windows-x64 1.19.9 → 1.19.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2178 @@
1
+ .TH RG 1 2023-11-26 "14.1.0 (rev e50df40a19)" "User Commands"
2
+ .
3
+ .
4
+ .SH NAME
5
+ rg \- recursively search the current directory for lines matching a pattern
6
+ .
7
+ .
8
+ .SH SYNOPSIS
9
+ .\" I considered using GNU troff's .SY and .YS "synopsis" macros here, but it
10
+ .\" looks like they aren't portable. Specifically, they don't appear to be in
11
+ .\" BSD's mdoc used on macOS.
12
+ .sp
13
+ \fBrg\fP [\fIOPTIONS\fP] \fIPATTERN\fP [\fIPATH\fP...]
14
+ .sp
15
+ \fBrg\fP [\fIOPTIONS\fP] \fB\-e\fP \fIPATTERN\fP... [\fIPATH\fP...]
16
+ .sp
17
+ \fBrg\fP [\fIOPTIONS\fP] \fB\-f\fP \fIPATTERNFILE\fP... [\fIPATH\fP...]
18
+ .sp
19
+ \fBrg\fP [\fIOPTIONS\fP] \fB\-\-files\fP [\fIPATH\fP...]
20
+ .sp
21
+ \fBrg\fP [\fIOPTIONS\fP] \fB\-\-type\-list\fP
22
+ .sp
23
+ \fIcommand\fP | \fBrg\fP [\fIOPTIONS\fP] \fIPATTERN\fP
24
+ .sp
25
+ \fBrg\fP [\fIOPTIONS\fP] \fB\-\-help\fP
26
+ .sp
27
+ \fBrg\fP [\fIOPTIONS\fP] \fB\-\-version\fP
28
+ .
29
+ .
30
+ .SH DESCRIPTION
31
+ ripgrep (rg) recursively searches the current directory for a regex pattern.
32
+ By default, ripgrep will respect your \fB.gitignore\fP and automatically skip
33
+ hidden files/directories and binary files.
34
+ .sp
35
+ ripgrep's default regex engine uses finite automata and guarantees linear
36
+ time searching. Because of this, features like backreferences and arbitrary
37
+ look-around are not supported. However, if ripgrep is built with PCRE2,
38
+ then the \fB\-P/\-\-pcre2\fP flag can be used to enable backreferences and
39
+ look-around.
40
+ .sp
41
+ ripgrep supports configuration files. Set \fBRIPGREP_CONFIG_PATH\fP to a
42
+ configuration file. The file can specify one shell argument per line. Lines
43
+ starting with \fB#\fP are ignored. For more details, see \fBCONFIGURATION
44
+ FILES\fP below.
45
+ .sp
46
+ ripgrep will automatically detect if stdin exists and search stdin for a regex
47
+ pattern, e.g. \fBls | rg foo\fP. In some environments, stdin may exist when
48
+ it shouldn't. To turn off stdin detection, one can explicitly specify the
49
+ directory to search, e.g. \fBrg foo ./\fP.
50
+ .sp
51
+ Like other tools such as \fBls\fP, ripgrep will alter its output depending on
52
+ whether stdout is connected to a tty. By default, when printing a tty, ripgrep
53
+ will enable colors, line numbers and a heading format that lists each matching
54
+ file path once instead of once per matching line.
55
+ .sp
56
+ Tip: to disable all smart filtering and make ripgrep behave a bit more like
57
+ classical grep, use \fBrg -uuu\fP.
58
+ .
59
+ .
60
+ .SH REGEX SYNTAX
61
+ ripgrep uses Rust's regex engine by default, which documents its syntax:
62
+ \fIhttps://docs.rs/regex/1.*/regex/#syntax\fP
63
+ .sp
64
+ ripgrep uses byte-oriented regexes, which has some additional documentation:
65
+ \fIhttps://docs.rs/regex/1.*/regex/bytes/index.html#syntax\fP
66
+ .sp
67
+ To a first approximation, ripgrep uses Perl-like regexes without look-around or
68
+ backreferences. This makes them very similar to the "extended" (ERE) regular
69
+ expressions supported by *egrep*, but with a few additional features like
70
+ Unicode character classes.
71
+ .sp
72
+ If you're using ripgrep with the \fB\-P/\-\-pcre2\fP flag, then please consult
73
+ \fIhttps://www.pcre.org\fP or the PCRE2 man pages for documentation on the
74
+ supported syntax.
75
+ .
76
+ .
77
+ .SH POSITIONAL ARGUMENTS
78
+ .TP 12
79
+ \fIPATTERN\fP
80
+ A regular expression used for searching. To match a pattern beginning with a
81
+ dash, use the \fB\-e/\-\-regexp\fP option.
82
+ .TP 12
83
+ \fIPATH\fP
84
+ A file or directory to search. Directories are searched recursively. File paths
85
+ specified explicitly on the command line override glob and ignore rules.
86
+ .
87
+ .
88
+ .SH OPTIONS
89
+ This section documents all flags that ripgrep accepts. Flags are grouped into
90
+ categories below according to their function.
91
+ .sp
92
+ Note that many options can be turned on and off. In some cases, those flags are
93
+ not listed explicitly below. For example, the \fB\-\-column\fP flag (listed
94
+ below) enables column numbers in ripgrep's output, but the \fB\-\-no\-column\fP
95
+ flag (not listed below) disables them. The reverse can also exist. For example,
96
+ the \fB\-\-no\-ignore\fP flag (listed below) disables ripgrep's \fBgitignore\fP
97
+ logic, but the \fB\-\-ignore\fP flag (not listed below) enables it. These
98
+ flags are useful for overriding a ripgrep configuration file (or alias) on the
99
+ command line. Each flag's documentation notes whether an inverted flag exists.
100
+ In all cases, the flag specified last takes precedence.
101
+ .
102
+ .SS INPUT OPTIONS
103
+ \fB\-e\fP \fIPATTERN\fP, \fB\-\-regexp\fP=\fIPATTERN\fP
104
+ .RS 4
105
+ A pattern to search for. This option can be provided multiple times, where
106
+ all patterns given are searched, in addition to any patterns provided by
107
+ \fB\-f/\-\-file\fP. Lines matching at least one of the provided patterns are printed.
108
+ This flag can also be used when searching for patterns that start with a dash.
109
+ .sp
110
+ For example, to search for the literal \fB\-foo\fP:
111
+ .sp
112
+ .EX
113
+ rg \-e \-foo
114
+ .EE
115
+ .sp
116
+ You can also use the special \fB\-\-\fP delimiter to indicate that no more
117
+ flags will be provided. Namely, the following is equivalent to the above:
118
+ .sp
119
+ .EX
120
+ rg \-\- \-foo
121
+ .EE
122
+ .sp
123
+ When \fB\-f/\-\-file\fP or \fB\-e/\-\-regexp\fP is used, then ripgrep treats all positional
124
+ arguments as files or directories to search.
125
+ .RE
126
+ .sp
127
+ \fB\-f\fP \fIPATTERNFILE\fP, \fB\-\-file\fP=\fIPATTERNFILE\fP
128
+ .RS 4
129
+ Search for patterns from the given file, with one pattern per line. When this
130
+ flag is used multiple times or in combination with the \fB\-e/\-\-regexp\fP flag, then
131
+ all patterns provided are searched. Empty pattern lines will match all input
132
+ lines, and the newline is not counted as part of the pattern.
133
+ .sp
134
+ A line is printed if and only if it matches at least one of the patterns.
135
+ .sp
136
+ When \fIPATTERNFILE\fP is \fB-\fP, then \fBstdin\fP will be read for the
137
+ patterns.
138
+ .sp
139
+ When \fB\-f/\-\-file\fP or \fB\-e/\-\-regexp\fP is used, then ripgrep treats all positional
140
+ arguments as files or directories to search.
141
+ .RE
142
+ .sp
143
+ \fB\-\-pre\fP=\fICOMMAND\fP
144
+ .RS 4
145
+ For each input \fIPATH\fP, this flag causes ripgrep to search the standard
146
+ output of \fICOMMAND\fP \fIPATH\fP instead of the contents of \fIPATH\fP.
147
+ This option expects the \fICOMMAND\fP program to either be a path or to be
148
+ available in your \fBPATH\fP. Either an empty string \fICOMMAND\fP or the
149
+ \fB\-\-no\-pre\fP flag will disable this behavior.
150
+ .sp
151
+ .TP 12
152
+ \fBWARNING\fP
153
+ When this flag is set, ripgrep will unconditionally spawn a process for every
154
+ file that is searched. Therefore, this can incur an unnecessarily large
155
+ performance penalty if you don't otherwise need the flexibility offered by this
156
+ flag. One possible mitigation to this is to use the \fB\-\-pre-glob\fP flag to
157
+ limit which files a preprocessor is run with.
158
+ .PP
159
+ A preprocessor is not run when ripgrep is searching stdin.
160
+ .sp
161
+ When searching over sets of files that may require one of several
162
+ preprocessors, \fICOMMAND\fP should be a wrapper program which first classifies
163
+ \fIPATH\fP based on magic numbers/content or based on the \fIPATH\fP name and
164
+ then dispatches to an appropriate preprocessor. Each \fICOMMAND\fP also has its
165
+ standard input connected to \fIPATH\fP for convenience.
166
+ .sp
167
+ For example, a shell script for \fICOMMAND\fP might look like:
168
+ .sp
169
+ .EX
170
+ case "$1" in
171
+ *.pdf)
172
+ exec pdftotext "$1" -
173
+ ;;
174
+ *)
175
+ case $(file "$1") in
176
+ *Zstandard*)
177
+ exec pzstd -cdq
178
+ ;;
179
+ *)
180
+ exec cat
181
+ ;;
182
+ esac
183
+ ;;
184
+ esac
185
+ .EE
186
+ .sp
187
+ The above script uses \fBpdftotext\fP to convert a PDF file to plain text. For
188
+ all other files, the script uses the \fBfile\fP utility to sniff the type of
189
+ the file based on its contents. If it is a compressed file in the Zstandard
190
+ format, then \fBpzstd\fP is used to decompress the contents to stdout.
191
+ .sp
192
+ This overrides the \fB\-z/\-\-search-zip\fP flag.
193
+ .RE
194
+ .sp
195
+ \fB\-\-pre-glob\fP=\fIGLOB\fP
196
+ .RS 4
197
+ This flag works in conjunction with the \fB\-\-pre\fP flag. Namely, when one or
198
+ more \fB\-\-pre-glob\fP flags are given, then only files that match the given set
199
+ of globs will be handed to the command specified by the \fB\-\-pre\fP flag. Any
200
+ non-matching files will be searched without using the preprocessor command.
201
+ .sp
202
+ This flag is useful when searching many files with the \fB\-\-pre\fP flag.
203
+ Namely, it provides the ability to avoid process overhead for files that
204
+ don't need preprocessing. For example, given the following shell script,
205
+ \fIpre-pdftotext\fP:
206
+ .sp
207
+ .EX
208
+ #!/bin/sh
209
+ pdftotext "$1" -
210
+ .EE
211
+ .sp
212
+ then it is possible to use \fB\-\-pre\fP \fIpre-pdftotext\fP \fB--pre-glob
213
+ '\fP\fI*.pdf\fP\fB'\fP to make it so ripgrep only executes the
214
+ \fIpre-pdftotext\fP command on files with a \fI.pdf\fP extension.
215
+ .sp
216
+ Multiple \fB\-\-pre-glob\fP flags may be used. Globbing rules match
217
+ \fBgitignore\fP globs. Precede a glob with a \fB!\fP to exclude it.
218
+ .sp
219
+ This flag has no effect if the \fB\-\-pre\fP flag is not used.
220
+ .RE
221
+ .sp
222
+ \fB\-z\fP, \fB\-\-search-zip\fP
223
+ .RS 4
224
+ This flag instructs ripgrep to search in compressed files. Currently gzip,
225
+ bzip2, xz, LZ4, LZMA, Brotli and Zstd files are supported. This option expects
226
+ the decompression binaries (such as \fBgzip\fP) to be available in your
227
+ \fBPATH\fP. If the required binaries are not found, then ripgrep will not
228
+ emit an error messages by default. Use the \fB\-\-debug\fP flag to see more
229
+ information.
230
+ .sp
231
+ Note that this flag does not make ripgrep search archive formats as directory
232
+ trees. It only makes ripgrep detect compressed files and then decompress them
233
+ before searching their contents as it would any other file.
234
+ .sp
235
+ This overrides the \fB\-\-pre\fP flag.
236
+ .sp
237
+ This flag can be disabled with \fB\-\-no-search-zip\fP.
238
+ .RE
239
+
240
+ .
241
+ .SS SEARCH OPTIONS
242
+ \fB\-s\fP, \fB\-\-case-sensitive\fP
243
+ .RS 4
244
+ Execute the search case sensitively. This is the default mode.
245
+ .sp
246
+ This is a global option that applies to all patterns given to ripgrep.
247
+ Individual patterns can still be matched case insensitively by using inline
248
+ regex flags. For example, \fB(?i)abc\fP will match \fBabc\fP case insensitively
249
+ even when this flag is used.
250
+ .sp
251
+ This flag overrides the \fB\-i/\-\-ignore-case\fP and \fB\-S/\-\-smart-case\fP flags.
252
+ .RE
253
+ .sp
254
+ \fB\-\-crlf\fP
255
+ .RS 4
256
+ When enabled, ripgrep will treat CRLF (\fB\\r\\n\fP) as a line terminator
257
+ instead of just \fB\\n\fP.
258
+ .sp
259
+ Principally, this permits the line anchor assertions \fB^\fP and \fB$\fP in
260
+ regex patterns to treat CRLF, CR or LF as line terminators instead of just LF.
261
+ Note that they will never match between a CR and a LF. CRLF is treated as one
262
+ single line terminator.
263
+ .sp
264
+ When using the default regex engine, CRLF support can also be enabled inside
265
+ the pattern with the \fBR\fP flag. For example, \fB(?R:$)\fP will match just
266
+ before either CR or LF, but never between CR and LF.
267
+ .sp
268
+ This flag overrides \fB\-\-null-data\fP.
269
+ .sp
270
+ This flag can be disabled with \fB\-\-no-crlf\fP.
271
+ .RE
272
+ .sp
273
+ \fB\-\-dfa-size-limit\fP=\fINUM+SUFFIX?\fP
274
+ .RS 4
275
+ The upper size limit of the regex DFA. The default limit is something generous
276
+ for any single pattern or for many smallish patterns. This should only be
277
+ changed on very large regex inputs where the (slower) fallback regex engine may
278
+ otherwise be used if the limit is reached.
279
+ .sp
280
+ The input format accepts suffixes of \fBK\fP, \fBM\fP or \fBG\fP which
281
+ correspond to kilobytes, megabytes and gigabytes, respectively. If no suffix is
282
+ provided the input is treated as bytes.
283
+ .RE
284
+ .sp
285
+ \fB\-E\fP \fIENCODING\fP, \fB\-\-encoding\fP=\fIENCODING\fP
286
+ .RS 4
287
+ Specify the text encoding that ripgrep will use on all files searched. The
288
+ default value is \fBauto\fP, which will cause ripgrep to do a best effort
289
+ automatic detection of encoding on a per-file basis. Automatic detection in
290
+ this case only applies to files that begin with a UTF-8 or UTF-16 byte-order
291
+ mark (BOM). No other automatic detection is performed. One can also specify
292
+ \fBnone\fP which will then completely disable BOM sniffing and always result
293
+ in searching the raw bytes, including a BOM if it's present, regardless of its
294
+ encoding.
295
+ .sp
296
+ Other supported values can be found in the list of labels here:
297
+ \fIhttps://encoding.spec.whatwg.org/#concept-encoding-get\fP.
298
+ .sp
299
+ For more details on encoding and how ripgrep deals with it, see \fBGUIDE.md\fP.
300
+ .sp
301
+ The encoding detection that ripgrep uses can be reverted to its automatic mode
302
+ via the \fB\-\-no-encoding\fP flag.
303
+ .RE
304
+ .sp
305
+ \fB\-\-engine\fP=\fIENGINE\fP
306
+ .RS 4
307
+ Specify which regular expression engine to use. When you choose a regex engine,
308
+ it applies that choice for every regex provided to ripgrep (e.g., via multiple
309
+ \fB\-e/\-\-regexp\fP or \fB\-f/\-\-file\fP flags).
310
+ .sp
311
+ Accepted values are \fBdefault\fP, \fBpcre2\fP, or \fBauto\fP.
312
+ .sp
313
+ The default value is \fBdefault\fP, which is usually the fastest and should be
314
+ good for most use cases. The \fBpcre2\fP engine is generally useful when you
315
+ want to use features such as look-around or backreferences. \fBauto\fP will
316
+ dynamically choose between supported regex engines depending on the features
317
+ used in a pattern on a best effort basis.
318
+ .sp
319
+ Note that the \fBpcre2\fP engine is an optional ripgrep feature. If PCRE2
320
+ wasn't included in your build of ripgrep, then using this flag will result in
321
+ ripgrep printing an error message and exiting.
322
+ .sp
323
+ This overrides previous uses of the \fB\-P/\-\-pcre2\fP and \fB\-\-auto-hybrid-regex\fP
324
+ flags.
325
+ .RE
326
+ .sp
327
+ \fB\-F\fP, \fB\-\-fixed-strings\fP
328
+ .RS 4
329
+ Treat all patterns as literals instead of as regular expressions. When this
330
+ flag is used, special regular expression meta characters such as \fB.(){}*+\fP
331
+ should not need be escaped.
332
+ .sp
333
+ This flag can be disabled with \fB\-\-no-fixed-strings\fP.
334
+ .RE
335
+ .sp
336
+ \fB\-i\fP, \fB\-\-ignore-case\fP
337
+ .RS 4
338
+ When this flag is provided, all patterns will be searched case insensitively.
339
+ The case insensitivity rules used by ripgrep's default regex engine conform to
340
+ Unicode's "simple" case folding rules.
341
+ .sp
342
+ This is a global option that applies to all patterns given to ripgrep.
343
+ Individual patterns can still be matched case sensitively by using
344
+ inline regex flags. For example, \fB(?\-i)abc\fP will match \fBabc\fP
345
+ case sensitively even when this flag is used.
346
+ .sp
347
+ This flag overrides \fB\-s/\-\-case-sensitive\fP and \fB\-S/\-\-smart-case\fP.
348
+ .RE
349
+ .sp
350
+ \fB\-v\fP, \fB\-\-invert-match\fP
351
+ .RS 4
352
+ This flag inverts matching. That is, instead of printing lines that match,
353
+ ripgrep will print lines that don't match.
354
+ .sp
355
+ Note that this only inverts line-by-line matching. For example, combining this
356
+ flag with \fB\-l/\-\-files-with-matches\fP will emit files that contain any lines
357
+ that do not match the patterns given. That's not the same as, for example,
358
+ \fB\-\-files-without-match\fP, which will emit files that do not contain any
359
+ matching lines.
360
+ .sp
361
+ This flag can be disabled with \fB\-\-no-invert-match\fP.
362
+ .RE
363
+ .sp
364
+ \fB\-x\fP, \fB\-\-line-regexp\fP
365
+ .RS 4
366
+ When enabled, ripgrep will only show matches surrounded by line boundaries.
367
+ This is equivalent to surrounding every pattern with \fB^\fP and \fB$\fP. In
368
+ other words, this only prints lines where the entire line participates in a
369
+ match.
370
+ .sp
371
+ This overrides the \fB\-w/\-\-word-regexp\fP flag.
372
+ .RE
373
+ .sp
374
+ \fB\-m\fP \fINUM\fP, \fB\-\-max-count\fP=\fINUM\fP
375
+ .RS 4
376
+ Limit the number of matching lines per file searched to \fINUM\fP.
377
+ .sp
378
+ Note that \fB0\fP is a legal value but not likely to be useful. When used,
379
+ ripgrep won't search anything.
380
+ .RE
381
+ .sp
382
+ \fB\-\-mmap\fP
383
+ .RS 4
384
+ When enabled, ripgrep will search using memory maps when possible. This is
385
+ enabled by default when ripgrep thinks it will be faster.
386
+ .sp
387
+ Memory map searching cannot be used in all circumstances. For example, when
388
+ searching virtual files or streams likes \fBstdin\fP. In such cases, memory
389
+ maps will not be used even when this flag is enabled.
390
+ .sp
391
+ Note that ripgrep may abort unexpectedly when memory maps are used if it
392
+ searches a file that is simultaneously truncated. Users can opt out of this
393
+ possibility by disabling memory maps.
394
+ .sp
395
+ This flag can be disabled with \fB\-\-no-mmap\fP.
396
+ .RE
397
+ .sp
398
+ \fB\-U\fP, \fB\-\-multiline\fP
399
+ .RS 4
400
+ This flag enable searching across multiple lines.
401
+ .sp
402
+ When multiline mode is enabled, ripgrep will lift the restriction that a
403
+ match cannot include a line terminator. For example, when multiline mode
404
+ is not enabled (the default), then the regex \fB\\p{any}\fP will match any
405
+ Unicode codepoint other than \fB\\n\fP. Similarly, the regex \fB\\n\fP is
406
+ explicitly forbidden, and if you try to use it, ripgrep will return an error.
407
+ However, when multiline mode is enabled, \fB\\p{any}\fP will match any Unicode
408
+ codepoint, including \fB\\n\fP, and regexes like \fB\\n\fP are permitted.
409
+ .sp
410
+ An important caveat is that multiline mode does not change the match semantics
411
+ of \fB.\fP. Namely, in most regex matchers, a \fB.\fP will by default match any
412
+ character other than \fB\\n\fP, and this is true in ripgrep as well. In order
413
+ to make \fB.\fP match \fB\\n\fP, you must enable the "dot all" flag inside the
414
+ regex. For example, both \fB(?s).\fP and \fB(?s:.)\fP have the same semantics,
415
+ where \fB.\fP will match any character, including \fB\\n\fP. Alternatively, the
416
+ \fB\-\-multiline-dotall\fP flag may be passed to make the "dot all" behavior the
417
+ default. This flag only applies when multiline search is enabled.
418
+ .sp
419
+ There is no limit on the number of the lines that a single match can span.
420
+ .sp
421
+ \fBWARNING\fP: Because of how the underlying regex engine works, multiline
422
+ searches may be slower than normal line-oriented searches, and they may also
423
+ use more memory. In particular, when multiline mode is enabled, ripgrep
424
+ requires that each file it searches is laid out contiguously in memory (either
425
+ by reading it onto the heap or by memory-mapping it). Things that cannot be
426
+ memory-mapped (such as \fBstdin\fP) will be consumed until EOF before searching
427
+ can begin. In general, ripgrep will only do these things when necessary.
428
+ Specifically, if the \fB\-U/\-\-multiline\fP flag is provided but the regex does
429
+ not contain patterns that would match \fB\\n\fP characters, then ripgrep
430
+ will automatically avoid reading each file into memory before searching it.
431
+ Nevertheless, if you only care about matches spanning at most one line, then it
432
+ is always better to disable multiline mode.
433
+ .sp
434
+ This overrides the \fB\-\-stop-on-nonmatch\fP flag.
435
+ .sp
436
+ This flag can be disabled with \fB\-\-no-multiline\fP.
437
+ .RE
438
+ .sp
439
+ \fB\-\-multiline-dotall\fP
440
+ .RS 4
441
+ This flag enables "dot all" mode in all regex patterns. This causes \fB.\fP to
442
+ match line terminators when multiline searching is enabled. This flag has no
443
+ effect if multiline searching isn't enabled with the \fB\-U/\-\-multiline\fP flag.
444
+ .sp
445
+ Normally, a \fB.\fP will match any character except line terminators. While
446
+ this behavior typically isn't relevant for line-oriented matching (since
447
+ matches can span at most one line), this can be useful when searching with the
448
+ \fB\-U/\-\-multiline\fP flag. By default, multiline mode runs without "dot all" mode
449
+ enabled.
450
+ .sp
451
+ This flag is generally intended to be used in an alias or your ripgrep config
452
+ file if you prefer "dot all" semantics by default. Note that regardless of
453
+ whether this flag is used, "dot all" semantics can still be controlled via
454
+ inline flags in the regex pattern itself, e.g., \fB(?s:.)\fP always enables
455
+ "dot all" whereas \fB(?-s:.)\fP always disables "dot all". Moreover, you
456
+ can use character classes like \fB\\p{any}\fP to match any Unicode codepoint
457
+ regardless of whether "dot all" mode is enabled or not.
458
+ .sp
459
+ This flag can be disabled with \fB\-\-no-multiline-dotall\fP.
460
+ .RE
461
+ .sp
462
+ \fB\-\-no-unicode\fP
463
+ .RS 4
464
+ This flag disables Unicode mode for all patterns given to ripgrep.
465
+ .sp
466
+ By default, ripgrep will enable "Unicode mode" in all of its regexes. This has
467
+ a number of consequences:
468
+ .sp
469
+ .IP \(bu 3n
470
+ \fB.\fP will only match valid UTF-8 encoded Unicode scalar values.
471
+ .sp
472
+ .IP \(bu 3n
473
+ Classes like \fB\\w\fP, \fB\\s\fP, \fB\\d\fP are all Unicode aware and much
474
+ bigger than their ASCII only versions.
475
+ .sp
476
+ .IP \(bu 3n
477
+ Case insensitive matching will use Unicode case folding.
478
+ .sp
479
+ .IP \(bu 3n
480
+ A large array of classes like \fB\\p{Emoji}\fP are available. (Although the
481
+ specific set of classes available varies based on the regex engine. In general,
482
+ the default regex engine has more classes available to it.)
483
+ .sp
484
+ .IP \(bu 3n
485
+ Word boundaries (\fB\\b\fP and \fB\\B\fP) use the Unicode definition of a word
486
+ character.
487
+ .PP
488
+ In some cases it can be desirable to turn these things off. This flag will do
489
+ exactly that. For example, Unicode mode can sometimes have a negative impact
490
+ on performance, especially when things like \fB\\w\fP are used frequently
491
+ (including via bounded repetitions like \fB\\w{100}\fP) when only their ASCII
492
+ interpretation is needed.
493
+ .sp
494
+ This flag can be disabled with \fB\-\-unicode\fP.
495
+ .RE
496
+ .sp
497
+ \fB\-\-null-data\fP
498
+ .RS 4
499
+ Enabling this flag causes ripgrep to use \fBNUL\fP as a line terminator instead
500
+ of the default of \fP\\n\fP.
501
+ .sp
502
+ This is useful when searching large binary files that would otherwise have
503
+ very long lines if \fB\\n\fP were used as the line terminator. In particular,
504
+ ripgrep requires that, at a minimum, each line must fit into memory. Using
505
+ \fBNUL\fP instead can be a useful stopgap to keep memory requirements low and
506
+ avoid OOM (out of memory) conditions.
507
+ .sp
508
+ This is also useful for processing NUL delimited data, such as that emitted
509
+ when using ripgrep's \fB\-0/\-\-null\fP flag or \fBfind\fP's \fB\-\-print0\fP flag.
510
+ .sp
511
+ Using this flag implies \fB\-a/\-\-text\fP. It also overrides \fB\-\-crlf\fP.
512
+ .RE
513
+ .sp
514
+ \fB\-P\fP, \fB\-\-pcre2\fP
515
+ .RS 4
516
+ When this flag is present, ripgrep will use the PCRE2 regex engine instead of
517
+ its default regex engine.
518
+ .sp
519
+ This is generally useful when you want to use features such as look-around
520
+ or backreferences.
521
+ .sp
522
+ Using this flag is the same as passing \fB\-\-engine=pcre2\fP. Users may
523
+ instead elect to use \fB\-\-engine=auto\fP to ask ripgrep to automatically
524
+ select the right regex engine based on the patterns given. This flag and the
525
+ \fB\-\-engine\fP flag override one another.
526
+ .sp
527
+ Note that PCRE2 is an optional ripgrep feature. If PCRE2 wasn't included in
528
+ your build of ripgrep, then using this flag will result in ripgrep printing
529
+ an error message and exiting. PCRE2 may also have worse user experience in
530
+ some cases, since it has fewer introspection APIs than ripgrep's default
531
+ regex engine. For example, if you use a \fB\\n\fP in a PCRE2 regex without
532
+ the \fB\-U/\-\-multiline\fP flag, then ripgrep will silently fail to match anything
533
+ instead of reporting an error immediately (like it does with the default regex
534
+ engine).
535
+ .sp
536
+ This flag can be disabled with \fB\-\-no-pcre2\fP.
537
+ .RE
538
+ .sp
539
+ \fB\-\-regex-size-limit\fP=\fINUM+SUFFIX?\fP
540
+ .RS 4
541
+ The size limit of the compiled regex, where the compiled regex generally
542
+ corresponds to a single object in memory that can match all of the patterns
543
+ provided to ripgrep. The default limit is generous enough that most reasonable
544
+ patterns (or even a small number of them) should fit.
545
+ .sp
546
+ This useful to change when you explicitly want to let ripgrep spend potentially
547
+ much more time and/or memory building a regex matcher.
548
+ .sp
549
+ The input format accepts suffixes of \fBK\fP, \fBM\fP or \fBG\fP which
550
+ correspond to kilobytes, megabytes and gigabytes, respectively. If no suffix is
551
+ provided the input is treated as bytes.
552
+ .RE
553
+ .sp
554
+ \fB\-S\fP, \fB\-\-smart-case\fP
555
+ .RS 4
556
+ This flag instructs ripgrep to searches case insensitively if the pattern is
557
+ all lowercase. Otherwise, ripgrep will search case sensitively.
558
+ .sp
559
+ A pattern is considered all lowercase if both of the following rules hold:
560
+ .sp
561
+ .IP \(bu 3n
562
+ First, the pattern contains at least one literal character. For example,
563
+ \fBa\\w\fP contains a literal (\fBa\fP) but just \fB\\w\fP does not.
564
+ .sp
565
+ .IP \(bu 3n
566
+ Second, of the literals in the pattern, none of them are considered to be
567
+ uppercase according to Unicode. For example, \fBfoo\\pL\fP has no uppercase
568
+ literals but \fBFoo\\pL\fP does.
569
+ .PP
570
+ This overrides the \fB\-s/\-\-case-sensitive\fP and \fB\-i/\-\-ignore-case\fP flags.
571
+ .RE
572
+ .sp
573
+ \fB\-\-stop-on-nonmatch\fP
574
+ .RS 4
575
+ Enabling this option will cause ripgrep to stop reading a file once it
576
+ encounters a non-matching line after it has encountered a matching line.
577
+ This is useful if it is expected that all matches in a given file will be on
578
+ sequential lines, for example due to the lines being sorted.
579
+ .sp
580
+ This overrides the \fB\-U/\-\-multiline\fP flag.
581
+ .RE
582
+ .sp
583
+ \fB\-a\fP, \fB\-\-text\fP
584
+ .RS 4
585
+ This flag instructs ripgrep to search binary files as if they were text. When
586
+ this flag is present, ripgrep's binary file detection is disabled. This means
587
+ that when a binary file is searched, its contents may be printed if there is
588
+ a match. This may cause escape codes to be printed that alter the behavior of
589
+ your terminal.
590
+ .sp
591
+ When binary file detection is enabled, it is imperfect. In general, it uses
592
+ a simple heuristic. If a \fBNUL\fP byte is seen during search, then the file
593
+ is considered binary and searching stops (unless this flag is present).
594
+ Alternatively, if the \fB\-\-binary\fP flag is used, then ripgrep will only quit
595
+ when it sees a \fBNUL\fP byte after it sees a match (or searches the entire
596
+ file).
597
+ .sp
598
+ This flag overrides the \fB\-\-binary\fP flag.
599
+ .sp
600
+ This flag can be disabled with \fB\-\-no-text\fP.
601
+ .RE
602
+ .sp
603
+ \fB\-j\fP \fINUM\fP, \fB\-\-threads\fP=\fINUM\fP
604
+ .RS 4
605
+ This flag sets the approximate number of threads to use. A value of \fB0\fP
606
+ (which is the default) causes ripgrep to choose the thread count using
607
+ heuristics.
608
+ .RE
609
+ .sp
610
+ \fB\-w\fP, \fB\-\-word-regexp\fP
611
+ .RS 4
612
+ When enabled, ripgrep will only show matches surrounded by word boundaries.
613
+ This is equivalent to surrounding every pattern with \fB\\b{start-half}\fP
614
+ and \fB\\b{end-half}\fP.
615
+ .sp
616
+ This overrides the \fB\-x/\-\-line-regexp\fP flag.
617
+ .RE
618
+ .sp
619
+ \fB\-\-auto-hybrid-regex\fP
620
+ .RS 4
621
+ DEPRECATED. Use \fB\-\-engine\fP instead.
622
+ .sp
623
+ When this flag is used, ripgrep will dynamically choose between supported regex
624
+ engines depending on the features used in a pattern. When ripgrep chooses a
625
+ regex engine, it applies that choice for every regex provided to ripgrep (e.g.,
626
+ via multiple \fB\-e/\-\-regexp\fP or \fB\-f/\-\-file\fP flags).
627
+ .sp
628
+ As an example of how this flag might behave, ripgrep will attempt to use
629
+ its default finite automata based regex engine whenever the pattern can be
630
+ successfully compiled with that regex engine. If PCRE2 is enabled and if the
631
+ pattern given could not be compiled with the default regex engine, then PCRE2
632
+ will be automatically used for searching. If PCRE2 isn't available, then this
633
+ flag has no effect because there is only one regex engine to choose from.
634
+ .sp
635
+ In the future, ripgrep may adjust its heuristics for how it decides which
636
+ regex engine to use. In general, the heuristics will be limited to a static
637
+ analysis of the patterns, and not to any specific runtime behavior observed
638
+ while searching files.
639
+ .sp
640
+ The primary downside of using this flag is that it may not always be obvious
641
+ which regex engine ripgrep uses, and thus, the match semantics or performance
642
+ profile of ripgrep may subtly and unexpectedly change. However, in many cases,
643
+ all regex engines will agree on what constitutes a match and it can be nice
644
+ to transparently support more advanced regex features like look-around and
645
+ backreferences without explicitly needing to enable them.
646
+ .sp
647
+ This flag can be disabled with \fB\-\-no-auto-hybrid-regex\fP.
648
+ .RE
649
+ .sp
650
+ \fB\-\-no-pcre2-unicode\fP
651
+ .RS 4
652
+ DEPRECATED. Use \fB\-\-no-unicode\fP instead.
653
+ .sp
654
+ Note that Unicode mode is enabled by default.
655
+ .sp
656
+ This flag can be disabled with \fB\-\-pcre2-unicode\fP.
657
+ .RE
658
+
659
+ .
660
+ .SS FILTER OPTIONS
661
+ \fB\-\-binary\fP
662
+ .RS 4
663
+ Enabling this flag will cause ripgrep to search binary files. By default,
664
+ ripgrep attempts to automatically skip binary files in order to improve the
665
+ relevance of results and make the search faster.
666
+ .sp
667
+ Binary files are heuristically detected based on whether they contain a
668
+ \fBNUL\fP byte or not. By default (without this flag set), once a \fBNUL\fP
669
+ byte is seen, ripgrep will stop searching the file. Usually, \fBNUL\fP bytes
670
+ occur in the beginning of most binary files. If a \fBNUL\fP byte occurs after
671
+ a match, then ripgrep will not print the match, stop searching that file, and
672
+ emit a warning that some matches are being suppressed.
673
+ .sp
674
+ In contrast, when this flag is provided, ripgrep will continue searching a
675
+ file even if a \fBNUL\fP byte is found. In particular, if a \fBNUL\fP byte is
676
+ found then ripgrep will continue searching until either a match is found or
677
+ the end of the file is reached, whichever comes sooner. If a match is found,
678
+ then ripgrep will stop and print a warning saying that the search stopped
679
+ prematurely.
680
+ .sp
681
+ If you want ripgrep to search a file without any special \fBNUL\fP byte
682
+ handling at all (and potentially print binary data to stdout), then you should
683
+ use the \fB\-a/\-\-text\fP flag.
684
+ .sp
685
+ The \fB\-\-binary\fP flag is a flag for controlling ripgrep's automatic filtering
686
+ mechanism. As such, it does not need to be used when searching a file
687
+ explicitly or when searching stdin. That is, it is only applicable when
688
+ recursively searching a directory.
689
+ .sp
690
+ When the \fB\-u/\-\-unrestricted\fP flag is provided for a third time, then this flag
691
+ is automatically enabled.
692
+ .sp
693
+ This flag overrides the \fB\-a/\-\-text\fP flag.
694
+ .sp
695
+ This flag can be disabled with \fB\-\-no-binary\fP.
696
+ .RE
697
+ .sp
698
+ \fB\-L\fP, \fB\-\-follow\fP
699
+ .RS 4
700
+ This flag instructs ripgrep to follow symbolic links while traversing
701
+ directories. This behavior is disabled by default. Note that ripgrep will
702
+ check for symbolic link loops and report errors if it finds one. ripgrep will
703
+ also report errors for broken links. To suppress error messages, use the
704
+ \fB\-\-no-messages\fP flag.
705
+ .sp
706
+ This flag can be disabled with \fB\-\-no-follow\fP.
707
+ .RE
708
+ .sp
709
+ \fB\-g\fP \fIGLOB\fP, \fB\-\-glob\fP=\fIGLOB\fP
710
+ .RS 4
711
+ Include or exclude files and directories for searching that match the given
712
+ glob. This always overrides any other ignore logic. Multiple glob flags may
713
+ be used. Globbing rules match \fB.gitignore\fP globs. Precede a glob with a
714
+ \fB!\fP to exclude it. If multiple globs match a file or directory, the glob
715
+ given later in the command line takes precedence.
716
+ .sp
717
+ As an extension, globs support specifying alternatives:
718
+ .BI "\-g '" ab{c,d}* '
719
+ is equivalent to
720
+ .BI "\-g " "abc " "\-g " abd.
721
+ Empty alternatives like
722
+ .BI "\-g '" ab{,c} '
723
+ are not currently supported. Note that this syntax extension is also currently
724
+ enabled in \fBgitignore\fP files, even though this syntax isn't supported by
725
+ git itself. ripgrep may disable this syntax extension in gitignore files, but
726
+ it will always remain available via the \fB\-g/\-\-glob\fP flag.
727
+ .sp
728
+ When this flag is set, every file and directory is applied to it to test for
729
+ a match. For example, if you only want to search in a particular directory
730
+ \fIfoo\fP, then
731
+ .BI "\-g " foo
732
+ is incorrect because \fIfoo/bar\fP does not match
733
+ the glob \fIfoo\fP. Instead, you should use
734
+ .BI "\-g '" foo/** '.
735
+ .RE
736
+ .sp
737
+ \fB\-\-glob-case-insensitive\fP
738
+ .RS 4
739
+ Process all glob patterns given with the \fB\-g/\-\-glob\fP flag case insensitively.
740
+ This effectively treats \fB\-g/\-\-glob\fP as \fB\-\-iglob\fP.
741
+ .sp
742
+ This flag can be disabled with \fB\-\-no-glob-case-insensitive\fP.
743
+ .RE
744
+ .sp
745
+ \fB\-.\fP, \fB\-\-hidden\fP
746
+ .RS 4
747
+ Search hidden files and directories. By default, hidden files and directories
748
+ are skipped. Note that if a hidden file or a directory is whitelisted in
749
+ an ignore file, then it will be searched even if this flag isn't provided.
750
+ Similarly if a hidden file or directory is given explicitly as an argumnet to
751
+ ripgrep.
752
+ .sp
753
+ A file or directory is considered hidden if its base name starts with a dot
754
+ character (\fB.\fP). On operating systems which support a "hidden" file
755
+ attribute, like Windows, files with this attribute are also considered hidden.
756
+ .sp
757
+ This flag can be disabled with \fB\-\-no-hidden\fP.
758
+ .RE
759
+ .sp
760
+ \fB\-\-iglob\fP=\fIGLOB\fP
761
+ .RS 4
762
+ Include or exclude files and directories for searching that match the given
763
+ glob. This always overrides any other ignore logic. Multiple glob flags may
764
+ be used. Globbing rules match \fB.gitignore\fP globs. Precede a glob with a
765
+ \fB!\fP to exclude it. If multiple globs match a file or directory, the glob
766
+ given later in the command line takes precedence. Globs used via this flag are
767
+ matched case insensitively.
768
+ .RE
769
+ .sp
770
+ \fB\-\-ignore-file\fP=\fIPATH\fP
771
+ .RS 4
772
+ Specifies a path to one or more \fBgitignore\fP formatted rules files.
773
+ These patterns are applied after the patterns found in \fB.gitignore\fP,
774
+ \fB.rgignore\fP and \fB.ignore\fP are applied and are matched relative to the
775
+ current working directory. Multiple additional ignore files can be specified
776
+ by using this flag repeatedly. When specifying multiple ignore files, earlier
777
+ files have lower precedence than later files.
778
+ .sp
779
+ If you are looking for a way to include or exclude files and directories
780
+ directly on the command line, then use \fB\-g/\-\-glob\fP instead.
781
+ .RE
782
+ .sp
783
+ \fB\-\-ignore-file-case-insensitive\fP
784
+ .RS 4
785
+ Process ignore files (\fB.gitignore\fP, \fB.ignore\fP, etc.) case
786
+ insensitively. Note that this comes with a performance penalty and is most
787
+ useful on case insensitive file systems (such as Windows).
788
+ .sp
789
+ This flag can be disabled with \fB\-\-no-ignore-file-case-insensitive\fP.
790
+ .RE
791
+ .sp
792
+ \fB\-d\fP \fINUM\fP, \fB\-\-max-depth\fP=\fINUM\fP
793
+ .RS 4
794
+ This flag limits the depth of directory traversal to \fINUM\fP levels beyond
795
+ the paths given. A value of \fB0\fP only searches the explicitly given paths
796
+ themselves.
797
+ .sp
798
+ For example, \fBrg --max-depth 0 \fP\fIdir/\fP is a no-op because \fIdir/\fP
799
+ will not be descended into. \fBrg --max-depth 1 \fP\fIdir/\fP will search only
800
+ the direct children of \fIdir\fP.
801
+ .sp
802
+ An alternative spelling for this flag is \fB\-\-maxdepth\fP.
803
+ .RE
804
+ .sp
805
+ \fB\-\-max-filesize\fP=\fINUM+SUFFIX?\fP
806
+ .RS 4
807
+ Ignore files larger than \fINUM\fP in size. This does not apply to directories.
808
+ .sp
809
+ The input format accepts suffixes of \fBK\fP, \fBM\fP or \fBG\fP which
810
+ correspond to kilobytes, megabytes and gigabytes, respectively. If no suffix is
811
+ provided the input is treated as bytes.
812
+ .sp
813
+ Examples: \fB\-\-max-filesize 50K\fP or \fB\-\-max\-filesize 80M\fP.
814
+ .RE
815
+ .sp
816
+ \fB\-\-no-ignore\fP
817
+ .RS 4
818
+ When set, ignore files such as \fB.gitignore\fP, \fB.ignore\fP and
819
+ \fB.rgignore\fP will not be respected. This implies \fB\-\-no-ignore-dot\fP,
820
+ \fB\-\-no-ignore-exclude\fP, \fB\-\-no-ignore-global\fP, \fB\-\-no-ignore-parent\fP and
821
+ \fB\-\-no-ignore-vcs\fP.
822
+ .sp
823
+ This does not imply \fB\-\-no-ignore-files\fP, since \fB\-\-ignore-file\fP is
824
+ specified explicitly as a command line argument.
825
+ .sp
826
+ When given only once, the \fB\-u/\-\-unrestricted\fP flag is identical in
827
+ behavior to this flag and can be considered an alias. However, subsequent
828
+ \fB\-u/\-\-unrestricted\fP flags have additional effects.
829
+ .sp
830
+ This flag can be disabled with \fB\-\-ignore\fP.
831
+ .RE
832
+ .sp
833
+ \fB\-\-no-ignore-dot\fP
834
+ .RS 4
835
+ Don't respect filter rules from \fB.ignore\fP or \fB.rgignore\fP files.
836
+ .sp
837
+ This does not impact whether ripgrep will ignore files and directories whose
838
+ names begin with a dot. For that, see the \fB\-./\-\-hidden\fP flag. This flag also
839
+ does not impact whether filter rules from \fB.gitignore\fP files are respected.
840
+ .sp
841
+ This flag can be disabled with \fB\-\-ignore-dot\fP.
842
+ .RE
843
+ .sp
844
+ \fB\-\-no-ignore-exclude\fP
845
+ .RS 4
846
+ Don't respect filter rules from files that are manually configured for the repository.
847
+ For example, this includes \fBgit\fP's \fB.git/info/exclude\fP.
848
+ .sp
849
+ This flag can be disabled with \fB\-\-ignore-exclude\fP.
850
+ .RE
851
+ .sp
852
+ \fB\-\-no-ignore-files\fP
853
+ .RS 4
854
+ When set, any \fB\-\-ignore-file\fP flags, even ones that come after this flag,
855
+ are ignored.
856
+ .sp
857
+ This flag can be disabled with \fB\-\-ignore-files\fP.
858
+ .RE
859
+ .sp
860
+ \fB\-\-no-ignore-global\fP
861
+ .RS 4
862
+ Don't respect filter rules from ignore files that come from "global" sources
863
+ such as \fBgit\fP's \fBcore.excludesFile\fP configuration option (which
864
+ defaults to \fB$HOME/.config/git/ignore\fP).
865
+ .sp
866
+ This flag can be disabled with \fB\-\-ignore-global\fP.
867
+ .RE
868
+ .sp
869
+ \fB\-\-no-ignore-parent\fP
870
+ .RS 4
871
+ When this flag is set, filter rules from ignore files found in parent
872
+ directories are not respected. By default, ripgrep will ascend the parent
873
+ directories of the current working directory to look for any applicable ignore
874
+ files that should be applied. In some cases this may not be desirable.
875
+ .sp
876
+ This flag can be disabled with \fB\-\-ignore-parent\fP.
877
+ .RE
878
+ .sp
879
+ \fB\-\-no-ignore-vcs\fP
880
+ .RS 4
881
+ When given, filter rules from source control ignore files (e.g., \fB.gitignore\fP)
882
+ are not respected. By default, ripgrep respects \fBgit\fP's ignore rules for
883
+ automatic filtering. In some cases, it may not be desirable to respect the
884
+ source control's ignore rules and instead only respect rules in \fB.ignore\fP
885
+ or \fB.rgignore\fP.
886
+ .sp
887
+ This flag implies \fB\-\-no-ignore-parent\fP for source control ignore files as
888
+ well.
889
+ .sp
890
+ This flag can be disabled with \fB\-\-ignore-vcs\fP.
891
+ .RE
892
+ .sp
893
+ \fB\-\-no-require-git\fP
894
+ .RS 4
895
+ When this flag is given, source control ignore files such as \fB.gitignore\fP
896
+ are respected even if no \fBgit\fP repository is present.
897
+ .sp
898
+ By default, ripgrep will only respect filter rules from source control ignore
899
+ files when ripgrep detects that the search is executed inside a source control
900
+ repository. For example, when a \fB.git\fP directory is observed.
901
+ .sp
902
+ This flag relaxes the default restriction. For example, it might be useful when
903
+ the contents of a \fBgit\fP repository are stored or copied somewhere, but
904
+ where the repository state is absent.
905
+ .sp
906
+ This flag can be disabled with \fB\-\-require-git\fP.
907
+ .RE
908
+ .sp
909
+ \fB\-\-one-file-system\fP
910
+ .RS 4
911
+ When enabled, ripgrep will not cross file system boundaries relative to where
912
+ the search started from.
913
+ .sp
914
+ Note that this applies to each path argument given to ripgrep. For example, in
915
+ the command
916
+ .sp
917
+ .EX
918
+ rg \-\-one\-file\-system /foo/bar /quux/baz
919
+ .EE
920
+ .sp
921
+ ripgrep will search both \fI/foo/bar\fP and \fI/quux/baz\fP even if they are
922
+ on different file systems, but will not cross a file system boundary when
923
+ traversing each path's directory tree.
924
+ .sp
925
+ This is similar to \fBfind\fP's \fB\-xdev\fP or \fB\-mount\fP flag.
926
+ .sp
927
+ This flag can be disabled with \fB\-\-no-one-file-system\fP.
928
+ .RE
929
+ .sp
930
+ \fB\-t\fP \fITYPE\fP, \fB\-\-type\fP=\fITYPE\fP
931
+ .RS 4
932
+ This flag limits ripgrep to searching files matching \fITYPE\fP. Multiple
933
+ \fB\-t/\-\-type\fP flags may be provided.
934
+ .sp
935
+ This flag supports the special value \fBall\fP, which will behave as if
936
+ \fB\-t/\-\-type\fP was provided for every file type supported by ripgrep (including
937
+ any custom file types). The end result is that \fB\-\-type=all\fP causes
938
+ ripgrep to search in "whitelist" mode, where it will only search files it
939
+ recognizes via its type definitions.
940
+ .sp
941
+ Note that this flag has lower precedence than both the \fB\-g/\-\-glob\fP flag and
942
+ any rules found in ignore files.
943
+ .sp
944
+ To see the list of available file types, use the \fB\-\-type-list\fP flag.
945
+ .RE
946
+ .sp
947
+ \fB\-T\fP \fITYPE\fP, \fB\-\-type-not\fP=\fITYPE\fP
948
+ .RS 4
949
+ Do not search files matching \fITYPE\fP. Multiple \fB\-T/\-\-type-not\fP flags may be
950
+ provided. Use the \fB\-\-type-list\fP flag to list all available types.
951
+ .sp
952
+ This flag supports the special value \fBall\fP, which will behave
953
+ as if \fB\-T/\-\-type-not\fP was provided for every file type supported by
954
+ ripgrep (including any custom file types). The end result is that
955
+ \fB\-\-type\-not=all\fP causes ripgrep to search in "blacklist" mode, where it
956
+ will only search files that are unrecognized by its type definitions.
957
+ .sp
958
+ To see the list of available file types, use the \fB\-\-type-list\fP flag.
959
+ .RE
960
+ .sp
961
+ \fB\-\-type-add\fP=\fITYPESPEC\fP
962
+ .RS 4
963
+ This flag adds a new glob for a particular file type. Only one glob can be
964
+ added at a time. Multiple \fB\-\-type-add\fP flags can be provided. Unless
965
+ \fB\-\-type-clear\fP is used, globs are added to any existing globs defined inside
966
+ of ripgrep.
967
+ .sp
968
+ Note that this must be passed to every invocation of ripgrep. Type settings are
969
+ not persisted. See \fBCONFIGURATION FILES\fP for a workaround.
970
+ .sp
971
+ Example:
972
+ .sp
973
+ .EX
974
+ rg \-\-type\-add 'foo:*.foo' -tfoo \fIPATTERN\fP
975
+ .EE
976
+ .sp
977
+ This flag can also be used to include rules from other types with the special
978
+ include directive. The include directive permits specifying one or more other
979
+ type names (separated by a comma) that have been defined and its rules will
980
+ automatically be imported into the type specified. For example, to create a
981
+ type called src that matches C++, Python and Markdown files, one can use:
982
+ .sp
983
+ .EX
984
+ \-\-type\-add 'src:include:cpp,py,md'
985
+ .EE
986
+ .sp
987
+ Additional glob rules can still be added to the src type by using this flag
988
+ again:
989
+ .sp
990
+ .EX
991
+ \-\-type\-add 'src:include:cpp,py,md' \-\-type\-add 'src:*.foo'
992
+ .EE
993
+ .sp
994
+ Note that type names must consist only of Unicode letters or numbers.
995
+ Punctuation characters are not allowed.
996
+ .RE
997
+ .sp
998
+ \fB\-\-type-clear\fP=\fITYPE\fP
999
+ .RS 4
1000
+ Clear the file type globs previously defined for \fITYPE\fP. This clears any
1001
+ previously defined globs for the \fITYPE\fP, but globs can be added after this
1002
+ flag.
1003
+ .sp
1004
+ Note that this must be passed to every invocation of ripgrep. Type settings are
1005
+ not persisted. See \fBCONFIGURATION FILES\fP for a workaround.
1006
+ .RE
1007
+ .sp
1008
+ \fB\-u\fP, \fB\-\-unrestricted\fP
1009
+ .RS 4
1010
+ This flag reduces the level of "smart" filtering. Repeated uses (up to 3) reduces
1011
+ the filtering even more. When repeated three times, ripgrep will search every
1012
+ file in a directory tree.
1013
+ .sp
1014
+ A single \fB\-u/\-\-unrestricted\fP flag is equivalent to \fB\-\-no-ignore\fP. Two
1015
+ \fB\-u/\-\-unrestricted\fP flags is equivalent to \fB\-\-no-ignore\fP \fB\-./\-\-hidden\fP.
1016
+ Three \fB\-u/\-\-unrestricted\fP flags is equivalent to \fB\-\-no-ignore\fP \fB\-./\-\-hidden\fP
1017
+ \fB\-\-binary\fP.
1018
+ .sp
1019
+ The only filtering ripgrep still does when \fB-uuu\fP is given is to skip
1020
+ symbolic links and to avoid printing matches from binary files. Symbolic links
1021
+ can be followed via the \fB\-L/\-\-follow\fP flag, and binary files can be treated as
1022
+ text files via the \fB\-a/\-\-text\fP flag.
1023
+ .RE
1024
+
1025
+ .
1026
+ .SS OUTPUT OPTIONS
1027
+ \fB\-A\fP \fINUM\fP, \fB\-\-after-context\fP=\fINUM\fP
1028
+ .RS 4
1029
+ Show \fINUM\fP lines after each match.
1030
+ .sp
1031
+ This overrides the \fB\-\-passthru\fP flag and partially overrides the
1032
+ \fB\-C/\-\-context\fP flag.
1033
+ .RE
1034
+ .sp
1035
+ \fB\-B\fP \fINUM\fP, \fB\-\-before-context\fP=\fINUM\fP
1036
+ .RS 4
1037
+ Show \fINUM\fP lines before each match.
1038
+ .sp
1039
+ This overrides the \fB\-\-passthru\fP flag and partially overrides the
1040
+ \fB\-C/\-\-context\fP flag.
1041
+ .RE
1042
+ .sp
1043
+ \fB\-\-block-buffered\fP
1044
+ .RS 4
1045
+ When enabled, ripgrep will use block buffering. That is, whenever a matching
1046
+ line is found, it will be written to an in-memory buffer and will not be
1047
+ written to stdout until the buffer reaches a certain size. This is the default
1048
+ when ripgrep's stdout is redirected to a pipeline or a file. When ripgrep's
1049
+ stdout is connected to a tty, line buffering will be used by default. Forcing
1050
+ block buffering can be useful when dumping a large amount of contents to a tty.
1051
+ .sp
1052
+ This overrides the \fB\-\-line-buffered\fP flag.
1053
+ .sp
1054
+ This flag can be disabled with \fB\-\-no-block-buffered\fP.
1055
+ .RE
1056
+ .sp
1057
+ \fB\-b\fP, \fB\-\-byte-offset\fP
1058
+ .RS 4
1059
+ Print the 0-based byte offset within the input file before each line of output.
1060
+ If \fB\-o/\-\-only-matching\fP is specified, print the offset of the matched text
1061
+ itself.
1062
+ .sp
1063
+ If ripgrep does transcoding, then the byte offset is in terms of the result
1064
+ of transcoding and not the original data. This applies similarly to other
1065
+ transformations on the data, such as decompression or a \fB\-\-pre\fP filter.
1066
+ .sp
1067
+ This flag can be disabled with \fB\-\-no-byte-offset\fP.
1068
+ .RE
1069
+ .sp
1070
+ \fB\-\-color\fP=\fIWHEN\fP
1071
+ .RS 4
1072
+ This flag controls when to use colors. The default setting is \fBauto\fP, which
1073
+ means ripgrep will try to guess when to use colors. For example, if ripgrep is
1074
+ printing to a tty, then it will use colors, but if it is redirected to a file
1075
+ or a pipe, then it will suppress color output.
1076
+ .sp
1077
+ ripgrep will suppress color output by default in some other circumstances as
1078
+ well. These include, but are not limited to:
1079
+ .sp
1080
+ .IP \(bu 3n
1081
+ When the \fBTERM\fP environment variable is not set or set to \fBdumb\fP.
1082
+ .sp
1083
+ .IP \(bu 3n
1084
+ When the \fBNO_COLOR\fP environment variable is set (regardless of value).
1085
+ .sp
1086
+ .IP \(bu 3n
1087
+ When flags that imply no use for colors are given. For example,
1088
+ \fB\-\-vimgrep\fP and \fB\-\-json\fP.
1089
+ .
1090
+ .PP
1091
+ The possible values for this flag are:
1092
+ .sp
1093
+ .IP \fBnever\fP 10n
1094
+ Colors will never be used.
1095
+ .sp
1096
+ .IP \fBauto\fP 10n
1097
+ The default. ripgrep tries to be smart.
1098
+ .sp
1099
+ .IP \fBalways\fP 10n
1100
+ Colors will always be used regardless of where output is sent.
1101
+ .sp
1102
+ .IP \fBansi\fP 10n
1103
+ Like 'always', but emits ANSI escapes (even in a Windows console).
1104
+ .
1105
+ .PP
1106
+ This flag also controls whether hyperlinks are emitted. For example, when
1107
+ a hyperlink format is specified, hyperlinks won't be used when color is
1108
+ suppressed. If one wants to emit hyperlinks but no colors, then one must use
1109
+ the \fB\-\-colors\fP flag to manually set all color styles to \fBnone\fP:
1110
+ .sp
1111
+ .EX
1112
+ \-\-colors 'path:none' \\
1113
+ \-\-colors 'line:none' \\
1114
+ \-\-colors 'column:none' \\
1115
+ \-\-colors 'match:none'
1116
+ .EE
1117
+ .sp
1118
+ .RE
1119
+ .sp
1120
+ \fB\-\-colors\fP=\fICOLOR_SPEC\fP
1121
+ .RS 4
1122
+ This flag specifies color settings for use in the output. This flag may be
1123
+ provided multiple times. Settings are applied iteratively. Pre-existing color
1124
+ labels are limited to one of eight choices: \fBred\fP, \fBblue\fP, \fBgreen\fP,
1125
+ \fBcyan\fP, \fBmagenta\fP, \fByellow\fP, \fBwhite\fP and \fBblack\fP. Styles
1126
+ are limited to \fBnobold\fP, \fBbold\fP, \fBnointense\fP, \fBintense\fP,
1127
+ \fBnounderline\fP or \fBunderline\fP.
1128
+ .sp
1129
+ The format of the flag is
1130
+ \fB{\fP\fItype\fP\fB}:{\fP\fIattribute\fP\fB}:{\fP\fIvalue\fP\fB}\fP.
1131
+ \fItype\fP should be one of \fBpath\fP, \fBline\fP, \fBcolumn\fP or
1132
+ \fBmatch\fP. \fIattribute\fP can be \fBfg\fP, \fBbg\fP or \fBstyle\fP.
1133
+ \fIvalue\fP is either a color (for \fBfg\fP and \fBbg\fP) or a text style. A
1134
+ special format, \fB{\fP\fItype\fP\fB}:none\fP, will clear all color settings
1135
+ for \fItype\fP.
1136
+ .sp
1137
+ For example, the following command will change the match color to magenta and
1138
+ the background color for line numbers to yellow:
1139
+ .sp
1140
+ .EX
1141
+ rg \-\-colors 'match:fg:magenta' \-\-colors 'line:bg:yellow'
1142
+ .EE
1143
+ .sp
1144
+ Extended colors can be used for \fIvalue\fP when the tty supports ANSI color
1145
+ sequences. These are specified as either \fIx\fP (256-color) or
1146
+ .IB x , x , x
1147
+ (24-bit truecolor) where \fIx\fP is a number between \fB0\fP and \fB255\fP
1148
+ inclusive. \fIx\fP may be given as a normal decimal number or a hexadecimal
1149
+ number, which is prefixed by \fB0x\fP.
1150
+ .sp
1151
+ For example, the following command will change the match background color to
1152
+ that represented by the rgb value (0,128,255):
1153
+ .sp
1154
+ .EX
1155
+ rg \-\-colors 'match:bg:0,128,255'
1156
+ .EE
1157
+ .sp
1158
+ or, equivalently,
1159
+ .sp
1160
+ .EX
1161
+ rg \-\-colors 'match:bg:0x0,0x80,0xFF'
1162
+ .EE
1163
+ .sp
1164
+ Note that the \fBintense\fP and \fBnointense\fP styles will have no effect when
1165
+ used alongside these extended color codes.
1166
+ .RE
1167
+ .sp
1168
+ \fB\-\-column\fP
1169
+ .RS 4
1170
+ Show column numbers (1-based). This only shows the column numbers for the first
1171
+ match on each line. This does not try to account for Unicode. One byte is equal
1172
+ to one column. This implies \fB\-n/\-\-line-number\fP.
1173
+ .sp
1174
+ When \fB\-o/\-\-only-matching\fP is used, then the column numbers written correspond
1175
+ to the start of each match.
1176
+ .sp
1177
+ This flag can be disabled with \fB\-\-no-column\fP.
1178
+ .RE
1179
+ .sp
1180
+ \fB\-C\fP \fINUM\fP, \fB\-\-context\fP=\fINUM\fP
1181
+ .RS 4
1182
+ Show \fINUM\fP lines before and after each match. This is equivalent to
1183
+ providing both the \fB\-B/\-\-before-context\fP and \fB\-A/\-\-after-context\fP flags with
1184
+ the same value.
1185
+ .sp
1186
+ This overrides the \fB\-\-passthru\fP flag. The \fB\-A/\-\-after-context\fP and
1187
+ \fB\-B/\-\-before-context\fP flags both partially override this flag, regardless of
1188
+ the order. For example, \fB\-A2 \-C1\fP is equivalent to \fB\-A2 \-B1\fP.
1189
+ .RE
1190
+ .sp
1191
+ \fB\-\-context-separator\fP=\fISEPARATOR\fP
1192
+ .RS 4
1193
+ The string used to separate non-contiguous context lines in the output. This is
1194
+ only used when one of the context flags is used (that is, \fB\-A/\-\-after-context\fP,
1195
+ \fB\-B/\-\-before-context\fP or \fB\-C/\-\-context\fP). Escape sequences like \fB\\x7F\fP or
1196
+ \fB\\t\fP may be used. The default value is \fB\-\-\fP.
1197
+ .sp
1198
+ When the context separator is set to an empty string, then a line break
1199
+ is still inserted. To completely disable context separators, use the
1200
+ \fB\-\-no-context-separator\fP flag.
1201
+ .RE
1202
+ .sp
1203
+ \fB\-\-field-context-separator\fP=\fISEPARATOR\fP
1204
+ .RS 4
1205
+ Set the field context separator. This separator is only used when printing
1206
+ contextual lines. It is used to delimit file paths, line numbers, columns and
1207
+ the contextual line itself. The separator may be any number of bytes, including
1208
+ zero. Escape sequences like \fB\\x7F\fP or \fB\\t\fP may be used.
1209
+ .sp
1210
+ The \fB-\fP character is the default value.
1211
+ .RE
1212
+ .sp
1213
+ \fB\-\-field-match-separator\fP=\fISEPARATOR\fP
1214
+ .RS 4
1215
+ Set the field match separator. This separator is only used when printing
1216
+ matching lines. It is used to delimit file paths, line numbers, columns and the
1217
+ matching line itself. The separator may be any number of bytes, including zero.
1218
+ Escape sequences like \fB\\x7F\fP or \fB\\t\fP may be used.
1219
+ .sp
1220
+ The \fB:\fP character is the default value.
1221
+ .RE
1222
+ .sp
1223
+ \fB\-\-heading\fP
1224
+ .RS 4
1225
+ This flag prints the file path above clusters of matches from each file instead
1226
+ of printing the file path as a prefix for each matched line.
1227
+ .sp
1228
+ This is the default mode when printing to a tty.
1229
+ .sp
1230
+ When \fBstdout\fP is not a tty, then ripgrep will default to the standard
1231
+ grep-like format. Once can force this format in Unix-like environments by
1232
+ piping the output of ripgrep to \fBcat\fP. For example, \fBrg\fP \fIfoo\fP \fB|
1233
+ cat\fP.
1234
+ .sp
1235
+ This flag can be disabled with \fB\-\-no-heading\fP.
1236
+ .RE
1237
+ .sp
1238
+ \fB\-h\fP, \fB\-\-help\fP
1239
+ .RS 4
1240
+ This flag prints the help output for ripgrep.
1241
+ .sp
1242
+ Unlike most other flags, the behavior of the short flag, \fB\-h\fP, and the
1243
+ long flag, \fB\-\-help\fP, is different. The short flag will show a condensed
1244
+ help output while the long flag will show a verbose help output. The verbose
1245
+ help output has complete documentation, where as the condensed help output will
1246
+ show only a single line for every flag.
1247
+ .RE
1248
+ .sp
1249
+ \fB\-\-hostname-bin\fP=\fICOMMAND\fP
1250
+ .RS 4
1251
+ This flag controls how ripgrep determines this system's hostname. The flag's
1252
+ value should correspond to an executable (either a path or something that can
1253
+ be found via your system's \fBPATH\fP environment variable). When set, ripgrep
1254
+ will run this executable, with no arguments, and treat its output (with leading
1255
+ and trailing whitespace stripped) as your system's hostname.
1256
+ .sp
1257
+ When not set (the default, or the empty string), ripgrep will try to
1258
+ automatically detect your system's hostname. On Unix, this corresponds
1259
+ to calling \fBgethostname\fP. On Windows, this corresponds to calling
1260
+ \fBGetComputerNameExW\fP to fetch the system's "physical DNS hostname."
1261
+ .sp
1262
+ ripgrep uses your system's hostname for producing hyperlinks.
1263
+ .RE
1264
+ .sp
1265
+ \fB\-\-hyperlink-format\fP=\fIFORMAT\fP
1266
+ .RS 4
1267
+ Set the format of hyperlinks to use when printing results. Hyperlinks make
1268
+ certain elements of ripgrep's output, such as file paths, clickable. This
1269
+ generally only works in terminal emulators that support OSC-8 hyperlinks. For
1270
+ example, the format \fBfile://{host}{path}\fP will emit an RFC 8089 hyperlink.
1271
+ To see the format that ripgrep is using, pass the \fB\-\-debug\fP flag.
1272
+ .sp
1273
+ Alternatively, a format string may correspond to one of the following aliases:
1274
+ \fBdefault\fP, \fBnone\fP, \fBfile\fP, \fBgrep+\fP, \fBkitty\fP, \fBmacvim\fP,
1275
+ \fBtextmate\fP, \fBvscode\fP, \fBvscode-insiders\fP, \fBvscodium\fP. The
1276
+ alias will be replaced with a format string that is intended to work for the
1277
+ corresponding application.
1278
+ .sp
1279
+ The following variables are available in the format string:
1280
+ .sp
1281
+ .TP 12
1282
+ \fB{path}\fP
1283
+ Required. This is replaced with a path to a matching file. The path is
1284
+ guaranteed to be absolute and percent encoded such that it is valid to put into
1285
+ a URI. Note that a path is guaranteed to start with a /.
1286
+ .TP 12
1287
+ \fB{host}\fP
1288
+ Optional. This is replaced with your system's hostname. On Unix, this
1289
+ corresponds to calling \fBgethostname\fP. On Windows, this corresponds to
1290
+ calling \fBGetComputerNameExW\fP to fetch the system's "physical DNS hostname."
1291
+ Alternatively, if \fB\-\-hostname-bin\fP was provided, then the hostname returned
1292
+ from the output of that program will be returned. If no hostname could be
1293
+ found, then this variable is replaced with the empty string.
1294
+ .TP 12
1295
+ \fB{line}\fP
1296
+ Optional. If appropriate, this is replaced with the line number of a match. If
1297
+ no line number is available (for example, if \fB\-\-no\-line\-number\fP was
1298
+ given), then it is automatically replaced with the value 1.
1299
+ .TP 12
1300
+ \fB{column}\fP
1301
+ Optional, but requires the presence of \fB{line}\fP. If appropriate, this is
1302
+ replaced with the column number of a match. If no column number is available
1303
+ (for example, if \fB\-\-no\-column\fP was given), then it is automatically
1304
+ replaced with the value 1.
1305
+ .TP 12
1306
+ \fB{wslprefix}\fP
1307
+ Optional. This is a special value that is set to
1308
+ \fBwsl$/\fP\fIWSL_DISTRO_NAME\fP, where \fIWSL_DISTRO_NAME\fP corresponds to
1309
+ the value of the equivalent environment variable. If the system is not Unix
1310
+ or if the \fIWSL_DISTRO_NAME\fP environment variable is not set, then this is
1311
+ replaced with the empty string.
1312
+ .PP
1313
+ A format string may be empty. An empty format string is equivalent to the
1314
+ \fBnone\fP alias. In this case, hyperlinks will be disabled.
1315
+ .sp
1316
+ At present, ripgrep does not enable hyperlinks by default. Users must opt into
1317
+ them. If you aren't sure what format to use, try \fBdefault\fP.
1318
+ .sp
1319
+ Like colors, when ripgrep detects that stdout is not connected to a tty, then
1320
+ hyperlinks are automatically disabled, regardless of the value of this flag.
1321
+ Users can pass \fB\-\-color=always\fP to forcefully emit hyperlinks.
1322
+ .sp
1323
+ Note that hyperlinks are only written when a path is also in the output
1324
+ and colors are enabled. To write hyperlinks without colors, you'll need to
1325
+ configure ripgrep to not colorize anything without actually disabling all ANSI
1326
+ escape codes completely:
1327
+ .sp
1328
+ .EX
1329
+ \-\-colors 'path:none' \\
1330
+ \-\-colors 'line:none' \\
1331
+ \-\-colors 'column:none' \\
1332
+ \-\-colors 'match:none'
1333
+ .EE
1334
+ .sp
1335
+ ripgrep works this way because it treats the \fB\-\-color\fP flag as a proxy for
1336
+ whether ANSI escape codes should be used at all. This means that environment
1337
+ variables like \fBNO_COLOR=1\fP and \fBTERM=dumb\fP not only disable colors,
1338
+ but hyperlinks as well. Similarly, colors and hyperlinks are disabled when
1339
+ ripgrep is not writing to a tty. (Unless one forces the issue by setting
1340
+ \fB\-\-color=always\fP.)
1341
+ .sp
1342
+ If you're searching a file directly, for example:
1343
+ .sp
1344
+ .EX
1345
+ rg foo path/to/file
1346
+ .EE
1347
+ .sp
1348
+ then hyperlinks will not be emitted since the path given does not appear
1349
+ in the output. To make the path appear, and thus also a hyperlink, use the
1350
+ \fB\-H/\-\-with-filename\fP flag.
1351
+ .sp
1352
+ For more information on hyperlinks in terminal emulators, see:
1353
+ https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
1354
+ .RE
1355
+ .sp
1356
+ \fB\-\-include-zero\fP
1357
+ .RS 4
1358
+ When used with \fB\-c/\-\-count\fP or \fB\-\-count-matches\fP, this causes ripgrep to
1359
+ print the number of matches for each file even if there were zero matches. This
1360
+ is disabled by default but can be enabled to make ripgrep behave more like
1361
+ grep.
1362
+ .sp
1363
+ This flag can be disabled with \fB\-\-no-include-zero\fP.
1364
+ .RE
1365
+ .sp
1366
+ \fB\-\-line-buffered\fP
1367
+ .RS 4
1368
+ When enabled, ripgrep will always use line buffering. That is, whenever a
1369
+ matching line is found, it will be flushed to stdout immediately. This is the
1370
+ default when ripgrep's stdout is connected to a tty, but otherwise, ripgrep
1371
+ will use block buffering, which is typically faster. This flag forces ripgrep
1372
+ to use line buffering even if it would otherwise use block buffering. This is
1373
+ typically useful in shell pipelines, for example:
1374
+ .sp
1375
+ .EX
1376
+ tail -f something.log | rg foo --line-buffered | rg bar
1377
+ .EE
1378
+ .sp
1379
+ This overrides the \fB\-\-block-buffered\fP flag.
1380
+ .sp
1381
+ This flag can be disabled with \fB\-\-no-line-buffered\fP.
1382
+ .RE
1383
+ .sp
1384
+ \fB\-n\fP, \fB\-\-line-number\fP
1385
+ .RS 4
1386
+ Show line numbers (1-based).
1387
+ .sp
1388
+ This is enabled by default when stdout is connected to a tty.
1389
+ .sp
1390
+ This flag can be disabled by \fB\-N/\-\-no-line-number\fP.
1391
+ .RE
1392
+ .sp
1393
+ \fB\-N\fP, \fB\-\-no-line-number\fP
1394
+ .RS 4
1395
+ Suppress line numbers.
1396
+ .sp
1397
+ Line numbers are off by default when stdout is not connected to a tty.
1398
+ .sp
1399
+ Line numbers can be forcefully turned on by \fB\-n/\-\-line-number\fP.
1400
+ .RE
1401
+ .sp
1402
+ \fB\-M\fP \fINUM\fP, \fB\-\-max-columns\fP=\fINUM\fP
1403
+ .RS 4
1404
+ When given, ripgrep will omit lines longer than this limit in bytes. Instead of
1405
+ printing long lines, only the number of matches in that line is printed.
1406
+ .sp
1407
+ When this flag is omitted or is set to \fB0\fP, then it has no effect.
1408
+ .RE
1409
+ .sp
1410
+ \fB\-\-max-columns-preview\fP
1411
+ .RS 4
1412
+ Prints a preview for lines exceeding the configured max column limit.
1413
+ .sp
1414
+ When the \fB\-M/\-\-max-columns\fP flag is used, ripgrep will by default completely
1415
+ replace any line that is too long with a message indicating that a matching
1416
+ line was removed. When this flag is combined with \fB\-M/\-\-max-columns\fP, a preview
1417
+ of the line (corresponding to the limit size) is shown instead, where the part
1418
+ of the line exceeding the limit is not shown.
1419
+ .sp
1420
+ If the \fB\-M/\-\-max-columns\fP flag is not set, then this has no effect.
1421
+ .sp
1422
+ This flag can be disabled with \fB\-\-no-max-columns-preview\fP.
1423
+ .RE
1424
+ .sp
1425
+ \fB\-0\fP, \fB\-\-null\fP
1426
+ .RS 4
1427
+ Whenever a file path is printed, follow it with a \fBNUL\fP byte. This includes
1428
+ printing file paths before matches, and when printing a list of matching files
1429
+ such as with \fB\-c/\-\-count\fP, \fB\-l/\-\-files-with-matches\fP and \fB\-\-files\fP. This
1430
+ option is useful for use with \fBxargs\fP.
1431
+ .RE
1432
+ .sp
1433
+ \fB\-o\fP, \fB\-\-only-matching\fP
1434
+ .RS 4
1435
+ Print only the matched (non-empty) parts of a matching line, with each such
1436
+ part on a separate output line.
1437
+ .RE
1438
+ .sp
1439
+ \fB\-\-path-separator\fP=\fISEPARATOR\fP
1440
+ .RS 4
1441
+ Set the path separator to use when printing file paths. This defaults to your
1442
+ platform's path separator, which is \fB/\fP on Unix and \fB\\\fP on Windows.
1443
+ This flag is intended for overriding the default when the environment demands
1444
+ it (e.g., cygwin). A path separator is limited to a single byte.
1445
+ .sp
1446
+ Setting this flag to an empty string reverts it to its default behavior. That
1447
+ is, the path separator is automatically chosen based on the environment.
1448
+ .RE
1449
+ .sp
1450
+ \fB\-\-passthru\fP
1451
+ .RS 4
1452
+ Print both matching and non-matching lines.
1453
+ .sp
1454
+ Another way to achieve a similar effect is by modifying your pattern to match
1455
+ the empty string. For example, if you are searching using \fBrg\fP \fIfoo\fP,
1456
+ then using \fBrg\fP \fB'^|\fP\fIfoo\fP\fB'\fP instead will emit every line in
1457
+ every file searched, but only occurrences of \fIfoo\fP will be highlighted.
1458
+ This flag enables the same behavior without needing to modify the pattern.
1459
+ .sp
1460
+ An alternative spelling for this flag is \fB\-\-passthrough\fP.
1461
+ .sp
1462
+ This overrides the \fB\-C/\-\-context\fP, \fB\-A/\-\-after-context\fP and
1463
+ \fB\-B/\-\-before-context\fP flags.
1464
+ .RE
1465
+ .sp
1466
+ \fB\-p\fP, \fB\-\-pretty\fP
1467
+ .RS 4
1468
+ This is a convenience alias for \fB\-\-color=always \-\-heading
1469
+ \-\-line\-number\fP. This flag is useful when you still want pretty output even
1470
+ if you're piping ripgrep to another program or file. For example: \fBrg -p
1471
+ \fP\fIfoo\fP \fB| less -R\fP.
1472
+ .RE
1473
+ .sp
1474
+ \fB\-q\fP, \fB\-\-quiet\fP
1475
+ .RS 4
1476
+ Do not print anything to stdout. If a match is found in a file, then ripgrep
1477
+ will stop searching. This is useful when ripgrep is used only for its exit code
1478
+ (which will be an error code if no matches are found).
1479
+ .sp
1480
+ When \fB\-\-files\fP is used, ripgrep will stop finding files after finding the
1481
+ first file that does not match any ignore rules.
1482
+ .RE
1483
+ .sp
1484
+ \fB\-r\fP \fIREPLACEMENT\fP, \fB\-\-replace\fP=\fIREPLACEMENT\fP
1485
+ .RS 4
1486
+ Replaces every match with the text given when printing results. Neither this
1487
+ flag nor any other ripgrep flag will modify your files.
1488
+ .sp
1489
+ Capture group indices (e.g., \fB$\fP\fI5\fP) and names (e.g., \fB$\fP\fIfoo\fP)
1490
+ are supported in the replacement string. Capture group indices are numbered
1491
+ based on the position of the opening parenthesis of the group, where the
1492
+ leftmost such group is \fB$\fP\fI1\fP. The special \fB$\fP\fI0\fP group
1493
+ corresponds to the entire match.
1494
+ .sp
1495
+ The name of a group is formed by taking the longest string of letters, numbers
1496
+ and underscores (i.e. \fB[_0-9A-Za-z]\fP) after the \fB$\fP. For example,
1497
+ \fB$\fP\fI1a\fP will be replaced with the group named \fI1a\fP, not the
1498
+ group at index \fI1\fP. If the group's name contains characters that aren't
1499
+ letters, numbers or underscores, or you want to immediately follow the group
1500
+ with another string, the name should be put inside braces. For example,
1501
+ \fB${\fP\fI1\fP\fB}\fP\fIa\fP will take the content of the group at index
1502
+ \fI1\fP and append \fIa\fP to the end of it.
1503
+ .sp
1504
+ If an index or name does not refer to a valid capture group, it will be
1505
+ replaced with an empty string.
1506
+ .sp
1507
+ In shells such as Bash and zsh, you should wrap the pattern in single quotes
1508
+ instead of double quotes. Otherwise, capture group indices will be replaced by
1509
+ expanded shell variables which will most likely be empty.
1510
+ .sp
1511
+ To write a literal \fB$\fP, use \fB$$\fP.
1512
+ .sp
1513
+ Note that the replacement by default replaces each match, and not the entire
1514
+ line. To replace the entire line, you should match the entire line.
1515
+ .sp
1516
+ This flag can be used with the \fB\-o/\-\-only-matching\fP flag.
1517
+ .RE
1518
+ .sp
1519
+ \fB\-\-sort\fP=\fISORTBY\fP
1520
+ .RS 4
1521
+ This flag enables sorting of results in ascending order. The possible values
1522
+ for this flag are:
1523
+ .sp
1524
+ .TP 12
1525
+ \fBnone\fP
1526
+ (Default) Do not sort results. Fastest. Can be multi-threaded.
1527
+ .TP 12
1528
+ \fBpath\fP
1529
+ Sort by file path. Always single-threaded. The order is determined by sorting
1530
+ files in each directory entry during traversal. This means that given the files
1531
+ \fBa/b\fP and \fBa+\fP, the latter will sort after the former even though
1532
+ \fB+\fP would normally sort before \fB/\fP.
1533
+ .TP 12
1534
+ \fBmodified\fP
1535
+ Sort by the last modified time on a file. Always single-threaded.
1536
+ .TP 12
1537
+ \fBaccessed\fP
1538
+ Sort by the last accessed time on a file. Always single-threaded.
1539
+ .TP 12
1540
+ \fBcreated\fP
1541
+ Sort by the creation time on a file. Always single-threaded.
1542
+ .PP
1543
+ If the chosen (manually or by-default) sorting criteria isn't available on your
1544
+ system (for example, creation time is not available on ext4 file systems), then
1545
+ ripgrep will attempt to detect this, print an error and exit without searching.
1546
+ .sp
1547
+ To sort results in reverse or descending order, use the \fB\-\-sortr\fP flag.
1548
+ Also, this flag overrides \fB\-\-sortr\fP.
1549
+ .sp
1550
+ Note that sorting results currently always forces ripgrep to abandon
1551
+ parallelism and run in a single thread.
1552
+ .RE
1553
+ .sp
1554
+ \fB\-\-sortr\fP=\fISORTBY\fP
1555
+ .RS 4
1556
+ This flag enables sorting of results in descending order. The possible values
1557
+ for this flag are:
1558
+ .sp
1559
+ .TP 12
1560
+ \fBnone\fP
1561
+ (Default) Do not sort results. Fastest. Can be multi-threaded.
1562
+ .TP 12
1563
+ \fBpath\fP
1564
+ Sort by file path. Always single-threaded. The order is determined by sorting
1565
+ files in each directory entry during traversal. This means that given the files
1566
+ \fBa/b\fP and \fBa+\fP, the latter will sort before the former even though
1567
+ \fB+\fP would normally sort after \fB/\fP when doing a reverse lexicographic
1568
+ sort.
1569
+ .TP 12
1570
+ \fBmodified\fP
1571
+ Sort by the last modified time on a file. Always single-threaded.
1572
+ .TP 12
1573
+ \fBaccessed\fP
1574
+ Sort by the last accessed time on a file. Always single-threaded.
1575
+ .TP 12
1576
+ \fBcreated\fP
1577
+ Sort by the creation time on a file. Always single-threaded.
1578
+ .PP
1579
+ If the chosen (manually or by-default) sorting criteria isn't available on your
1580
+ system (for example, creation time is not available on ext4 file systems), then
1581
+ ripgrep will attempt to detect this, print an error and exit without searching.
1582
+ .sp
1583
+ To sort results in ascending order, use the \fB\-\-sort\fP flag. Also, this flag
1584
+ overrides \fB\-\-sort\fP.
1585
+ .sp
1586
+ Note that sorting results currently always forces ripgrep to abandon
1587
+ parallelism and run in a single thread.
1588
+ .RE
1589
+ .sp
1590
+ \fB\-\-trim\fP
1591
+ .RS 4
1592
+ When set, all ASCII whitespace at the beginning of each line printed will be
1593
+ removed.
1594
+ .sp
1595
+ This flag can be disabled with \fB\-\-no-trim\fP.
1596
+ .RE
1597
+ .sp
1598
+ \fB\-\-vimgrep\fP
1599
+ .RS 4
1600
+ This flag instructs ripgrep to print results with every match on its own line,
1601
+ including line numbers and column numbers.
1602
+ .sp
1603
+ With this option, a line with more than one match will be printed in its
1604
+ entirety more than once. For that reason, the total amount of output as a
1605
+ result of this flag can be quadratic in the size of the input. For example,
1606
+ if the pattern matches every byte in an input file, then each line will be
1607
+ repeated for every byte matched. For this reason, users should only use this
1608
+ flag when there is no other choice. Editor integrations should prefer some
1609
+ other way of reading results from ripgrep, such as via the \fB\-\-json\fP flag.
1610
+ One alternative to avoiding exorbitant memory usage is to force ripgrep into
1611
+ single threaded mode with the \fB\-j/\-\-threads\fP flag. Note though that this will
1612
+ not impact the total size of the output, just the heap memory that ripgrep will
1613
+ use.
1614
+ .RE
1615
+ .sp
1616
+ \fB\-H\fP, \fB\-\-with-filename\fP
1617
+ .RS 4
1618
+ This flag instructs ripgrep to print the file path for each matching line.
1619
+ This is the default when more than one file is searched. If \fB\-\-heading\fP is
1620
+ enabled (the default when printing to a tty), the file path will be shown above
1621
+ clusters of matches from each file; otherwise, the file name will be shown as a
1622
+ prefix for each matched line.
1623
+ .sp
1624
+ This flag overrides \fB\-I/\-\-no-filename\fP.
1625
+ .RE
1626
+ .sp
1627
+ \fB\-I\fP, \fB\-\-no-filename\fP
1628
+ .RS 4
1629
+ This flag instructs ripgrep to never print the file path with each matching
1630
+ line. This is the default when ripgrep is explicitly instructed to search one
1631
+ file or stdin.
1632
+ .sp
1633
+ This flag overrides \fB\-H/\-\-with-filename\fP.
1634
+ .RE
1635
+ .sp
1636
+ \fB\-\-sort-files\fP
1637
+ .RS 4
1638
+ DEPRECATED. Use \fB\-\-sort=path\fP instead.
1639
+ .sp
1640
+ This flag instructs ripgrep to sort search results by file path
1641
+ lexicographically in ascending order. Note that this currently disables all
1642
+ parallelism and runs search in a single thread.
1643
+ .sp
1644
+ This flag overrides \fB\-\-sort\fP and \fB\-\-sortr\fP.
1645
+ .sp
1646
+ This flag can be disabled with \fB\-\-no-sort-files\fP.
1647
+ .RE
1648
+
1649
+ .
1650
+ .SS OUTPUT MODES
1651
+ \fB\-c\fP, \fB\-\-count\fP
1652
+ .RS 4
1653
+ This flag suppresses normal output and shows the number of lines that match the
1654
+ given patterns for each file searched. Each file containing a match has its
1655
+ path and count printed on each line. Note that unless \fB\-U/\-\-multiline\fP
1656
+ is enabled, this reports the number of lines that match and not the total
1657
+ number of matches. In multiline mode, \fB\-c/\-\-count\fP is equivalent to
1658
+ \fB\-\-count-matches\fP.
1659
+ .sp
1660
+ If only one file is given to ripgrep, then only the count is printed if there
1661
+ is a match. The \fB\-H/\-\-with-filename\fP flag can be used to force printing the
1662
+ file path in this case. If you need a count to be printed regardless of whether
1663
+ there is a match, then use \fB\-\-include-zero\fP.
1664
+ .sp
1665
+ This overrides the \fB\-\-count-matches\fP flag. Note that when \fB\-c/\-\-count\fP
1666
+ is combined with \fB\-o/\-\-only-matching\fP, then ripgrep behaves as if
1667
+ \fB\-\-count-matches\fP was given.
1668
+ .RE
1669
+ .sp
1670
+ \fB\-\-count-matches\fP
1671
+ .RS 4
1672
+ This flag suppresses normal output and shows the number of individual matches
1673
+ of the given patterns for each file searched. Each file containing matches has
1674
+ its path and match count printed on each line. Note that this reports the total
1675
+ number of individual matches and not the number of lines that match.
1676
+ .sp
1677
+ If only one file is given to ripgrep, then only the count is printed if there
1678
+ is a match. The \fB\-H/\-\-with-filename\fP flag can be used to force printing the
1679
+ file path in this case.
1680
+ .sp
1681
+ This overrides the \fB\-c/\-\-count\fP flag. Note that when \fB\-c/\-\-count\fP is combined
1682
+ with \fB\-o/\-\-only-matching\fP, then ripgrep behaves as if \fB\-\-count-matches\fP was
1683
+ given.
1684
+ .RE
1685
+ .sp
1686
+ \fB\-l\fP, \fB\-\-files-with-matches\fP
1687
+ .RS 4
1688
+ Print only the paths with at least one match and suppress match contents.
1689
+ .sp
1690
+ This overrides \fB\-\-files-without-match\fP.
1691
+ .RE
1692
+ .sp
1693
+ \fB\-\-files-without-match\fP
1694
+ .RS 4
1695
+ Print the paths that contain zero matches and suppress match contents.
1696
+ .sp
1697
+ This overrides \fB\-l/\-\-files-with-matches\fP.
1698
+ .RE
1699
+ .sp
1700
+ \fB\-\-json\fP
1701
+ .RS 4
1702
+ Enable printing results in a JSON Lines format.
1703
+ .sp
1704
+ When this flag is provided, ripgrep will emit a sequence of messages, each
1705
+ encoded as a JSON object, where there are five different message types:
1706
+ .sp
1707
+ .TP 12
1708
+ \fBbegin\fP
1709
+ A message that indicates a file is being searched and contains at least one
1710
+ match.
1711
+ .TP 12
1712
+ \fBend\fP
1713
+ A message the indicates a file is done being searched. This message also
1714
+ include summary statistics about the search for a particular file.
1715
+ .TP 12
1716
+ \fBmatch\fP
1717
+ A message that indicates a match was found. This includes the text and offsets
1718
+ of the match.
1719
+ .TP 12
1720
+ \fBcontext\fP
1721
+ A message that indicates a contextual line was found. This includes the text of
1722
+ the line, along with any match information if the search was inverted.
1723
+ .TP 12
1724
+ \fBsummary\fP
1725
+ The final message emitted by ripgrep that contains summary statistics about the
1726
+ search across all files.
1727
+ .PP
1728
+ Since file paths or the contents of files are not guaranteed to be valid
1729
+ UTF-8 and JSON itself must be representable by a Unicode encoding, ripgrep
1730
+ will emit all data elements as objects with one of two keys: \fBtext\fP or
1731
+ \fBbytes\fP. \fBtext\fP is a normal JSON string when the data is valid UTF-8
1732
+ while \fBbytes\fP is the base64 encoded contents of the data.
1733
+ .sp
1734
+ The JSON Lines format is only supported for showing search results. It cannot
1735
+ be used with other flags that emit other types of output, such as \fB\-\-files\fP,
1736
+ \fB\-l/\-\-files-with-matches\fP, \fB\-\-files-without-match\fP, \fB\-c/\-\-count\fP or
1737
+ \fB\-\-count-matches\fP. ripgrep will report an error if any of the aforementioned
1738
+ flags are used in concert with \fB\-\-json\fP.
1739
+ .sp
1740
+ Other flags that control aspects of the standard output such as
1741
+ \fB\-o/\-\-only-matching\fP, \fB\-\-heading\fP, \fB\-r/\-\-replace\fP, \fB\-M/\-\-max-columns\fP, etc.,
1742
+ have no effect when \fB\-\-json\fP is set. However, enabling JSON output will
1743
+ always implicitly and unconditionally enable \fB\-\-stats\fP.
1744
+ .sp
1745
+ A more complete description of the JSON format used can be found here:
1746
+ \fIhttps://docs.rs/grep-printer/*/grep_printer/struct.JSON.html\fP.
1747
+ .sp
1748
+ This flag can be disabled with \fB\-\-no-json\fP.
1749
+ .RE
1750
+
1751
+ .
1752
+ .SS LOGGING OPTIONS
1753
+ \fB\-\-debug\fP
1754
+ .RS 4
1755
+ Show debug messages. Please use this when filing a bug report.
1756
+ .sp
1757
+ The \fB\-\-debug\fP flag is generally useful for figuring out why ripgrep skipped
1758
+ searching a particular file. The debug messages should mention all files
1759
+ skipped and why they were skipped.
1760
+ .sp
1761
+ To get even more debug output, use the \fB\-\-trace\fP flag, which implies
1762
+ \fB\-\-debug\fP along with additional trace data.
1763
+ .RE
1764
+ .sp
1765
+ \fB\-\-no-ignore-messages\fP
1766
+ .RS 4
1767
+ When this flag is enabled, all error messages related to parsing ignore files
1768
+ are suppressed. By default, error messages are printed to stderr. In cases
1769
+ where these errors are expected, this flag can be used to avoid seeing the
1770
+ noise produced by the messages.
1771
+ .sp
1772
+ This flag can be disabled with \fB\-\-ignore-messages\fP.
1773
+ .RE
1774
+ .sp
1775
+ \fB\-\-no-messages\fP
1776
+ .RS 4
1777
+ This flag suppresses some error messages. Specifically, messages related to
1778
+ the failed opening and reading of files. Error messages related to the syntax
1779
+ of the pattern are still shown.
1780
+ .sp
1781
+ This flag can be disabled with \fB\-\-messages\fP.
1782
+ .RE
1783
+ .sp
1784
+ \fB\-\-stats\fP
1785
+ .RS 4
1786
+ When enabled, ripgrep will print aggregate statistics about the search. When
1787
+ this flag is present, ripgrep will print at least the following stats to
1788
+ stdout at the end of the search: number of matched lines, number of files with
1789
+ matches, number of files searched, and the time taken for the entire search to
1790
+ complete.
1791
+ .sp
1792
+ This set of aggregate statistics may expand over time.
1793
+ .sp
1794
+ This flag is always and implicitly enabled when \fB\-\-json\fP is used.
1795
+ .sp
1796
+ Note that this flag has no effect if \fB\-\-files\fP, \fB\-l/\-\-files-with-matches\fP or
1797
+ \fB\-\-files-without-match\fP is passed.
1798
+ .sp
1799
+ This flag can be disabled with \fB\-\-no-stats\fP.
1800
+ .RE
1801
+ .sp
1802
+ \fB\-\-trace\fP
1803
+ .RS 4
1804
+ Show trace messages. This shows even more detail than the \fB\-\-debug\fP
1805
+ flag. Generally, one should only use this if \fB\-\-debug\fP doesn't emit the
1806
+ information you're looking for.
1807
+ .RE
1808
+
1809
+ .
1810
+ .SS OTHER BEHAVIORS
1811
+ \fB\-\-files\fP
1812
+ .RS 4
1813
+ Print each file that would be searched without actually performing the search.
1814
+ This is useful to determine whether a particular file is being searched or not.
1815
+ .sp
1816
+ This overrides \fB\-\-type-list\fP.
1817
+ .RE
1818
+ .sp
1819
+ \fB\-\-generate\fP=\fIKIND\fP
1820
+ .RS 4
1821
+ This flag instructs ripgrep to generate some special kind of output identified
1822
+ by \fIKIND\fP and then quit without searching. \fIKIND\fP can be one of the
1823
+ following values:
1824
+ .sp
1825
+ .TP 15
1826
+ \fBman\fP
1827
+ Generates a manual page for ripgrep in the \fBroff\fP format.
1828
+ .TP 15
1829
+ \fBcomplete\-bash\fP
1830
+ Generates a completion script for the \fBbash\fP shell.
1831
+ .TP 15
1832
+ \fBcomplete\-zsh\fP
1833
+ Generates a completion script for the \fBzsh\fP shell.
1834
+ .TP 15
1835
+ \fBcomplete\-fish\fP
1836
+ Generates a completion script for the \fBfish\fP shell.
1837
+ .TP 15
1838
+ \fBcomplete\-powershell\fP
1839
+ Generates a completion script for PowerShell.
1840
+ .PP
1841
+ The output is written to \fBstdout\fP. The list above may expand over time.
1842
+ .RE
1843
+ .sp
1844
+ \fB\-\-no-config\fP
1845
+ .RS 4
1846
+ When set, ripgrep will never read configuration files. When this flag is
1847
+ present, ripgrep will not respect the \fBRIPGREP_CONFIG_PATH\fP environment
1848
+ variable.
1849
+ .sp
1850
+ If ripgrep ever grows a feature to automatically read configuration files in
1851
+ pre-defined locations, then this flag will also disable that behavior as well.
1852
+ .RE
1853
+ .sp
1854
+ \fB\-\-pcre2-version\fP
1855
+ .RS 4
1856
+ When this flag is present, ripgrep will print the version of PCRE2 in use,
1857
+ along with other information, and then exit. If PCRE2 is not available, then
1858
+ ripgrep will print an error message and exit with an error code.
1859
+ .RE
1860
+ .sp
1861
+ \fB\-\-type-list\fP
1862
+ .RS 4
1863
+ Show all supported file types and their corresponding globs. This takes any
1864
+ \fB\-\-type-add\fP and \fB\-\-type-clear\fP flags given into account. Each type is
1865
+ printed on its own line, followed by a \fB:\fP and then a comma-delimited list
1866
+ of globs for that type on the same line.
1867
+ .RE
1868
+ .sp
1869
+ \fB\-V\fP, \fB\-\-version\fP
1870
+ .RS 4
1871
+ This flag prints ripgrep's version. This also may print other relevant
1872
+ information, such as the presence of target specific optimizations and the
1873
+ \fBgit\fP revision that this build of ripgrep was compiled from.
1874
+ .RE
1875
+
1876
+ .
1877
+ .
1878
+ .SH EXIT STATUS
1879
+ If ripgrep finds a match, then the exit status of the program is \fB0\fP.
1880
+ If no match could be found, then the exit status is \fB1\fP. If an error
1881
+ occurred, then the exit status is always \fB2\fP unless ripgrep was run with
1882
+ the \fB\-q/\-\-quiet\fP flag and a match was found. In summary:
1883
+ .sp
1884
+ .IP \(bu 3n
1885
+ \fB0\fP exit status occurs only when at least one match was found, and if
1886
+ no error occurred, unless \fB\-q/\-\-quiet\fP was given.
1887
+ .
1888
+ .IP \(bu 3n
1889
+ \fB1\fP exit status occurs only when no match was found and no error occurred.
1890
+ .
1891
+ .IP \(bu 3n
1892
+ \fB2\fP exit status occurs when an error occurred. This is true for both
1893
+ catastrophic errors (e.g., a regex syntax error) and for soft errors (e.g.,
1894
+ unable to read a file).
1895
+ .
1896
+ .
1897
+ .SH AUTOMATIC FILTERING
1898
+ ripgrep does a fair bit of automatic filtering by default. This section
1899
+ describes that filtering and how to control it.
1900
+ .sp
1901
+ \fBTIP\fP: To disable automatic filtering, use \fBrg -uuu\fP.
1902
+ .sp
1903
+ ripgrep's automatic "smart" filtering is one of the most apparent
1904
+ differentiating features between ripgrep and other tools like \fBgrep\fP. As
1905
+ such, its behavior may be surprising to users that aren't expecting it.
1906
+ .sp
1907
+ ripgrep does four types of filtering automatically:
1908
+ .sp
1909
+ .
1910
+ .IP 1. 3n
1911
+ Files and directories that match ignore rules are not searched.
1912
+ .IP 2. 3n
1913
+ Hidden files and directories are not searched.
1914
+ .IP 3. 3n
1915
+ Binary files (files with a \fBNUL\fP byte) are not searched.
1916
+ .IP 4. 3n
1917
+ Symbolic links are not followed.
1918
+ .PP
1919
+ The first type of filtering is the most sophisticated. ripgrep will attempt to
1920
+ respect your \fBgitignore\fP rules as faithfully as possible. In particular,
1921
+ this includes the following:
1922
+ .
1923
+ .IP \(bu 3n
1924
+ Any global rules, e.g., in \fB$HOME/.config/git/ignore\fP.
1925
+ .
1926
+ .IP \(bu 3n
1927
+ Any rules in relevant \fB.gitignore\fP files. This includes \fB.gitignore\fP
1928
+ files in parent directories that are part of the same \fBgit\fP repository.
1929
+ (Unless \fB\-\-no\-require\-git\fP is given.)
1930
+ .
1931
+ .IP \(bu 3n
1932
+ Any local rules, e.g., in \fB.git/info/exclude\fP.
1933
+ .PP
1934
+ In some cases, ripgrep and \fBgit\fP will not always be in sync in terms
1935
+ of which files are ignored. For example, a file that is ignored via
1936
+ \fB.gitignore\fP but is tracked by \fBgit\fP would not be searched by ripgrep
1937
+ even though \fBgit\fP tracks it. This is unlikely to ever be fixed. Instead,
1938
+ you should either make sure your exclude rules match the files you track
1939
+ precisely, or otherwise use \fBgit grep\fP for search.
1940
+ .sp
1941
+ Additional ignore rules can be provided outside of a \fBgit\fP context:
1942
+ .
1943
+ .IP \(bu 3n
1944
+ Any rules in \fB.ignore\fP. ripgrep will also respect \fB.ignore\fP files in
1945
+ parent directories.
1946
+ .
1947
+ .IP \(bu 3n
1948
+ Any rules in \fB.rgignore\fP. ripgrep will also respect \fB.rgignore\fP files
1949
+ in parent directories.
1950
+ .
1951
+ .IP \(bu 3n
1952
+ Any rules in files specified with the \fB\-\-ignore\-file\fP flag.
1953
+ .PP
1954
+ The precedence of ignore rules is as follows, with later items overriding
1955
+ earlier items:
1956
+ .
1957
+ .IP \(bu 3n
1958
+ Files given by \fB\-\-ignore\-file\fP.
1959
+ .
1960
+ .IP \(bu 3n
1961
+ Global gitignore rules, e.g., from \fB$HOME/.config/git/ignore\fP.
1962
+ .
1963
+ .IP \(bu 3n
1964
+ Local rules from \fB.git/info/exclude\fP.
1965
+ .
1966
+ .IP \(bu 3n
1967
+ Rules from \fB.gitignore\fP.
1968
+ .
1969
+ .IP \(bu 3n
1970
+ Rules from \fB.ignore\fP.
1971
+ .
1972
+ .IP \(bu 3n
1973
+ Rules from \fB.rgignore\fP.
1974
+ .PP
1975
+ So for example, if \fIfoo\fP were in a \fB.gitignore\fP and \fB!\fP\fIfoo\fP
1976
+ were in an \fB.rgignore\fP, then \fIfoo\fP would not be ignored since
1977
+ \fB.rgignore\fP takes precedence over \fB.gitignore\fP.
1978
+ .sp
1979
+ Each of the types of filtering can be configured via command line flags:
1980
+ .
1981
+ .IP \(bu 3n
1982
+ There are several flags starting with \fB\-\-no\-ignore\fP that toggle which,
1983
+ if any, ignore rules are respected. \fB\-\-no\-ignore\fP by itself will disable
1984
+ all
1985
+ of them.
1986
+ .
1987
+ .IP \(bu 3n
1988
+ \fB\-./\-\-hidden\fP will force ripgrep to search hidden files and directories.
1989
+ .
1990
+ .IP \(bu 3n
1991
+ \fB\-\-binary\fP will force ripgrep to search binary files.
1992
+ .
1993
+ .IP \(bu 3n
1994
+ \fB\-L/\-\-follow\fP will force ripgrep to follow symlinks.
1995
+ .PP
1996
+ As a special short hand, the \fB\-u\fP flag can be specified up to three times.
1997
+ Each additional time incrementally decreases filtering:
1998
+ .
1999
+ .IP \(bu 3n
2000
+ \fB\-u\fP is equivalent to \fB\-\-no\-ignore\fP.
2001
+ .
2002
+ .IP \(bu 3n
2003
+ \fB\-uu\fP is equivalent to \fB\-\-no\-ignore \-\-hidden\fP.
2004
+ .
2005
+ .IP \(bu 3n
2006
+ \fB\-uuu\fP is equivalent to \fB\-\-no\-ignore \-\-hidden \-\-binary\fP.
2007
+ .PP
2008
+ In particular, \fBrg -uuu\fP should search the same exact content as \fBgrep
2009
+ -r\fP.
2010
+ .
2011
+ .
2012
+ .SH CONFIGURATION FILES
2013
+ ripgrep supports reading configuration files that change ripgrep's default
2014
+ behavior. The format of the configuration file is an "rc" style and is very
2015
+ simple. It is defined by two rules:
2016
+ .
2017
+ .IP 1. 3n
2018
+ Every line is a shell argument, after trimming whitespace.
2019
+ .
2020
+ .IP 2. 3n
2021
+ Lines starting with \fB#\fP (optionally preceded by any amount of whitespace)
2022
+ are ignored.
2023
+ .PP
2024
+ ripgrep will look for a single configuration file if and only if the
2025
+ \fBRIPGREP_CONFIG_PATH\fP environment variable is set and is non-empty.
2026
+ ripgrep will parse arguments from this file on startup and will behave as if
2027
+ the arguments in this file were prepended to any explicit arguments given to
2028
+ ripgrep on the command line. Note though that the \fBrg\fP command you run
2029
+ must still be valid. That is, it must always contain at least one pattern at
2030
+ the command line, even if the configuration file uses the \fB\-e/\-\-regexp\fP
2031
+ flag.
2032
+ .sp
2033
+ For example, if your ripgreprc file contained a single line:
2034
+ .sp
2035
+ .EX
2036
+ \-\-smart\-case
2037
+ .EE
2038
+ .sp
2039
+ then the following command
2040
+ .sp
2041
+ .EX
2042
+ RIPGREP_CONFIG_PATH=wherever/.ripgreprc rg foo
2043
+ .EE
2044
+ .sp
2045
+ would behave identically to the following command:
2046
+ .sp
2047
+ .EX
2048
+ rg \-\-smart-case foo
2049
+ .EE
2050
+ .sp
2051
+ Another example is adding types, like so:
2052
+ .sp
2053
+ .EX
2054
+ \-\-type-add
2055
+ web:*.{html,css,js}*
2056
+ .EE
2057
+ .sp
2058
+ The above would behave identically to the following command:
2059
+ .sp
2060
+ .EX
2061
+ rg \-\-type\-add 'web:*.{html,css,js}*' foo
2062
+ .EE
2063
+ .sp
2064
+ The same applies to using globs. This:
2065
+ .sp
2066
+ .EX
2067
+ \-\-glob=!.git
2068
+ .EE
2069
+ .sp
2070
+ or this:
2071
+ .sp
2072
+ .EX
2073
+ \-\-glob
2074
+ !.git
2075
+ .EE
2076
+ .sp
2077
+ would behave identically to the following command:
2078
+ .sp
2079
+ .EX
2080
+ rg \-\-glob '!.git' foo
2081
+ .EE
2082
+ .sp
2083
+ The bottom line is that every shell argument needs to be on its own line. So
2084
+ for example, a config file containing
2085
+ .sp
2086
+ .EX
2087
+ \-j 4
2088
+ .EE
2089
+ .sp
2090
+ is probably not doing what you intend. Instead, you want
2091
+ .sp
2092
+ .EX
2093
+ \-j
2094
+ 4
2095
+ .EE
2096
+ .sp
2097
+ or
2098
+ .sp
2099
+ .EX
2100
+ \-j4
2101
+ .EE
2102
+ .sp
2103
+ ripgrep also provides a flag, \fB\-\-no\-config\fP, that when present will
2104
+ suppress any and all support for configuration. This includes any future
2105
+ support for auto-loading configuration files from pre-determined paths.
2106
+ .sp
2107
+ Conflicts between configuration files and explicit arguments are handled
2108
+ exactly like conflicts in the same command line invocation. That is, assuming
2109
+ your config file contains only \fB\-\-smart\-case\fP, then this command:
2110
+ .sp
2111
+ .EX
2112
+ RIPGREP_CONFIG_PATH=wherever/.ripgreprc rg foo \-\-case\-sensitive
2113
+ .EE
2114
+ .sp
2115
+ is exactly equivalent to
2116
+ .sp
2117
+ .EX
2118
+ rg \-\-smart\-case foo \-\-case\-sensitive
2119
+ .EE
2120
+ .sp
2121
+ in which case, the \fB\-\-case\-sensitive\fP flag would override the
2122
+ \fB\-\-smart\-case\fP flag.
2123
+ .
2124
+ .
2125
+ .SH SHELL COMPLETION
2126
+ Shell completion files are included in the release tarball for Bash, Fish, Zsh
2127
+ and PowerShell.
2128
+ .sp
2129
+ For \fBbash\fP, move \fBrg.bash\fP to \fB$XDG_CONFIG_HOME/bash_completion\fP or
2130
+ \fB/etc/bash_completion.d/\fP.
2131
+ .sp
2132
+ For \fBfish\fP, move \fBrg.fish\fP to \fB$HOME/.config/fish/completions\fP.
2133
+ .sp
2134
+ For \fBzsh\fP, move \fB_rg\fP to one of your \fB$fpath\fP directories.
2135
+ .
2136
+ .
2137
+ .SH CAVEATS
2138
+ ripgrep may abort unexpectedly when using default settings if it searches a
2139
+ file that is simultaneously truncated. This behavior can be avoided by passing
2140
+ the \fB\-\-no\-mmap\fP flag which will forcefully disable the use of memory
2141
+ maps in all cases.
2142
+ .sp
2143
+ ripgrep may use a large amount of memory depending on a few factors. Firstly,
2144
+ if ripgrep uses parallelism for search (the default), then the entire
2145
+ output for each individual file is buffered into memory in order to prevent
2146
+ interleaving matches in the output. To avoid this, you can disable parallelism
2147
+ with the \fB\-j1\fP flag. Secondly, ripgrep always needs to have at least a
2148
+ single line in memory in order to execute a search. A file with a very long
2149
+ line can thus cause ripgrep to use a lot of memory. Generally, this only occurs
2150
+ when searching binary data with the \fB\-a/\-\-text\fP flag enabled. (When the
2151
+ \fB\-a/\-\-text\fP flag isn't enabled, ripgrep will replace all NUL bytes with
2152
+ line terminators, which typically prevents exorbitant memory usage.) Thirdly,
2153
+ when ripgrep searches a large file using a memory map, the process will likely
2154
+ report its resident memory usage as the size of the file. However, this does
2155
+ not mean ripgrep actually needed to use that much heap memory; the operating
2156
+ system will generally handle this for you.
2157
+ .
2158
+ .
2159
+ .SH VERSION
2160
+ 14.1.0 (rev e50df40a19)
2161
+ .
2162
+ .
2163
+ .SH HOMEPAGE
2164
+ \fIhttps://github.com/BurntSushi/ripgrep\fP
2165
+ .sp
2166
+ Please report bugs and feature requests to the issue tracker. Please do your
2167
+ best to provide a reproducible test case for bugs. This should include the
2168
+ corpus being searched, the \fBrg\fP command, the actual output and the expected
2169
+ output. Please also include the output of running the same \fBrg\fP command but
2170
+ with the \fB\-\-debug\fP flag.
2171
+ .sp
2172
+ If you have questions that don't obviously fall into the "bug" or "feature
2173
+ request" category, then they are welcome in the Discussions section of the
2174
+ issue tracker: \fIhttps://github.com/BurntSushi/ripgrep/discussions\fP.
2175
+ .
2176
+ .
2177
+ .SH AUTHORS
2178
+ Andrew Gallant <\fIjamslam@gmail.com\fP>