ISSUE 114  ·  2 DECEMBER 2026 ELEN RSS
CodeCity
KNOWLEDGE & MEMORY № 0114

ripgrep: fast search inside your files, from the command line

Ripgrep is a fast command-line text search tool that runs in your shell and returns matching lines from files and subfolders, each prefixed by file path and line number — useful when refactoring, hunting TODOs, or when you need machine-readable output for automation.

ripgrep: γρήγορη αναζήτηση μέσα στα αρχεία, από τη γραμμή εντολών

Two words first

Meaning: the program you invoke from a shell to search a directory tree — no upload or background indexing required. The daily picture: you open a terminal, run a command, and see results immediately in the same environment.

Classic grep is fine for small jobs, but modern codebases have tens of thousands of files, multiple extensions, and ignore rules declared in files like .gitignore. Ripgrep improves latency and developer ergonomics: it is fast, respects ignore files by default, and offers features such as JSON output, type-based filters, and smart case. These are not luxury features; they change the workflow when you work with large repositories.

"Pattern" means the thing you search for — a word, a phrase, or a regular expression. Everyday example: you renamed a function from calculateTotal to computeTotal; use pattern "\bcomputeTotal\b" to match whole-word occurrences and avoid partial matches like computeTotals. The pattern is your search description; regex lets you express precise patterns concisely.

What it does

Put simply: it does what grep does but faster and with practical options. Below are distinct use cases, each with a short scenario and an example command.

Search across directory trees — scenario: you renamed a function and need to find all references. Run ripgrep from the repository root and get all matching lines with file paths and line numbers. Example:

rg "\bcomputeTotal\b" .

Type-based file filtering — scenario: you only want Python declarations. Use -t to limit by file type the tool understands, or –type-add to define a custom type. Example:

rg -tpy "def " .

Regex search — scenario: find functions starting with get followed by an uppercase letter. Ripgrep supports full regular expressions and executes them quickly across large trees. Example:

rg "\bget[A-Z]\w*\b" .

Machine-readable output for scripts — scenario: produce a list of TODOs for a sprint. Use –json and redirect to a file:

rg --json "TODO" > out.json

The JSON stream contains entries for each match with path, line number, and match text suitable for downstream processing.

File names only — scenario: you want a list of files that contain a pattern to feed into another tool. Use -l to print matching file paths only:

rg -l "TODO" .

Counts per file — scenario: you need to know how many times a string appears in each file. Use -c for a per-file match count:

rg -c "fixme" .

Whole-word matches — scenario: avoid partial word matches inside larger identifiers. Use -w to match whole words:

rg -w "total" .

Lines of context — scenario: inspect surrounding lines to understand usage without opening the file. -A and -B provide lines after and before the match, respectively:

rg -n -A 2 -B 2 "initialize" .

Include hidden files — scenario: search hidden files that are omitted by default. –hidden includes dotfiles and hidden directories:

rg --hidden ".env" .

Ignore .gitignore rules — scenario: search even inside files that the repository ignores (autogenerated code, build artifacts). -uu or -uuu bypass ignore rules and search everywhere:

rg -uuu "generated_function" .

Pipelines — scenario: count lines across all source files. rg –files emits file names which can be piped into xargs or other tools:

rg --files | xargs -d '\n' wc -l

And –replace — scenario: preview how a replacement will look without modifying files. –replace prints matches with the replacement applied to stdout, but it does not perform in-place editing. To change files you must use an editor or a tool that writes changes intentionally (e.g., a script that applies edits after review).

What it does not do

It is not an editor. Practically, ripgrep points you to matches; it will not make edits on disk. –replace gives a preview but is not a substitute for careful edits and code review.

It is not a GUI. Ripgrep is a command-line engine; if you need graphical interfaces, use front-ends that wrap rg. In those setups the front-end handles presentation while rg remains the search engine.

It does not build an index. Each invocation performs live filesystem scanning; there is no persistent index. This design favors low per-invocation latency and small footprint but does not provide instant answers from a prebuilt cache.

It is not a disk-wide indexer. For instant full-disk search with ranking and heavy query features you need an indexing service (Elastic, Whoosh, or similar); ripgrep is live scanning and not a replacement for those systems.

