Searching through plain-text source code and log files on Linux is lightning-fast using tools like grep or ripgrep (rg). However, standard grep tools fail completely when searching for keywords buried inside compiled or compressed formats such as PDF manuals, Microsoft Word documents (.docx), EPUB e-books, zip archives, or multimedia metadata. ripgrep-all (invoked as rga) is a powerful CLI wrapper that brings ripgrep’s blazingly fast pattern matching to non-plain-text files by leveraging specialised text-extraction adapters.
Supported File Formats in ripgrep-all
Under the hood, rga inspects file headers and invokes lightweight extractors in parallel to search inside binary formats:
- Documents: Scans PDF documents (via
pdftotext), Microsoft Office files (.docx,.xlsx,.pptx), and OpenDocument files (.odt). - E-Books: Searches EPUB, MOBI, and comic book archive formats without requiring manual unzipping.
- Compressed Archives: Traverses inside
.zip,.tar,.tar.gz, and.7zcompressed bundles directly. - Media Subtitles: Extracts and matches embedded subtitle tracks inside Matroska (
.mkv) and MP4 video containers usingffmpeg. - Smart Caching: Maintains an internal SQLite disk cache to store extracted text databases, ensuring subsequent searches across large PDF directories execute instantaneously.
Installing ripgrep-all on Linux Distributions
The rga binary requires both ripgrep and auxiliary document extractors (such as poppler-utils and pandoc):
- Ubuntu and Debian:
# Install prerequisites sudo apt install ripgrep poppler-utils ffmpeg pandoc # Download pre-built rga binary from GitHub curl -LO https://github.com/phiresky/ripgrep-all/releases/latest/download/ripgrep_all-v0.9.6-x86_64-unknown-linux-musl.tar.gz tar -xzf ripgrep_all-v0.9.6-x86_64-unknown-linux-musl.tar.gz sudo mv ripgrep_all-v0.9.6-x86_64-unknown-linux-musl/rga* /usr/local/bin/ - Arch Linux and Manjaro:
sudo pacman -S ripgrep-all - Homebrew on Linux:
brew install ripgrep-all
Practical Search Commands and Syntax Examples
The syntax for rga mirrors standard ripgrep, meaning all your existing regex flags work out of the box:
1. Searching for Text Across All PDFs
To locate a specific contract clause, invoice number, or technical error code across an entire directory of PDF manuals:
rga "termination clause" ~/Documents/Contracts/
rga outputs the matching PDF file path, the specific page number where the text resides, and the surrounding sentence context highlighted in colour.
2. Case-Insensitive Matching Inside Compressed Archives
To search inside zip backups or tarballs regardless of letter casing, pass the -i flag:
rga -i "database_password" /backup/archives/
3. Limiting Search to Specific File Types
If a folder contains mixed assets and you only want to inspect Word documents and PDFs, use the -t type flag or glob pattern:
rga --rga-adapters=pandoc,poppler "quarterly revenue" ./reports/
This restricts parsing to document adapters only, bypassing archive unpacking and video subtitle extractors for increased speed.
4. Viewing Match Line Context
To view three lines of context before and after each match, use the standard -C context flag:
rga -C 3 "firewall policy" network_guide.epub
Managing the rga Text Extraction Cache
Because extracting text from thousands of multi-page PDFs takes CPU time during initial passes, rga caches extracted plaintext in ~/.cache/ripgrep-all/:
- Instant Re-runs: Searching the same folder for a different keyword on subsequent runs takes milliseconds rather than minutes.
- Flushing the Cache: If disk space is tight or files have been restructured, clean out the cache using:
rga-precache --clean - Disable Caching: For one-off scans on shared servers, append
--rga-no-cacheto prevent temporary files from being written to disk.