Paging Through Output with less
The 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, -c
, -d
, -e
... -x
, -y
, -z
; they all do things, with some letters even differentiating between ...
Get Ubuntu Unleashed 2013 Edition: Covering 12.10 and 13.04, Eighth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.