Command: 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.
Less uses termcap (or terminfo on some systems), so it can run on a
variety of terminals. There is even limited support for hardcopy
terminals. (On a hardcopy terminal, lines which should be
printed at the top of the screen are prefixed with a caret.)
Commands are based on both MORE and VI. Commands may be preceded
by a decimal number, called N in the descriptions below. The number
is used by some commands, as indicated.
Syntax:
less -?
less -V
less [-[+]aBcCdeEfgGiImMnNqQrsSuUVwX]
[-b bufs] [-h lines] [-j line] [-k keyfile]
[-{oO} logfile] [-p pattern] [-P prompt] [-t tag]
[-T tagsfile] [-x tab] [-y lines] [-[z] lines]
[+[+]cmd] [filename]...
Options:
SUMMARY OF COMMANDS
Commands marked with * may be preceded by a number, N.
Notes in parentheses indicate the behavior if N is given.
h H Display this help.
q :q :Q ZZ Exit.
e ^E j ^N CR * Forward one line (or N lines).
y ^Y k ^K ^P * Backward one line (or N lines).
f ^F ^V SPACE * Forward one window (or N lines).
b ^B ESC-v * Backward one window (or N lines).
z * Forward one window (and set window to N).
w * Backward one window (and set window to N).
d ^D * Forward one half-window (and set half-window
to N).
u ^U * Backward one half-window (and set half-window
to N).
F Forward forever; like "tail -f".
r ^R ^L Repaint screen.
R Repaint screen, discarding buffered input.
---------------------------------------------------
Default "window" is the screen height.
Default "half-window" is half of the screen height.
---------------------------------------------------
/pattern * Search forward for (N-th) matching line.
?pattern * Search backward for (N-th) matching line.
n * Repeat previous search (for N-th occurrence).
N * Repeat previous search in reverse direction.
ESC-n * Repeat previous search, spanning files.
ESC-N * Repeat previous search, reverse dir. &
spanning files.
ESC-u Undo (toggle) search highlighting.
---------------------------------------------------
Search patterns may be modified by one or more of:
! search for NON-matching lines.
* search multiple files.
@ start search at first file (for /) or last file (for ?).
---------------------------------------------------
g < ESC-< * Go to first line in file (or line N).
G > ESC-> * Go to last line in file (or line N).
p % * Go to beginning of file (or N percent into file).
{ * Go to the } matching the (N-th) { in the top line.
} * Go to the { matching the (N-th) } in the bottom line.
( * Go to the ) matching the (N-th) ( in the top line.
) * Go to the ( matching the (N-th) ) in the bottom line.
[ * Go to the ] matching the (N-th) [ in the top line.
] * Go to the [ matching the (N-th) ] in the bottom line.
ESC-^F <c1> <c2> * Go to the c1 matching the (N-th) c2 in the top line
ESC-^B <c1> <c2> * Go to the c2 matching the (N-th) c1 in the bottom
line.
m<letter> Mark the current position with <letter>.
'<letter> Go to a previously marked position.
'' Go to the previous position.
^X^X Same as '.
:e [file] Examine a new file.
^X^V Same as :e.
:n * Examine the (N-th) next file from the command line.
:p * Examine the (N-th) previous file from the command
line.
:x * Examine the first (or N-th) file from the command
line.
= ^G :f Print current file name.
V Print version number of "less".
-<flag> Toggle a command line flag [see FLAGS below].
_<flag> Display the setting of a command line flag.
+cmd Execute the less cmd each time a new file is
examined.
!command Passes the command to $SHELL to be executed.
|Xcommand Pipe file between current pos & mark X to shell
command.
v Edit the current file with $VISUAL or $EDITOR.
---------------------------------------------------
FLAGS
Most flags may be changed either on the command line,
or from within less by using the - command.
-? Display help (from command line).
-a Forward search skips current screen.
-b [N] Number of buffers.
-B Don't automatically allocate buffers for pipes.
-c -C Repaint by scrolling/clearing.
-d Dumb terminal.
-e -E Quit at end of file.
-f Force open non-regular files.
-g Don't highlight matches for previous search pattern.
-G Highlight ALL matches for previous search pattern.
-h [N] Backward scroll limit.
-i Ignore case in searches.
-I Ignore case in searches and in search patterns.
-j [N] Screen position of target lines.
-k [file] Use a lesskey file.
-m -M Set prompt style.
-n -N Use line numbers.
-o [file] Log file.
-O [file] Log file (unconditionally overwrite).
-p [pattern] Start at pattern (from command line).
-P [prompt] Define new prompt.
-q -Q Quiet the terminal bell.
-r Output "raw" control characters.
-s Squeeze multiple blank lines.
-S Chop long lines.
-t [tag] Find a tag.
-T [tagsfile] Use an alternate tags file.
-u -U Change handling of backspaces.
-V Display the version number of "less".
-w Display ˜ for lines after end-of-file.
-x [N] Set tab stops.
-X Don't use termcap init/deinit strings.
-y [N] Forward scroll limit.
-z [N] Set size of window.
Comments:
LESS has an extensive documentation that is beyond the scope of
this help. For more information see:
https://gitlab.com/FreeDOS/unix/less OR WIKI
https://en.wikipedia.org/wiki/Less_(Unix)
Examples:
- none -
See also:
more
Copyright © 2013 Mark Nudelmann, help version 2023 W. Spiegl.
This file is derived from the FreeDOS Spec Command HOWTO.
See the file H2Cpying for copying conditions.