If rg returns nothing, either the pattern did not match, the file is outside the paths being searched, a filter excluded it, or the command hit an error. Start by searching the known file or directory, then check the pattern and the files ripgrep includes before relaxing filters one at a time.
Start by checking the path and pattern
Search the file you know exists
By default, ripgrep searches recursively from the current working directory. If you ran the command from a different directory than expected, the file may not be in scope. Give rg the path explicitly, or search the file directly:
As an Amazon Associate I earn from qualifying purchases.
rg 'pattern' path/to/file
If the command receives input through a pipe, it searches standard input instead of traversing the directory. Check that the command is pointed at the source you intend to search.
Check whether the pattern is a regular expression
rg treats its search pattern as a regular expression by default. Characters such as ., +, (, and [ have special meanings, so a pattern containing them may not match the literal text you have in mind. Use -F for an exact string:
#1 Best Overall
rg -F 'literal text' path
If only the capitalization may differ, try -i. Use -w only when the match should be a whole word; it can exclude a match that appears as part of a larger word.
Find out whether ripgrep is searching the file
Recursive searches apply automatic filters. Ripgrep normally skips hidden files and directories, paths matched by ignore rules, and binary files; it also does not follow symlinks by default. First list the files in scope:
rg --files
If the target file is missing from that list, focus on its path and filters rather than changing the search text. Ignore rules can come from .gitignore, .ignore, and .rgignore; ripgrep’s repository guide gives .rgignore precedence over .ignore, which takes precedence over .gitignore. Git global and repository-local exclusions may also affect results. A file being tracked by Git does not guarantee it will be searched if an applicable ignore rule excludes it. See the ripgrep guide and official FAQ.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteRelax filters selectively
Use the narrowest option that addresses the likely cause. These modes expand the search in different ways:
| Need | Option | What it changes |
|---|---|---|
| Include hidden files and directories | --hidden or -. |
Includes dotfiles and hidden directories; ignore rules still apply. |
| Search paths matched by ignore rules | --no-ignore or -u |
Disables ignore filtering, but does not by itself include hidden or binary files. |
| Disable ignore and hidden filtering | -uu |
Searches more paths while continuing to skip binary files. |
| Include binary files | -uuu, or -a to treat binary data as text |
Broad scan that can print terminal control characters. |
| Match exact punctuation as typed | -F |
Uses fixed-string matching instead of regex interpretation. |
| Search a non-text document format | --pre with an installed converter |
Runs an external preprocessor; it requires suitable file-specific setup. |
For a quick check of whether hidden or ignored files are the cause, try rg -uu 'pattern' path. Add the third u only when you need to search binary files. The ripgrep guide warns that binary output can contain control characters, so avoid using -uuu as a routine default.
Check globs, file types, and other selection rules
Explicit restrictions can exclude a file even when it is in the directory and not ignored. Review the command for:
Rank #4
-gor--glob, which can include only paths matching a positive glob or exclude paths with a negated glob;-tor--type, which limits the search to a file type;-Tor--type-not, which excludes a file type.
Quote wildcard patterns so the shell does not expand them before ripgrep receives them. For example, use -g '*.toml'.
Distinguish no match from a command error
An empty result does not always mean a clean search found no matching text. The Debian unstable rg(1) manual specifies these exit statuses:
Best Value
0: at least one match;1: no match and no error;2: an error, such as invalid regex syntax or a file-read failure.
Check the exit status and stderr. If the status is 2, resolve the reported error rather than changing filters as though the search completed normally. See the Debian unstable rg(1) manual.
Check configuration, symlinks, and document formats when relevant
Some causes depend on the environment or file type:
RIPGREP_CONFIG_PATHcan load default flags, such as--hidden,--smart-case, or globs, changing the effective command.- Use
--follow(or-L) if the intended search should traverse symlinks. - For a file using a non-default encoding, the guide documents
-Eor--encoding. - Ripgrep does not automatically search text inside formats such as PDF. The guide describes using
--prewith an external converter, such aspdftotext, to preprocess a document.
These checks are useful only when the file, encoding, link, or environment makes them plausible; they are not substitutes for verifying the path, pattern, and active filters.
Recommended Free Tools
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




