Name
less — stdin stdout[8] - file -- opt --help --version
Synopsis
less [options] [files]
Use less to view text one
“page” at a time (i.e., one window or screenful at a time). It’s
great for text files, or as the final command in a shell pipeline
with lengthy output.
$ command1 | command2 | command3 | command4 | less
While running less, type
h for a help message describing
all its features. Here are some useful keystrokes for paging through
files.
|
Keystroke |
Meaning |
|---|---|
|
|
View a help page. |
|
Space bar,
|
Move forward one screenful. |
|
Enter |
Move forward one line. |
|
|
Move backward one screenful. |
|
|
Enter search mode.
Follow it with a regular expression and press Enter, and
|
|
|
Same as /, but it searches backward in the file. |
|
|
Repeat your most recent search forward. |
|
N |
Repeat your most recent search backward. |
|
v |
Edit the current file
with your default text editor (the value of environment
variable |
|
< |
Jump to beginning of file. |
|
> |
Jump to end of file. |
|
:n |
Jump to next file. |
|
:p |
Jump to previous file. |
less has a mind-boggling
number of features; we’re presenting only the most common. (For
instance, less will display the
contents of a compressed Zip file: try less
myfile.zip.) The manpage is recommended reading.
Useful options
|
|
Clear the screen before displaying the next page. This avoids scrolling and may be more comfortable on the eyes. ... |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access