4.2.10. less
— view and navigate file contents#
With the less
command, you have more control
when viewing a file. It allows you to scroll up and down
the file and provides features like searching the file
using keywords.
To view the contents of a file, use
less
, followed by the name of the file:
less /usr/share/dict/words
When the file is open, it will appear as in Fig. 78.

Fig. 78 The words
file open in less
command#
At the :
prompt, you can type commands that less will
understand.
Navigating the file#
You can scroll down the file by pressing the ENTER key.
Alternatively, you can use the PgUp and PgDn keys to scroll one page at a time.
Searching the file#
You can search a file while viewing it in less
.
To do this:
Type
/
(forward slash) keyType the text you would like to search
Press the ENTER key
If there are matching results, they will be highlighted
Quitting the less
command#
To quit the less command, type q
at the prompt.