less is a pager that you need to know and love because it enables you to view output. You’ll use less a lot. Get good and you’ll be able to find what you need in seconds. Use less to read and search files. Pipe the output of commands to less.
Fast
less filename≈ open ‘filename’ with less
command | less≈ pipe the output of ‘command’ to less
Moving around
Use the cursor keys to move around: up down left right.
Go to the beginning of the file: g
Go to the end of the file: G
:1≈ go to line number ’1′
Quit
q
Detailed
Searching
/term≈ search forwards in the file for ‘term′
?term≈ search forwards in the file for ‘term′
Editing
v≈ send the open file to the default editor e.g. vi
Tricks
When using mysql set the less as your pager with the chop long lines parameter to display legible results:
/P less -S≈ in mysql, set less as the pager with the chop long lines parameter
Danger
Harmless. You are unlikely to do any damage with less.
Related
On some systems less is more.
