only command not found

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

Introduction

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

only: command not found

or when using sudo you get the following error message

sudo: only: command not found

Solutions to only: command not found

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

In Ubuntu only is provided by only package.

only is:

The ‘only’ command-line tool lets you search based on word patterns or line patterns like never before! Not only can you search with ‘only -l patt’ but you can select the n-th match with ‘-l n/patt/’ and the next 3 lines with ‘-l /patt/0:3’.

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

sudo apt-get -y install only

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

You can also use apt command to install only.

sudo apt -y install only

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

sudo aptitude install only

Summary

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