Paging Through Output with less
less command enables you to view large amounts of text in a more convenient way than the
cat command. For example, your
/etc/passwd file is probably more than a screen long, so if you run
cat /etc/passwd, you are not able to see what the lines at the top were. Using
less /etc/passwd enables you to use the cursor keys to scroll up and down the output freely. Type
q to quit and return to the shell.
On the surface,
less sounds like an easy command; however, it has the infamy of being one of the few Linux commands that have a parameter for every letter of the alphabet. That is,
-a does something,
-b does something else,
-e ... -x,
-z; they all do things, with some letters even differentiating between ...