RG(1) User Commands RG(1) (NAME) rg - (SYNOPSIS) rg [OPTIONS] PATTERN [PATH...] rg [OPTIONS] -e PATTERN... [PATH...] rg [OPTIONS] -f PATTERNFILE... [PATH...] rg [OPTIONS] --files [PATH...] rg [OPTIONS] --type-list command | rg [OPTIONS] PATTERN rg [OPTIONS] --help rg [OPTIONS] --version (DESCRIPTION) ripgrep (rg) (regex) . ripgrep .gitignore (binary) . ripgrep (finite automata) . (backreferences) (look-around) . ripgrep PCRE2 -P/--pcre2 . ripgrep . RIPGREP_CONFIG_PATH . . # . CONFIGURATION FILES . ripgrep stdin stdin regex ls | rg foo. stdin . stdin rg foo ./. ls ripgrep stdout tty . tty ripgrep . : ripgrep grep rg -uuu . (REGEX SYNTAX) ripgrep Rust : https://docs.rs/regex/1.*/regex/#syntax ripgrep : https://docs.rs/regex/1.*/regex/bytes/index.html#syntax ripgrep Perl (look- around) (backreferences) . (ERE) *egrep* . ripgrep -P/--pcre2 https://www.pcre.org (man) PCRE2 . (POSITIONAL ARGUMENTS) PATTERN . -e/--regexp . PATH . . (glob) (ignore) . (OPTIONS) ripgrep . . . . --column ( ) ripgrep --no-column ( ) . . --no-ignore ( ) gitignore ripgrep --ignore ( ) . ripgrep ( ) . . . (INPUT OPTIONS) -e PATTERN, --regexp=PATTERN . -f/--file . . . -foo: rg -e -foo -- . : rg -- -foo -f/--file -e/--regexp ripgrep . -f PATTERNFILE, --file=PATTERNFILE . -e/--regexp . (newline) . . PATTERNFILE - stdin . -f/--file -e/--regexp ripgrep . --pre=COMMAND PATH ripgrep PATH COMMAND PATH . COMMAND PATH . COMMAND --no-pre . (WARNING) ripgrep (process) . . --pre-glob . ripgrep stdin . COMMAND (wrapper) PATH (magic numbers)/ PATH . COMMAND PATH . COMMAND : case "$1" in *.pdf) exec pdftotext "$1" - ;; *) case $(file "$1") in *Zstandard*) exec pzstd -cdq ;; *) exec cat ;; esac ;; esac pdftotext PDF . file . Zstandard pzstd stdout . -z/--search-zip . --pre-glob=GLOB --pre . --pre-glob (globs) --pre . . --pre . pre-pdftotext: #!/bin/sh pdftotext "$1" - --pre pre-pdftotext --pre-glob '*.pdf' ripgrep pre- pdftotext .pdf . --pre-glob . (globbing) gitignore . ! . --pre . -z, --search-zip ripgrep . gzip bzip2 xz LZ4 LZMA Brotli Zstd . ( gzip) PATH . ripgrep . --debug . ripgrep . ripgrep . --pre . --no- search-zip . -s, --case-sensitive . . ripgrep . regex . (?i)abc abc . -i/--ignore-case -S/--smart-case . --crlf ripgrep \n CRLF (\r\n) . ^ $ regex CRLF CR LF LF . CR LF . CRLF . regex CRLF R . (?R:$) CR LF CR LF . --null-data . --no- crlf . --dfa-size-limit=NUM+SUFFIX? DFA regex. . regex regex ( ) . K M G . . -E ENCODING, --encoding=ENCODING (encoding) ripgrep . auto ripgrep . (BOM) UTF-8 UTF-16 . . none BOM BOM . : https://encoding.spec.whatwg.org/#concept-encoding-get. ripgrep GUIDE.md . ripgrep --no-encoding . --engine=ENGINE (regex) . regex ripgrep ( -e/--regexp -f/--file). default pcre2 auto. default . pcre2 look-around (backreferences) . auto regex . pcre2 ripgrep . PCRE2 ripgrep ripgrep . -P/--pcre2 --auto-hybrid-regex . -F, --fixed-strings () . .(){}*+ . --no- fixed-strings . -i, --ignore-case . regex ripgrep (<> case folding) . ripgrep . regex . (?-i)abc abc . -s/--case-sensitive -S/--smart-case . -v, --invert-match ripgrep . . -l/--files-with-matches . --files-without-match . --no- invert-match . -x, --line-regexp ripgrep . ^ $ . . -w/--word-regexp . -m NUM, --max-count=NUM NUM . -U/--multiline . . -A/--after-context -C/--context (context) . 0 . ripgrep . --mmap ripgrep (memory maps) . ripgrep . . stdin. . ripgrep (truncate) . . --no- mmap . -U, --multiline . ripgrep . () \p{any} (codepoint) \n . \n ripgrep . \p{any} \n \n . . regex . \n ripgrep . . \n <> . (?s). (?s:.) . \n . --multiline-dotall <> . . . : regex . ripgrep ( heap ). ( stdin) EOF . ripgrep . -U/--multiline regex \n ripgrep . . --stop-on-nonmatch . --no- multiline . --multiline-dotall <> regex . . . -U/--multiline . . . ( ) -U/--multiline . <> . (alias) ripgrep <> . <> regex (?s:.) <> (?-s:.) <> . \p{any} <> . --no- multiline-dotall . --no-unicode ripgrep . ripgrep << >> . : . UTF-8 . o \w \s \d ASCII . o (Unicode case folding) . o \p{Emoji} . ( regex . regex .) o (\b \B) . . . \w ( \w{100}) ASCII . --unicode . --null-data ripgrep \n NUL . \n . ripgrep . NUL OOM ( / out of memory) . NUL -0/--null ripgrep --print0 find . -a/--text . --crlf . -P, --pcre2 ripgrep regex regex (PCRE2) . look-around (backreferences) . --engine=pcre2 . --engine=auto ripgrep regex . --engine . PCRE2 ripgrep . PCRE2 ripgrep ripgrep . PCRE2 API (introspection APIs) regex ripgrep . \n regex PCRE2 -U/--multiline ripgrep (silently fail) regex . --no- pcre2 . --regex-size-limit=NUM+SUFFIX? regex regex ripgrep . ( ) . ripgrep / regex . K M G . . -S, --smart-case ripgrep . . : o (literal) . a\w (a) \w . o . foo\pL Foo\pL . -s/--case-sensitive -i/--ignore-case . --stop-on-nonmatch ripgrep -- -- . (sort ) . -U/--multiline . -a, --text ripgrep . ripgrep . . (escape codes) . . (heuristic) . NUL ( ). --binary ripgrep NUL ( ). --binary . --no- text . -j NUM, --threads=NUM (threads) . 0 ( ) ripgrep . -w, --word-regexp ripgrep (word boundaries) . \b{start-half} \b{end-half} . regex ripgrep \b \b{start-half} \W|\A \b{end-half} \W|\z . -x/--line-regexp . --auto-hybrid-regex (DEPRECATED). --engine . ripgrep regex . ripgrep regex ripgrep ( -e/--regexp -f/--file) . ripgrep regex . PCRE2 regex PCRE2 . PCRE2 regex . ripgrep regex . . ripgrep regex ripgrep . regex regex look-around . --no- auto-hybrid-regex . --no-pcre2-unicode (DEPRECATED). --no-unicode . . --pcre2-unicode . --binary ripgrep (binary) . ripgrep . NUL . ( ) NUL ripgrep . NUL . NUL ripgrep . ripgrep NUL . NUL ( ) . ripgrep . ripgrep NUL ( stdout ) -a/--text . --binary ripgrep . stdin . -u/--unrestricted . -a/--text . --no- binary . -L, --follow ripgrep (symbolic links) . . ripgrep . ripgrep . --no-messages . --no- follow . -g GLOB, --glob=GLOB glob . . glob . .gitignore . ! . . glob : -g 'ab{c,d}*' -g abc -g abd. -g 'ab{,c}' . gitignore git . ripgrep gitignore -g/--glob . . foo -g foo foo/bar foo . -g 'foo/**'. . --glob-case-insensitive glob -g/--glob . -g/--glob --iglob . --no- glob-case-insensitive . -., --hidden . . (whitelist) ripgrep . (.) . <<>> Windows . -./--hidden .git --no-ignore-vcs . -./--hidden . --no- hidden . --iglob=GLOB glob . . glob . .gitignore . ! . . . --ignore-file=PATH gitignore . .gitignore .rgignore .ignore . . . . -g/--glob . --ignore-file-case-insensitive (.gitignore .ignore ) . ( Windows) . --no- ignore-file-case-insensitive . -d NUM, --max-depth=NUM NUM . 0 . rg --max-depth 0 dir/ dir/ . rg --max-depth 1 dir/ dir . --maxdepth . --max-filesize=NUM+SUFFIX? NUM. . K M G . . : --max-filesize 50K --max-filesize 80M. --no-ignore .gitignore .ignore .rgignore . --no-ignore-dot --no-ignore-exclude --no-ignore-global --no-ignore-parent --no-ignore-vcs . --no-ignore-files --ignore-file . -u/--unrestricted . -u/--unrestricted . --ignore . --no-ignore-dot .ignore .rgignore. ripgrep . -./--hidden . .gitignore . --ignore-dot . --no-ignore-exclude . .git/info/exclude git . --ignore-exclude . --no-ignore-files --ignore-file . --ignore-files . --no-ignore-global <<>> (global) core.excludesFile git ( $HOME/.config/git/ignore ). --ignore-global . --no-ignore-parent . ripgrep . . --ignore-parent . --no-ignore-vcs ( .gitignore) . ripgrep git . .ignore .rgignore . (.) ( .git) . -./--hidden . --no-ignore-parent . --ignore-vcs . --no-require-git .gitignore git . ripgrep .git . . git . --require-git . --one-file-system ripgrep . ripgrep . rg --one-file-system /foo/bar /quux/baz ripgrep /foo/bar /quux/baz . -xdev -mount find . --no- one-file-system . -t TYPE, --type=TYPE ripgrep TYPE . -t/--type . all -t/--type ripgrep ( ) . --type=all ripgrep << >> . -g/--glob . --type-list . -T TYPE, --type-not=TYPE TYPE . -T/--type-not . --type-list . all -T/--type-not ripgrep ( ) . --type-not=all ripgrep << >> . --type-list . --type-add=TYPESPEC glob . . --type-add . ripgrep --type-clear . ripgrep . CONFIGURATION FILES . : rg --type-add 'foo:*.foo' -tfoo PATTERN include . ( ) . src C++ Python Markdown : --type-add 'src:include:cpp,py,md' glob src : --type-add 'src:include:cpp,py,md' --type-add 'src:*.foo' . . --type-clear=TYPE TYPE . TYPE . ripgrep . CONFIGURATION FILES . -u, --unrestricted <<>> . ( ) . ripgrep . -u/--unrestricted --no-ignore . -u/--unrestricted --no-ignore -./--hidden . --no-ignore -./--hidden --binary . ripgrep -uuu . -L/--follow -a/--text . -A NUM, --after-context=NUM NUM . --passthru -C/--context . -B NUM, --before-context=NUM NUM . --passthru -C/--context . --block-buffered ripgrep stdout . ripgrep . stdout tty . tty . --line-buffered . --no-block-buffered . -b, --byte-offset ( ) . -o/--only-matching . ripgrep (transcoding) . --pre . --no-byte-offset . --color=WHEN . auto ripgrep . ripgrep tty . ripgrep : o TERM dumb . o NO_COLOR ( ). o --vimgrep --json. : never . auto . ripgrep . always . ansi 'always' ANSI ( ). (hyperlinks) . . --colors none : --colors 'path:none' \ --colors 'line:none' \ --colors 'column:none' \ --colors 'match:none' \ --colors 'highlight:none' --colors=COLOR_SPEC . . . : red blue green cyan magenta yellow white black. nobold bold nointense intense nounderline underline noitalic italic . {type}:{attribute}:{value} . type path line column highlight match . attribute fg bg style . value ( fg bg) . {type}:none type . : rg --colors 'match:fg:magenta' --colors 'line:bg:yellow' <<>> (highlight) : rg --colors 'highlight:bg:yellow' --colors 'highlight:fg:black' "highlight" -B/--before-context -A/--after-context -C/--context --passthru . tty ANSI value . x (256 ) x,x,x ( / truecolor) x 0 255 ( ) . x 0x . rgb (0,128,255) : rg --colors 'match:bg:0,128,255' : rg --colors 'match:bg:0x0,0x80,0xFF' intense nointense . --column ( ). . . -n/--line-number . -o/--only-matching . --no-column . -C NUM, --context=NUM NUM . -B/--before-context -A/--after-context . --passthru . -A/--after-context -B/--before-context . -A2 -C1 -A2 -B1 . --context-separator=SEPARATOR . ( -A/--after-context -B/--before-context -C/--context). \x7F \t . -- . . --no-context-separator . --field-context-separator=SEPARATOR . . . . \x7F \t . - . --field-match-separator=SEPARATOR . . . . \x7F \t . : . --heading . tty . stdout tty ripgrep -grep . ripgrep cat . rg foo | cat. --no-heading . -h, --help ripgrep . -h --help . . . --hostname-bin=COMMAND ripgrep . ( PATH ). ripgrep ( ) . ( ) ripgrep . gethostname . GetComputerNameExW "physical DNS hostname" . ripgrep . --hyperlink-format=FORMAT . ripgrep . OSC-8 . file://{host}{path} RFC 8089 . ripgrep --debug . : default none cursor file grep+ kitty macvim textmate vscode vscode-insiders vscodium. . : {path} . . (percent encoded) URI . / . {host} . (hostname) . Unix gethostname . Windows GetComputerNameExW << DNS>> . --hostname-bin . . {line} . . ( --no-line-number ) 1 . {column} {line} . . ( --no-column ) 1 . {wslprefix} . wsl$/WSL_DISTRO_NAME WSL_DISTRO_NAME . Unix WSL_DISTRO_NAME . (format string) . none . (hyperlinks) . ripgrep . . default . ripgrep (stdout) tty . --color=always . . ripgrep ANSI : --colors 'path:none' \ --colors 'line:none' \ --colors 'column:none' \ --colors 'match:none' ripgrep --color ANSI . NO_COLOR=1 TERM=dumb . ripgrep tty ( --color=always ). : rg foo path/to/file . -H/--with-filename . : https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda --include-zero -c/--count --count-matches ripgrep ( ) . ripgrep grep . --no-include-zero . --line-buffered ripgrep (line buffering) stdout (flush) . ripgrep stdout tty ripgrep (block buffering) . ripgrep . (pipelines) : tail -f something.log | rg foo --line-buffered | rg bar --block-buffered . --no-line-buffered . -n, --line-number ( ). stdout tty . -N/--no-line-number . -N, --no-line-number . stdout tty . -n/--line-number . -M NUM, --max-columns=NUM ripgrep ( ) . . 0 . --max-columns-preview . -M/--max-columns ripgrep . -M/--max-columns ( ) . -M/--max-columns . --no-max-columns-preview . -0, --null NUL . -c/--count -l/--files-with-matches --files . xargs . -o, --only-matching () . --path-separator=SEPARATOR . Unix / Windows \ . ( cygwin) . . . --passthru . . rg foo rg '^|foo' foo . . --passthrough . -C/--context -A/--after-context -B/--before-context . -p, --pretty --color=always --heading --line-number . ripgrep . : rg -p foo | less -R. -q, --quiet stdout . ripgrep . ripgrep ( ). --files (ignore rules) ripgrep . -r REPLACEMENT, --replace=REPLACEMENT . ripgrep . ( $5) ( $foo) . $1 . $0 . ( [_0-9A-Za-z]) $ . $1a 1a 1. . ${1}a 1 a . . Bash zsh (double quotes) (single quotes) . . $ $$ . . . -o/--only-matching . --sort=SORTBY . : none () . . path . . . a/b a+ + / . modified . . accessed . . created . . ( ) ( ext4 ) ripgrep . --sortr . --sortr . ripgrep . --sortr=SORTBY . : none () . . path . . . a/b a+ + / . modified . . accessed . . created . . ( ) ( ext4 ) ripgrep . --sort . --sort . ripgrep . --trim (whitespace) (ASCII) . --no-trim . --vimgrep ripgrep . . (quadratic) . . . ripgrep --json. ripgrep -j/--threads . (heap memory) ripgrep . -H, --with-filename ripgrep . . --heading ( tty) . -I/--no-filename . -I, --no-filename ripgrep . ripgrep stdin . -H/--with-filename . --sort-files (DEPRECATED). --sort=path . ripgrep . . --sort --sortr . --no-sort-files . -c, --count . . -U/--multiline / . / -c/--count --count-matches . ripgrep . -H/--with-filename . --include-zero . -l/--files-with-matches . ripgrep . ripgrep . -l/--files-with-matches ripgrep . --binary . --count-matches . -c/--count -o/--only-matching ripgrep --count-matches . --count-matches . . . ripgrep . -H/--with-filename . -c/--count . -c/--count -o/--only-matching ripgrep --count-matches . -l, --files-with-matches . -c/--count . ripgrep . ripgrep . -c/--count ripgrep . --binary . --files-without-match . --files-without-match . -l/--files-with-matches . --json JSON Lines . ripgrep JSON : begin . end . . match . . context (context) . ( ) . summary ripgrep . UTF-8 JSON ripgrep text bytes . text UTF-8 JSON bytes base64 . JSON Lines . --files -l/--files-with-matches --files-without-match -c/--count --count-matches . --json ripgrep . -o/--only-matching --heading -r/--replace -M/--max-columns --json . JSON --stats . JSON : https://docs.rs/grep- printer/*/grep_printer/struct.JSON.html. --no-json . (LOGGING OPTIONS) --debug . . --debug ripgrep . . --trace --debug . --no-ignore-messages ignore . (stderr) . . --ignore-messages . --no-messages . (syntax) . --messages . --stats ripgrep . ripgrep (stdout) : . . --json . --files -l/--files-with-matches --files-without-match . --no- stats . --trace . --debug . --debug . --files . . --type-list . --generate=KIND ripgrep KIND . KIND : man (man page) ripgrep roff . complete-bash bash . complete-zsh zsh . complete-fish fish . complete-powershell PowerShell . stdout . . --no-config ripgrep . ripgrep RIPGREP_CONFIG_PATH . ripgrep . --pcre2-version ripgrep PCRE2 . PCRE2 ripgrep . --type-list (glob) . --type-add --type-clear . : . -V, --version ripgrep . (revision) git ripgrep . (EXIT STATUS) ripgrep 0 . 1 . 2 ripgrep -q/--quiet . : o 0 -q/--quiet . o 1 . o 2 . ( ) ( ) . (AUTOMATIC FILTERING) ripgrep . . : rg -uuu . <<>> ripgrep ripgrep grep . . ripgrep : 1. (ignore) . 2. . 3. ( NUL) . 4. . . ripgrep gitignore . : o $HOME/.config/git/ignore. o .gitignore. .gitignore git . ( --no-require-git .) o .git/info/exclude. ripgrep git . .gitignore git ripgrep git . . git grep . git : o .ignore. ripgrep .ignore . o .rgignore. ripgrep .rgignore . o --ignore-file. : o --ignore-file. o gitignore $HOME/.config/git/ignore. o .git/info/exclude. o .gitignore. o .ignore. o .rgignore. foo .gitignore !foo .rgignore foo .rgignore .gitignore . : o --no-ignore . --no-ignore . o -./--hidden ripgrep . o --binary ripgrep . o -L/--follow ripgrep . -u . : o -u --no-ignore . o -uu --no-ignore --hidden . o -uuu --no-ignore --hidden --binary . rg -uuu grep -r . ripgrep ripgrep . "rc" . : 1. (whitespace) . 2. # ( ) . ripgrep RIPGREP_CONFIG_PATH . ripgrep ripgrep . rg -e/--regexp . ripgreprc : --smart-case : RIPGREP_CONFIG_PATH=wherever/.ripgreprc rg foo : rg --smart-case foo : --type-add web:*.{html,css,js}* : rg --type-add 'web:*.{html,css,js}*' foo glob . : --glob=!.git : --glob !.git : rg --glob '!.git' foo . : -j 4 . : -j 4 : -j4 ripgrep --no-config . . . --smart-case : RIPGREP_CONFIG_PATH=wherever/.ripgreprc rg foo --case-sensitive : rg --smart-case foo --case-sensitive --case-sensitive --smart-case . (SHELL COMPLETION) Bash Fish Zsh PowerShell (tarball) . bash rg.bash $XDG_CONFIG_HOME/bash_completion /etc/bash_completion.d/ . fish rg.fish $HOME/.config/fish/completions . zsh _rg $fpath . ripgrep (truncated) . --no-mmap . ripgrep . ripgrep ( ) . -j1 . ripgrep . ripgrep . -a/--text . ( -a/--text ripgrep NUL .) ripgrep (resident memory) . ripgrep heap . (VERSION) 15.2.0 (HOMEPAGE) https://github.com/BurntSushi/ripgrep (issue tracker) . . rg . rg --debug . <<>> << >> (Discussions) : https://github.com/BurntSushi/ripgrep/discussions (AUTHORS) Andrew Gallant 15.2.0 2026-07-15 RG(1)