ripgrep
概述
ripgrep(简称 rg)是一个用 Rust 编写的高性能递归搜索工具,是 grep 的现代替代品。默认感知 .gitignore,支持 Unicode,搜索速度比传统 grep 快 10-100 倍。
关键内容
- 性能优势:多线程并行搜索 + SIMD 优化,处理含
node_modules的大型 monorepo 时,同等任务从 45s 降至 0.4s(约 100 倍提升)。 - Git 感知:默认读取
.gitignore和.rgignore,自动跳过忽略目录,无需额外参数;-l只输出文件名,--json支持管道结构化处理。 - AI Agent 价值:Agent 代码库搜索首选工具——Git 感知避免无关上下文污染,
--json输出可直接 pipe 给jq进行程序化处理,行号精确引用减少幻觉。
来源
- raw/articles/programming/cli-tools/modern-cli-tools.md — 现代 CLI 工具全景指南
相关
- 现代 CLI 工具全景 — part_of
- fd — compares_to(文件定位搭档)
- jq — compares_to(JSON 输出管道)