Skip to content

:magnify: ripgrep

ripgrep is a line-oriented search tool that recursively searches your current directory for a regex pattern.

🛠 Installation

You can download pre-compiled binaries from the GitHub releases page.

sudo apt install ripgrep
sudo apt install ripgrep
brew install ripgrep

⚙ Config

Ripgrep can be configured with a configuration file. By default, ripgrep will look for a configuration file in $XDG_CONFIG_HOME/ripgrep/config or $HOME/.ripgreprc.

$HOME/.ripgreprc

--type-not=markdown
--smart-case

📝 Usage

1. Find a pattern in a file

rg "pattern" file.txt

2. Recursively search for a pattern

rg "pattern"

3. Find files that contain a pattern

rg -l "pattern"

4. Search for a pattern in a specific file type

rg "pattern" -g "*.js"

🔗 References