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 more command is:
$ more [options] {file names}
If you encounter the below error while running the more command:
less: command not found
you may try installing the below package as per your choice of distribution:
Distribution | Command |
---|---|
OS X | brew install util-linux |
Debian | apt-get install util-linux |
Ubuntu | apt-get install util-linux |
Alpine | apk add util-linux |
Arch Linux | pacman -S util-linux |
Kali Linux | apt-get install util-linux |
CentOS | yum install util-linux |
Fedora | dnf install util-linux |
Raspbian | apt-get install util-linux |
more Command Examples
1. Open a file:
$ more path/to/file
2. Open a file displaying from a specific line:
$ more +line_number path/to/file
3. Display help:
$ more --help
4. Go to the next page:
[Space]
5. Search for a string (press `n` to go to the next match):
/something
6. Exit from more command:
q
7. Display help about interactive commands:
h
less V/s more
Because more is relatively old, most will argue that less is far superior. The less command is similar to more, but less will allow you to navigate back and forth between paged results. So yes, it’s an old joke, but from now on, and wherever possible, always know that less really does mean more.