--- title: ripgrep โ€” fast grep date: 2026-10-18 time: 12:00 model: admin category: programs author_type: human summary: An ultra-fast text search that replaces grep. By default, it respects .gitignore. tags: program, Modern CLI Tools, ripgrep --- **๐Ÿ’ฌ "ripgrep command"** ripgrep (rg) is **an ultra-fast text search tool that replaces grep**. It operates with multithreading, searching instantly even in large codebases. By default, it respects .gitignore, so it automatically skips directories like node_modules. - **Concept**: Searches text patterns in files at ultra-high speed. - **grep replacement**: Performs the same pattern search much faster. - **.gitignore respect**: Automatically excludes ignored targets. - **Multithreading**: Utilizes CPU cores to increase search speed. ## Installation and Download Install ripgrep using a package manager or cargo. | Environment | Command | | --- | --- | | Ubuntu / Debian | sudo apt install ripgrep | | Fedora / RHEL | sudo dnf install ripgrep | | Arch | sudo pacman -S ripgrep | | macOS (brew) | brew install ripgrep | | Rust cargo | cargo install ripgrep | | Binary download | github.com/BurntSushi/ripgrep/releases | Verify the installation with `rg --version`. It uses a command structure very similar to grep. ## Commonly Used Options | Option | Description | | --- | --- | | -i | Ignores case | | -n | Displays line numbers | | -w | Matches only whole words | | -t ext | Searches only files with specific extensions | | --type-add | Adds custom file types | ## 3 Essential Command Combinations - `rg -n "TODO" src/` โ€” Find TODO locations in source - `rg -i error /var/log/nginx` โ€” Search for error keywords in logs (ignoring case) - `rg -t py "import os"` โ€” Search for import os in Python files **๐Ÿ’ฌ "Show me an example of finding errors in logs on a real server"** I've organized the common situations on a production server in order. ### Step 1 ยท Verify Installation Check if installed. ``` rg --version || sudo apt install -y ripgrep ``` ### Step 2 ยท Search for keywords in code Find specific function calls in source code. ``` rg -n "handle_request" /var/www/html/src ``` ### Step 3 ยท Search for errors in logs Find error patterns in log files. ``` rg -i "error|fail" /var/log/nginx/error.log ``` ## Live Execution Example This is the result of searching for function call locations in source code using ripgrep. It quickly outputs with line numbers. ![ripgrep command execution result](https://games.aidebatehub.com/assets/ripgrep-demo.png) Production server ## In practice, here's how it's used ### 1. Finding specific values in configuration **Situation** โ€” Find the timeout value in nginx configuration. ``` rg -n "timeout" /etc/nginx/ ``` **Result** โ€” Lines related to timeout are displayed with line numbers. **Tip** โ€” With the -n option, you can jump directly to the line. ### 2. Checking dependencies **Situation** โ€” See where a specific library is used in the project. ``` rg -t py "import requests" ``` **Result** โ€” A list of files containing import requests is displayed. **Tip** โ€” Filter file types with the -t option. ## Live Execution Example This is the result of searching for error patterns in log files. ![ripgrep command execution result 2](https://games.aidebatehub.com/assets/ripgrep-demo2.png) Production server ## Important Notes - ripgrep by default excludes hidden files and .gitignore targets. To include them, use --hidden --no-ignore. - It skips binary files by default. - Instead of grep's -r option, it searches recursively by default. - In large single files, it uses mmap, so memory usage may increase. --- Source (HTML): https://games.aidebatehub.com/programs/linux/modern/ripgrep.html This file is an auto-generated Markdown twin of the DevHub document.