Install ripgrep on Raspberry Pi

Install ripgrep on Raspberry Pi

The ripgrep is a command line tool that allows to search for a strings in files by regex pattern. By default, ripgrep ignores files and directories that specified in .gitignore file. This tool also skips hidden and binary files by default.

This tutorial explains how to install ripgrep on Raspberry Pi.

Use SSH to connect to Raspberry Pi. Update the package lists and install ripgrep with commands:

sudo apt update
sudo apt install -y ripgrep

Once completed, we can check ripgrep version:

rg --version

Create a few files for testing:

echo "Sample file x1, x2, ..., x10" > test1.txt
echo "6x2 + 2x + 1" > test2.txt

Now run the rg command followed by regex pattern to recursively search for a strings in files that are located in current directory.

rg x[0-9]+
Search strings with ripgrep in current directory on Raspberry Pi

We can also specify a path to a file or directory as second argument.

sudo rg localhost /etc
Search strings with ripgrep on Raspberry Pi

If ripgrep is no longer needed, you can remove it with command:

sudo apt purge --autoremove -y ripgrep

Leave a Comment

Cancel reply

Your email address will not be published.