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. ... |
Get Linux Pocket Guide, 2nd 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.