less command not found. Install less command on Linux

bash: less: command not found. How to Install less command on Centos / Ubuntu Server


I got the error ‘bash: less: command not found’ on my Linux Server when I was trying to view the content of a text file. You must Install less command to fix this error.

Using less command you can see the content of the files without opening it. Less command also allows you to move backwads and forwards in the file.

If you are trying to view the content of a huge file, then using less command will help to see one page at a time.

Example :

# less /var/log/httpd/logs/error_log

In the above example, I am trying to view the content of apache error log file that is more than 10Mb.

Do the below steps to install less package on CentOS / Redhat servers

1. Log into your CentOS / RHEL server as ‘root’ user

2. Run the command ‘yum install less’ to install less package

3. After installing less, type the command ‘less --help’ to see usage

If you are having Ubuntu Or debian server, then follow the below steps to install less command

1. You must log into Ubuntu / Debian server as ‘root’ user or as any user with sudo privileges

2. Execute the command ‘apt-get install less’ in the terminal

3. Type the command ‘less --help’ for help