Because with vi there is a potential for data loss or
overwriting, you may wish to have a “safe” way to view files.
Viewing files with less
does just that.
The command syntax is
$ less filename
To quit less
mode, you can use q
, Q
, :q
, :Q
, or ZZ
.
You can also invoke a search for patterns with /
, typing the pattern, and
hitting enter.
If you accidentally type a slash, you can just backspace until it is gone.
Page navigation can be done through the arrow keys, in addition to page up
using b
(for back) and page down with the space bar.
Like with vi, typing Shift+G
will bring you to the end
of the file.
The man page provides a lot more information on
less
mode.