• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

less: command not found

by admin

Both the less and more commands are similar in that they enable you to display the contents of a file and page through those contents if they extend beyond the screen. The less command typically has additional features that more doesn’t, but newer versions of more have added some of those features. While you’re free to use either command, the less command is generally preferred.

Syntax

The syntax of the less command is:

$ less [options] {file names}

less Command Options

The following table lists some of the options for the less command.

Option Description
-e Exit the program the second time it reaches the end of the file.
-E Exit the program the first time it reaches the end of the file.
-I Ignore case in searches.
-n Suppress line numbers.

If you encounter the below error while running the less command:

less: command not found

you may try installing the below package as per your choice of distribution:

Distribution Command
OS X brew install less
Debian apt-get install less
Ubuntu apt-get install less
Alpine apk add less
Arch Linux pacman -S less
Kali Linux apt-get install less
CentOS yum install less
Fedora dnf install less
Raspbian apt-get install less

less Command Examples

1. Open a file:

$ less source_file

2. Page down/up:

[Space] (down), b (up)

3. Go to end/start of file:

G (end), g (start)

4. Forward search for a string (press `n`/`N` to go to next/previous match):

/something

5. Backward search for a string (press `n`/`N` to go to next/previous match):

?something

6. Follow the output of the currently opened file:

F

7. Open the current file in an editor:

v

8. Exit from the less command:

q

Navigation in less command

Navigation in less uses many of the same commands you’ve seen before, like the arrow keys to scroll line-by-line and Page Up and Page Down to scroll by page. You can also use / to search a file for a particular text string, and press n and N to move to the next or previous instance of the searched string, respectively. Press q to quit the program.

Filed Under: Linux

Some more articles you might also be interested in …

  1. CentOS / RHEL 6 : How to Change the Volume Group Name for Root Disk Device
  2. cargo: Manage Rust projects and their module dependencies (crates)
  3. amass track – Track differences between enumerations of the same domain (Command Examples)
  4. treetime Command Examples in Linux
  5. dir Command Examples in Linux
  6. a2dismod Command Examples in Linux
  7. astyle: Source code indenter, formatter, and beautifier for the C, C++, C# and Java programming languages
  8. jwt Command Examples
  9. parted Command Examples in Linux
  10. direnv: Shell extension to load and unload environment variables depending on the current directory

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright