less command not found on Ubuntu 21.04 Server

less command not found on Ubuntu 21.04 server

 

root@ubuntu-21.04:/# less file.txt
bash: less: command not found

Error shows less command not found on your Ubuntu server. less command is provided by less package and this package might not be installed on your server. Run the command ‘dpkg -l | grep less’ to check whether less package is installed.

Follow the below steps to install less

1. Log into your Ubuntu 21.04 server via SSH

2. Run ‘apt update’ to update the package information

3. Install less package using apt command

4. Enter ‘Y’ if apt ask for confirmation while installing less

5. To verify the installation, run less –help command
 

root@ubuntu-21:/# apt update

root@ubuntu-21:/# apt install less
apt install less
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following NEW packages will be installed:
less
0 upgraded, 1 newly installed, 0 to remove and 84 not upgraded.
Need to get 123 kB of archives.
After this operation, 307 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu hirsute/main amd64 less amd64 551-2 [123 kB]
Fetched 123 kB in 2s (80.4 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package less.
(Reading database … 5775 files and directories currently installed.)
Preparing to unpack …/archives/less_551-2_amd64.deb …
Unpacking less (551-2) …
Setting up less (551-2) …

 

How to install Less command on Ubuntu 21.04 Server

How to install Less command on Ubuntu 21.04 Server


 

How to download and install less deb package

1. Log into Ubuntu 21.04 server via SSH

2. Download less package from Ubuntu website using wget command

3. Install less package using dpkg or apt command
 

cd /usr/local/src/

http://archive.ubuntu.com/ubuntu/pool/main/l/less/less_551-2_amd64.deb

apt install ./less_551-2_amd64.deb

 
Run the command ‘less –help’ to see the command usage and version.

less –help

Run the command less -v to see the version.

# less –version
less 551 (GNU regular expressions)