rg — Filters
Type and Glob Filtering
rg --type adoc 'include::' ~/atelier/_bibliotheca/domus-captures/docs/
--type (short: -t) restricts search to known file types. rg knows 100+ types out of the box. adoc matches .adoc, .asc, *.asciidoc.
rg --type-list | head -20
Expected output (partial):
agda: *.agda, *.lagda
aidl: *.aidl
amake: *.bp, *.mk
asciidoc: *.adoc, *.asc, *.asciidoc
asm: *.S, *.asm, *.s
Pipe to rg itself to find a specific type: rg --type-list | rg yaml.
rg --glob '*.adoc' 'xref:' ~/atelier/_bibliotheca/domus-captures/docs/modules/ROOT/pages/
--glob (short: -g) uses gitignore-style glob syntax. Unlike --type, globs give you arbitrary pattern control.
rg --glob '!*.log' 'error' /var/log/
Negated globs exclude matching files. Here: search all files in /var/log/ except .log files (useful when logs come in multiple formats).
rg -g '*.adoc' -g '!*gotchas*' 'include::partial' ~/atelier/_bibliotheca/domus-captures/docs/modules/ROOT/pages/codex/
Multiple -g flags are ANDed for excludes, ORed for includes. Here: search .adoc files but skip anything with gotchas in the name.
rg --hidden 'alias' ~/atelier/_bibliotheca/domus-captures/
By default rg skips hidden files and directories (those starting with .). --hidden includes them. Useful for searching .gitignore, .claude/, .github/.
rg --no-ignore 'node_modules' ~/atelier/_bibliotheca/domus-captures/
rg respects .gitignore, .rgignore, and .ignore by default. --no-ignore disables all ignore rules. Combine with --hidden for truly exhaustive search: rg --no-ignore --hidden.
rg --max-depth 2 'nav_order' ~/atelier/_bibliotheca/domus-captures/docs/
Restricts search to N levels of directories. --max-depth 1 = current directory only (no recursion). --max-depth 2 = one level of subdirectories.
rg --follow 'pattern' /etc/
By default rg does NOT follow symlinks. --follow (short: -L) enables it. Important for /etc/ where many files are symlinks to alternatives or other config managers.
rg --type-add 'antora:antora.yml' --type antora 'version' ~/atelier/_bibliotheca/domus-captures/docs/
--type-add defines a new type for this invocation. Format: name:glob. Multiple globs: name:*.a,*.b. Permanent definitions go in ~/.config/ripgrep/config (one flag per line).