less command not found Ubuntu

less command not found Ubuntu 20.04 server

 

I got the error ‘less command not found’ on my Ubuntu 20.04 server while trying to view the content of a file.
 

# less /etc/passwd
bash: less: command not found

# less /etc/passwd
bash: /usr/bin/less: No such file or directory

 

less command not found

less command not found


 
Less command is used on Linux servers to view the content of a large file or a command output. Using less command, you can view the file or output one page at a time.

On Ubuntu servers, less command can be installed by installing less package.

Less package might not be installed on your server. Do the below steps to install less package on Ubuntu server.

1. Log into your Ubuntu 20.04 server via SSH as ‘root’ user or as sudo user

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

root@ubuntu:/# apt update

 
3. Run the command ‘apt install less’ to install the less package.
 

root@ubuntu:/# 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 4 not upgraded.
Need to get 126 kB of archives.
After this operation, 315 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 less amd64 551-1 [126 kB]
Fetched 126 kB in 1s (113 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package less.
(Reading database ... 4122 files and directories currently installed.)
Preparing to unpack .../archives/less_551-1_amd64.deb ...
Unpacking less (551-1) ...
Setting up less (551-1) ...


 
4. Verify the installation by checking less package version using ‘less --version’ command
 

Less command version

Less command version


 

 

How to download and install less deb file on Ubuntu 20.04 server

 
1. Log into your Ubuntu server via SSH as ‘root’ user or as sudo user

2. Download amd64 Less package from Ubuntu website using wget command
 

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

 
3. Install less_551-1_amd64.deb package using dpkg command
 

# dpkg -i less_551-1_amd64.deb
Selecting previously unselected package less.
(Reading database … 4464 files and directories currently installed.)
Preparing to unpack less_551-1_amd64.deb …
Unpacking less (551-1) …
Setting up less (551-1) …