Linux command
rga 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Search in all files
rga [pattern]
Search in directory
rga [pattern] [directory/]
Search PDFs only
rga --type pdf [pattern]
Search with context
rga -C [3] [pattern]
List supported types
rga --list-adapters
Disable cache
rga --no-cache [pattern]
Case insensitive
rga -i [pattern]
说明
rga (ripgrep-all) extends ripgrep to search inside file formats that plain text search cannot reach, including PDFs, Word documents, Excel spreadsheets, PowerPoint presentations, zip archives, tar files, e-books, and even SQLite databases. It uses format-specific adapters backed by external tools like pdftotext and pandoc to extract searchable text from these files. Extracted text is cached on disk so that subsequent searches over the same files are nearly instantaneous. The tool can descend into compressed archives, searching nested files without manual extraction. All standard ripgrep features are available, including regex patterns, colored output, context lines, and file type filtering, providing a consistent search interface regardless of the underlying file format. When optional dependencies like tesseract are available, rga can perform OCR on image files to make even scanned documents searchable.
参数
- --type _TYPE_
- File type filter.
- -C, --context _N_
- Context lines.
- -i, --ignore-case
- Case insensitive.
- --no-cache
- Disable caching.
- --list-adapters
- Show adapters.
- --rga-cache-max-blob-len _SIZE_
- Max cache size.
- -l, --files-with-matches
- Filenames only.
- -c, --count
- Count matches.
FAQ
What is the rga command used for?
rga (ripgrep-all) extends ripgrep to search inside file formats that plain text search cannot reach, including PDFs, Word documents, Excel spreadsheets, PowerPoint presentations, zip archives, tar files, e-books, and even SQLite databases. It uses format-specific adapters backed by external tools like pdftotext and pandoc to extract searchable text from these files. Extracted text is cached on disk so that subsequent searches over the same files are nearly instantaneous. The tool can descend into compressed archives, searching nested files without manual extraction. All standard ripgrep features are available, including regex patterns, colored output, context lines, and file type filtering, providing a consistent search interface regardless of the underlying file format. When optional dependencies like tesseract are available, rga can perform OCR on image files to make even scanned documents searchable.
How do I run a basic rga example?
Run `rga [pattern]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --type _TYPE_ do in rga?
File type filter.