
Ripgrep: How to Search Hidden Files
Updated
Learn how to search hidden files and dotfiles with ripgrep (rg)

Before we start, make sure you have ripgrep installed on your computer. On a Mac, you can install it with Homebrew:
brew install ripgrep
By default, ripgrep skips hidden files and folders, which are anything that starts with a dot, like .vscode or .github. To include them, open your terminal, go to your project folder and run:
rg --hidden "pattern"
The --hidden flag (or its short form -.) tells ripgrep to search dotfiles too. Don't worry if you suddenly see lots of results from .git; those are just Git's internal files. Filter them out with a negative glob:
rg --hidden -g '!.git/' "pattern"
Keep the single quotes around '!.git/' so your shell doesn't treat the ! as a history command.
One thing to watch out for: --hidden still respects your .gitignore, so an ignored file like .env won't show up. To search hidden and ignored files, use -uu:
rg -uu "pattern"
If you always want hidden files, add --hidden and --glob=!.git/ to a ripgrep config file and point the RIPGREP_CONFIG_PATH environment variable at it.
