opposite of more
References
man less
less +F file # Like `tail -f`
# or
less file # `less` then press `⇧ + F` = `tail -f`
less -N file # with line number
# or
less file # 1.`less` 2.press `-` 3.press `N`
# e.g. use less to view text
grep pattern file | less
more : file perusal filter for crt viewing
- A filter for paging through text one screenful at a time
- Users should realize that
less
providesmore
emulation plus extensive enhancements. - Recommend to use
less
.
- Less is a program similar to more, but which allows backward movement in the file as well as forward movement.
- Also, less does not have to read the entire input file before starting, so with large input files it starts up faster than text editors like vi.
Most options may be changed :
- either on the command line,
- or from within less by using the - or -- command
It will take effect after repainting
Default : -m, --long-prompt
with percent into the file
-m, --long-prompt
Causes less to prompt verbosely (like more), with the percent into the file.- By default, less prompts with a colon.
-M, --LONG-PROMPT
Causes less to prompt even more verbosely than more.
Default : -n, --line-numbers
without line numbers
-n, --line-numbers
Suppresses line numbers.- The default (to use line numbers) may cause less to run more slowly in some cases, especially with a very large input file.
- Suppressing line numbers with the -n option will avoid this problem.
- Using line numbers means: the line number will be displayed in the verbose prompt and in the = command, and the v command will pass the current line number to the editor (see also the discussion of LESSEDIT in PROMPTS below).
-N, --LINE-NUMBERS
Causes a line number to be displayed at the beginning of each line in the display.
Default : -i, --ignore-case
case sensitive
-i, --ignore-case
Causes searches to ignore case; that is, uppercase and lowercase are considered identical.- This option is ignored if any uppercase letters appear in the search pattern; in other words, if a pattern contains uppercase letters, then that search does not ignore case.
-I, --IGNORE-CASE
Like -i, but searches ignore case even if the pattern contains uppercase letters.
Case sensitive
less <file_path>
With percent into the file
less -M <file_path>
With line numbers & percent into the file
less -MN <file_path>
Interactive Commands
j, ^N, …
Forward one linek, ^P, …
Backward one linef, ^F, w, …
Forward one windowb, ^B, z, …
Backward one windowd, ^D
Forward one half-windowu, ^U
Backward one half-window
F
Forward forever; liketail -f
!
# Active @ CLI
less +F <file>
# Press interrupt ( Ctrl + C ) to abort
/pattern
Search forward for (N-th) matching line?pattern
Search backward for (N-th) matching linen
Repeat previous search (for N-th occurrence)N
Repeat previous search in reverse direction
g, <, …
Go to first lineG, >, …
Go to last linem<letter>
Mark the current position with <letter>'<letter>
Go to a previously marked position''
Go to the previous position