ag command not found

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

Introduction

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

ag: command not found

or when using sudo you get the following error message

sudo: ag: command not found

Solutions to ag: command not found

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

In Ubuntu ag is provided by silversearcher-ag package.

silversearcher-ag is:

The Silver Searcher is grep-like program implemented by C. An attempt to make something better than ack-grep.

It searches pattern about 3–5x faster than ack-grep. It ignores file patterns from your .gitignore and .hgignore.

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

sudo apt-get -y install silversearcher-ag

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

You can also use apt command to install silversearcher-ag.

sudo apt -y install silversearcher-ag

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

sudo aptitude install silversearcher-ag

Summary

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