File and Path Selection
--binary |
Enable binary file searching |
-L |
Follow symbolic links (not default) |
|
Include or exclude files and directories. Overrides any other ignore logic. |
|
Like -g
but case-insensitive |
--no-ignore |
Don't respect any ignore files |
-z |
Search in compressed files |
|
Only search for ( -t
) / exclude ( -T
) files of TYPE. Use --type-list
to show all |
Globbing rules match .gitignore
style. Precede glob with a !
to exclude.
There are several other options to not respect only certain ignore files: ‑‑no‑ignore‑dot
, ‑‑no‑ignore‑global
, ‑‑no‑ignore‑parent
, and ‑‑no‑ignore‑vcs
.
The -z
option requires decompression binaries to be on the PATH. Consider instead the ripgrep-all variant.
Matcher Selection
-F |
Treat pattern as literal string |
-P |
Use the PCRE2 regex engine |
--auto-hybrid-regex |
Choose regex engine based on features used in pattern |
Use the PCRE2 engine to support look-around or backreferences.
|
|
Matching Control
-s |
Search case-sensitively |
-S |
Search case-insensitively if pattern is all lowercase, otherwise sensitively |
--crlf |
Treat CRLF as line terminator for $
|
|
Preprocess file with CMD before searching |
|
Used to specify which files to preprocess |
-e |
Used to specify multiple patterns or protect patterns starting with "-" |
-w, --word-regexp |
Only matches surrounded by word boundaries |
-c |
Count matched lines/file |
--count-matches |
Count matches per file |
Other Options
--no-messages |
Hide file open/read errs |
--block-buffered |
Flush on in-memory buffer size (default in pipeline or to file) |
--line-buffered |
Flush per line (default in terminal) |
|
Encoding for reading files (e.g. utf-8
, utf-16
, ascii
, windows-1252
) |
|
Approx threads to use |
|
Show <num>
lines after each match ( A
), before ( B
), or before and after ( C
) |
|
|
Output Options
|
auto
, never
, always
, or ansi
(emit ANSI escapes). |
--column |
Show column numbers (1-based) for first match |
|
Show only names of matching files |
--files-without- match |
Show only names of non-matching files |
--no-heading |
File path at start of line instead of before group |
|
Never print file name |
-N |
Suppress line numbers |
-0, --null |
Follow any file path with a NUL byte |
--null-data |
Use NUL as a line terminator instead of '\n' |
-o |
Print only match |
|
Alt char for outputting path separator |
-p, --pretty |
Alias for ‑‑color always ‑‑heading ‑‑line‑number
|
|
Replace match with <TEXT>
in output (will never modify files) |
|
Sorts results ascending ( --sortr
for descending). Options: path
, modified
, accessed
, created
, none
|
--trim |
Trim lead whitespace |
-q |
Quiet, no output |
|
Created By
Metadata
Favourited By
Comments
No comments yet. Add yours below!
Add a Comment
More Cheat Sheets by njones