rg command not found

In this troubleshooting guide we learn how to fix rg command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

rg: command not found

or when using sudo you get the following error message

sudo: rg: command not found

Solutions to rg: command not found

How To Fix rg: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu rg is provided by ripgrep package.

ripgrep is:

ripgrep is a line-oriented search tool that recursively searches your current directory for a regex pattern while respecting your gitignore rules and automatically skip hidden files/directories (smart filtering) and binary files. ripgrep is similar to other popular search tools like The Silver Searcher, ack and grep.

ripgrep is generally faster than both The Silver Searcher and GNU grep. It defaults to recursive directory search and won’t search files ignored by your .gitignore files. Use ripgrep if you like speed, filtering by default, fewer bugs, and Unicode support.

On the other hand, if you like multiline search, then ripgrep may not quite meet your needs (yet), and it will never support fancy regex features such as backreferences or lookaround

To fix this problem, we can install more using the command below.

sudo apt-get -y install ripgrep

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install ripgrep.

sudo apt -y install ripgrep

Or if you have aptitude installed you can use the following command.

sudo aptitude install ripgrep

Summary

In this tutorial we learn how to fix rg command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.