Search This Blog

Sunday, October 21, 2018

less command

less is the linux utility which can be used to read contents of text page by page.

[Syntax]
less [OPTIONS] [FILENAME]

[Options]
-N : Show number of lines.

[Navigation]
gg - Top
G - Bottom
f - Forward One Window
b - Backward One Window
q - Exit

[Search]
\ - Forward Search
? - Backward Search
n - Next Occurrence
N - Previous Occurrence

[Example]
~ less foo.txt
~ ls | less -N
   1. foo.txt
   2. bar.txt