ripgrep-all is a search tool that wraps ripgrep (a powerful grep alternative) and enables it to search in pdf, odt, docx, movie subtitles, images, etc.

Table of Contents

Installation

Debian-based

In Debian-based systems, you need to download the appropriate ‘rga’ binary from https://github.com/phiresky/ripgrep-all/releases, and install the required and optional dependencies:

wget https://github.com/phiresky/ripgrep-all/releases/download/v0.9.6/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
  • Do not copy & paste these commands, download and extract the latest ‘rga’ binary available.
apt install ripgrep pandoc poppler-utils ffmpeg

Now, copy rga and rga-preproc to one of your PATH folders (run echo $PATH to see them):

cp ripgrep_all-v0.9.6-x86_64-unknown-linux-musl/rga* /usr/local/bin/

Other systems

In Arch Linux, ‘ripgrep-all’ is available on the official repositories. Use pacman to install it:

pacman -S ripgrep-all

You can also install it with Homebrew:

brew install rga
  • Installing the optional dependencies is recommended: brew install pandoc poppler tesseract ffmpeg.

Adapters

ripgrep-all needs ‘adapters’ to be able to search on some files. To search on PDF files, ‘poppler’ needs to be installed. To search on video subtitles, ‘ffmpeg’ is required. To search on ODT or DOCX files, ‘pandoc’ is required. After installing ripgrep-all, run rga --rga-list-adapters to see all known adapters.

Usage

ripgrep-all (rga) syntax is similar to grep:

rga [<options>] <pattern> <path>

It searches recursively by default in a case-sensitive way.

$ rga hola .
./diff/duplicates/test1.txt
hola

./diff/duplicates/test3.txt
hola
$ rga ipsum .
./pdf/test pdf space.pdf
Page 1: Lorem ipsum dolor sit amet, consecte­
Page 1: Fusce vulputate lacus at ipsum. Quis­
$ rga ACTA .
./acta-78.odt
ACTA N.º 78

Options

Because ‘ripgrep-all’ is a wrapper of ‘ripgrep’, you can add parameters of both commands (first add ‘rga’ options, then the ripgrep ‘rg’ ones). Run rg --help and rga --help for more info on available options. These are some of the available parameters:

  • -t <type, --type <type> (from ‘rg’): only search files matching <type>. Run rg --type-list for a list of all available file types.
    rga -t txt hello .
    
  • --rga-accurate (from ‘rga’): use a more accurate (but slower) matching based on mime-type, instead of file extension.
  • --rga-adapters=+pdfpages,tesseract (from ‘rga’): this enables tesseract and pdfpages adapters to search on images or non-searchable PDFs. ‘tesseract’ needs to be installed.
  • -v,--invert-match (from ‘rg’): invert matching, show lines that do not match.
  • -i, --ignore-case (from ‘rg’): search case insensitively.
  • --max-depth <number> (from ‘rg’): limit the depth of the recursive search to <number> levels.
    # This searches only on the given path
    rga --max-depth 0 hello .
    
  • -C <number>, --context <number>: show <number> lines before and after each match.

If you have any suggestion, feel free to contact me via social media or email.