And importantly: it is not an MCP server. Ripgrep runs locally in the shell, it does not expose an API that LLMs can call as a declared tool.

How it is set up

A concise Windows workflow follows; expected outputs are included. On Unix-like systems install with your package manager (apt, brew) and the steps are analogous.

  1. Install with Winget (recommended on Windows):

winget install --id BurntSushi.ripgrep.MSVC -e

Expected output: winget downloads the package and prints progress; at the end it reports successful installation. If you see permission errors, rerun as administrator.

  1. Verify the binary is in PATH:

rg --version

Expected output: a line like "ripgrep 16.0.0" and build metadata. If the command is not found the shell prints a command-not-found error.

What to do if rg is not in PATH: add the folder that contains rg to your PATH environment variable, or move the binary into an existing PATH directory. On Windows edit the System Environment Variables → PATH or place the executable in a location already on PATH.

  1. First run in a folder:

rg CodeCityTest .

Expected output: matches printed as :<line_number>:. If nothing matches the process exits with code 1; when matches exist it exits 0. This behavior makes rg script-friendly for CI and automation.

Alternative: download official zip from Releases

Download ripgrep-16.0.0-x86_64-pc-windows-msvc.zip, unpack it and put the executable on PATH.

Expected output: a zip around 1.78 MB and an unpacked binary about 4.07 MB (sizes vary by release). The releases page includes changelog and artifacts.

Extra configuration

Add aliases in your shell profile to include frequently used flags (for example alias rgp='rg -n –hidden -S') or create wrapper scripts that supply project defaults.

Using it with each assistant

Note: here "assistant" refers to client environments that provide a terminal (Claude Code, Codex CLI, Cursor). Ripgrep is still a CLI; running it inside an IDE does not change its semantics.

Claude Code — scenario: you work inside the Claude Code environment and need a quick multi-file search. Open the integrated terminal, check rg –version, and then run the commands you need. For batch processing, use –json and parse results inside the environment.

Codex CLI — scenario: CI checks and automation scripts. Codex CLI can run shell scripts where rg produces output that CI asserts against. Use rg -c to fail builds if forbidden patterns increase, or rg -l to enumerate problematic files.

Cursor — scenario: you edit code and want inline context. Cursor’s terminal can display results inline; use -n and -A/-B to include useful context lines without opening the file in an editor.

In every environment make sure rg is available in the PATH the environment uses; otherwise use a local copy of the binary in the workspace and reference it explicitly.

Our own measurement

We created a small test folder with three files: a .txt containing the token "CodeCityTest", a .py where the token appeared inside a function, and a .md with Greek text. Running rg CodeCityTest returned the matches with file paths and line numbers. rg -tpy CodeCityTest limited the search to Python files and returned only the .py. Using rg –json produced structured JSON output.

What we did not measure: our test used a tiny folder. We did not measure performance on large repository trees, behaviour against very complex .gitignore rules, or the impact of exotic file encodings. These factors can significantly affect timings and should be tested with the real project data.

What it costs

In tokens: zero. ripgrep is not a server you declare somewhere so a model can use it — it is a single program that runs in the shell. It carries no tool descriptions into your conversation, because it is never declared anywhere; and the difference is not cosmetic, since a server doing similar work loads its schema on every call.

In space: 4.07 MB, one file. In our measurement, the Windows download is 1.7 MB (1,782,487 bytes) and the unpacked executable 4.07 MB (4,074,496 bytes). It is a single program, written in Rust, with no libraries beside it — it shares nothing with the system, it carries everything inside it.

In money: zero. The repository's licence field states The Unlicense, the code is open, with no account, no subscription, no key. And there is no hidden cost of use: the search runs on your own machine, over your own files — it sends nothing anywhere else.

In memory: we did not measure usage over a large file tree, because our test was small. We do not give a number, because it is not a measurement; it is what anyone will measure by running it against their own data.

Sources

the ripgrep repository — code and metadata

the usage guide

release 16.0.0

Εγκατάσταση

1 ΒΗΜΑ
  1. winget install --id BurntSushi.ripgrep.MSVC -e
ripgrep: fast search inside your files, from the command line · ΑΠΟΤΕΛΕΣΜΑ
ΠΗΓΗ
github.com/BurntSushi/ripgrep