5 kx '\" t
5 kx .TH LESS 1 "Version 580: 02 Mar 2021"
5 kx .SH NAME
5 kx less \- opposite of more
5 kx .SH SYNOPSIS
5 kx .B "less \-?"
5 kx .br
5 kx .B "less \-\-help"
5 kx .br
5 kx .B "less \-V"
5 kx .br
5 kx .B "less \-\-version"
5 kx .br
5 kx .B "less [\-[+]aABcCdeEfFgGiIJKLmMnNqQrRsSuUVwWX~]"
5 kx .br
5 kx .B " [\-b \fIspace\/\fP] [\-h \fIlines\/\fP] [\-j \fIline\/\fP] [\-k \fIkeyfile\/\fP]"
5 kx .br
5 kx .B " [\-{oO} \fIlogfile\/\fP] [\-p \fIpattern\/\fP] [\-P \fIprompt\/\fP] [\-t \fItag\/\fP]"
5 kx .br
5 kx .B " [\-T \fItagsfile\/\fP] [\-x \fItab\/\fP,...] [\-y \fIlines\/\fP] [\-[z] \fIlines\/\fP]"
5 kx .br
5 kx .B " [\-# \fIshift\/\fP] [+[+]\fIcmd\/\fP] [\-\-] [\fIfilename\/\fP]..."
5 kx .br
5 kx (See the OPTIONS section for alternate option syntax with long option names.)
5 kx .
5 kx .SH DESCRIPTION
5 kx .I Less
5 kx is a program similar to
5 kx .IR more (1),
5 kx but which allows backward movement
5 kx in the file as well as forward movement.
5 kx Also,
5 kx .I less
5 kx does not have to read the entire input file before starting,
5 kx so with large input files it starts up faster than text editors like
5 kx .IR vi (1).
5 kx .I Less
5 kx uses termcap (or terminfo on some systems),
5 kx so it can run on a variety of terminals.
5 kx There is even limited support for hardcopy terminals.
5 kx (On a hardcopy terminal, lines which should be printed at the top
5 kx of the screen are prefixed with a caret.)
5 kx .PP
5 kx Commands are based on both
5 kx .I more
5 kx and
5 kx .IR vi .
5 kx Commands may be preceded by a decimal number,
5 kx called N in the descriptions below.
5 kx The number is used by some commands, as indicated.
5 kx .
5 kx .SH COMMANDS
5 kx In the following descriptions, ^X means control-X.
5 kx ESC stands for the ESCAPE key; for example ESC-v means the
5 kx two character sequence "ESCAPE", then "v".
5 kx .IP "h or H"
5 kx Help: display a summary of these commands.
5 kx If you forget all the other commands, remember this one.
5 kx .IP "SPACE or ^V or f or ^F"
5 kx Scroll forward N lines, default one window (see option \-z below).
5 kx If N is more than the screen size, only the final screenful is displayed.
5 kx Warning: some systems use ^V as a special literalization character.
5 kx .IP "z"
5 kx Like SPACE, but if N is specified, it becomes the new window size.
5 kx .IP "ESC-SPACE"
5 kx Like SPACE, but scrolls a full screenful, even if it reaches
5 kx end-of-file in the process.
5 kx .IP "ENTER or RETURN or ^N or e or ^E or j or ^J"
5 kx Scroll forward N lines, default 1.
5 kx The entire N lines are displayed, even if N is more than the screen size.
5 kx .IP "d or ^D"
5 kx Scroll forward N lines, default one half of the screen size.
5 kx If N is specified, it becomes the new default for
5 kx subsequent d and u commands.
5 kx .IP "b or ^B or ESC-v"
5 kx Scroll backward N lines, default one window (see option \-z below).
5 kx If N is more than the screen size, only the final screenful is displayed.
5 kx .IP "w"
5 kx Like ESC-v, but if N is specified, it becomes the new window size.
5 kx .IP "y or ^Y or ^P or k or ^K"
5 kx Scroll backward N lines, default 1.
5 kx The entire N lines are displayed, even if N is more than the screen size.
5 kx Warning: some systems use ^Y as a special job control character.
5 kx .IP "u or ^U"
5 kx Scroll backward N lines, default one half of the screen size.
5 kx If N is specified, it becomes the new default for
5 kx subsequent d and u commands.
5 kx .IP "J"
5 kx Like j, but continues to scroll beyond the end of the file.
5 kx .IP "K or Y"
5 kx Like k, but continues to scroll beyond the beginning of the file.
5 kx .IP "ESC-) or RIGHTARROW"
5 kx Scroll horizontally right N characters, default half the screen width
5 kx (see the \-# option).
5 kx If a number N is specified, it becomes the default for future RIGHTARROW
5 kx and LEFTARROW commands.
5 kx While the text is scrolled, it acts as though the \-S option
5 kx (chop lines) were in effect.
5 kx .IP "ESC-( or LEFTARROW"
5 kx Scroll horizontally left N characters, default half the screen width
5 kx (see the \-# option).
5 kx If a number N is specified, it becomes the default for future RIGHTARROW
5 kx and LEFTARROW commands.
5 kx .IP "ESC-} or ^RIGHTARROW"
5 kx Scroll horizontally right to show the end of the longest displayed line.
5 kx .IP "ESC-{ or ^LEFTARROW"
5 kx Scroll horizontally left back to the first column.
5 kx .IP "r or ^R or ^L"
5 kx Repaint the screen.
5 kx .IP R
5 kx Repaint the screen, discarding any buffered input.
5 kx Useful if the file is changing while it is being viewed.
5 kx .IP "F"
5 kx Scroll forward, and keep trying to read when the
5 kx end of file is reached.
5 kx Normally this command would be used when already at the end of the file.
5 kx It is a way to monitor the tail of a file which is growing
5 kx while it is being viewed.
5 kx (The behavior is similar to the "tail \-f" command.)
5 kx To stop waiting for more data, enter the interrupt character (usually ^C).
5 kx On some systems you can also use ^X.
5 kx .IP "ESC-F"
5 kx Like F, but as soon as a line is found which matches
5 kx the last search pattern, the terminal bell is rung
5 kx and forward scrolling stops.
5 kx .IP "g or < or ESC-<"
5 kx Go to line N in the file, default 1 (beginning of file).
5 kx (Warning: this may be slow if N is large.)
5 kx .IP "G or > or ESC->"
5 kx Go to line N in the file, default the end of the file.
5 kx (Warning: this may be slow if N is large,
5 kx or if N is not specified and
5 kx standard input, rather than a file, is being read.)
5 kx .IP "ESC-G"
5 kx Same as G, except if no number N is specified and the input is standard input,
5 kx goes to the last line which is currently buffered.
5 kx .IP "p or %"
5 kx Go to a position N percent into the file.
5 kx N should be between 0 and 100, and may contain a decimal point.
5 kx .IP "P"
5 kx Go to the line containing byte offset N in the file.
5 kx .IP "{"
5 kx If a left curly bracket appears in the top line displayed
5 kx on the screen,
5 kx the { command will go to the matching right curly bracket.
5 kx The matching right curly bracket is positioned on the bottom
5 kx line of the screen.
5 kx If there is more than one left curly bracket on the top line,
5 kx a number N may be used to specify the N-th bracket on the line.
5 kx .IP "}"
5 kx If a right curly bracket appears in the bottom line displayed
5 kx on the screen,
5 kx the } command will go to the matching left curly bracket.
5 kx The matching left curly bracket is positioned on the top
5 kx line of the screen.
5 kx If there is more than one right curly bracket on the top line,
5 kx a number N may be used to specify the N-th bracket on the line.
5 kx .IP "("
5 kx Like {, but applies to parentheses rather than curly brackets.
5 kx .IP ")"
5 kx Like }, but applies to parentheses rather than curly brackets.
5 kx .IP "["
5 kx Like {, but applies to square brackets rather than curly brackets.
5 kx .IP "]"
5 kx Like }, but applies to square brackets rather than curly brackets.
5 kx .IP "ESC-^F"
5 kx Followed by two characters,
5 kx acts like {, but uses the two characters as open and close brackets,
5 kx respectively.
5 kx For example, "ESC ^F < >" could be used to
5 kx go forward to the > which matches the < in the top displayed line.
5 kx .IP "ESC-^B"
5 kx Followed by two characters,
5 kx acts like }, but uses the two characters as open and close brackets,
5 kx respectively.
5 kx For example, "ESC ^B < >" could be used to
5 kx go backward to the < which matches the > in the bottom displayed line.
5 kx .IP m
5 kx Followed by any lowercase or uppercase letter,
5 kx marks the first displayed line with that letter.
5 kx If the status column is enabled via the \-J option,
5 kx the status column shows the marked line.
5 kx .IP M
5 kx Acts like m, except the last displayed line is marked
5 kx rather than the first displayed line.
5 kx .IP "'"
5 kx (Single quote.)
5 kx Followed by any lowercase or uppercase letter, returns to the position which
5 kx was previously marked with that letter.
5 kx Followed by another single quote, returns to the position at
5 kx which the last "large" movement command was executed.
5 kx Followed by a ^ or $, jumps to the beginning or end of the
5 kx file respectively.
5 kx Marks are preserved when a new file is examined,
5 kx so the ' command can be used to switch between input files.
5 kx .IP "^X^X"
5 kx Same as single quote.
5 kx .IP "ESC-m"
5 kx Followed by any lowercase or uppercase letter,
5 kx clears the mark identified by that letter.
5 kx .IP /pattern
5 kx Search forward in the file for the N-th line containing the pattern.
5 kx N defaults to 1.
5 kx The pattern is a regular expression, as recognized by
5 kx the regular expression library supplied by your system.
5 kx The search starts at the first line displayed
5 kx (but see the \-a and \-j options, which change this).
5 kx .sp
5 kx Certain characters are special
5 kx if entered at the beginning of the pattern;
5 kx they modify the type of search rather than become part of the pattern:
5 kx .RS
5 kx .IP "^N or !"
5 kx Search for lines which do NOT match the pattern.
5 kx .IP "^E or *"
5 kx Search multiple files.
5 kx That is, if the search reaches the END of the current file
5 kx without finding a match,
5 kx the search continues in the next file in the command line list.
5 kx .IP "^F or @"
5 kx Begin the search at the first line of the FIRST file
5 kx in the command line list,
5 kx regardless of what is currently displayed on the screen
5 kx or the settings of the \-a or \-j options.
5 kx .IP "^K"
5 kx Highlight any text which matches the pattern on the current screen,
5 kx but don't move to the first match (KEEP current position).
5 kx .IP "^R"
5 kx Don't interpret regular expression metacharacters;
5 kx that is, do a simple textual comparison.
5 kx .IP "^W"
5 kx WRAP around the current file.
5 kx That is, if the search reaches the end of the current file
5 kx without finding a match, the search continues from the first line of the
5 kx current file up to the line where it started.
5 kx .RE
5 kx .IP ?pattern
5 kx Search backward in the file for the N-th line containing the pattern.
5 kx The search starts at the last line displayed
5 kx (but see the \-a and \-j options, which change this).
5 kx .sp
5 kx Certain characters are special as in the / command:
5 kx .RS
5 kx .IP "^N or !"
5 kx Search for lines which do NOT match the pattern.
5 kx .IP "^E or *"
5 kx Search multiple files.
5 kx That is, if the search reaches the beginning of the current file
5 kx without finding a match,
5 kx the search continues in the previous file in the command line list.
5 kx .IP "^F or @"
5 kx Begin the search at the last line of the last file
5 kx in the command line list,
5 kx regardless of what is currently displayed on the screen
5 kx or the settings of the \-a or \-j options.
5 kx .IP "^K"
5 kx As in forward searches.
5 kx .IP "^R"
5 kx As in forward searches.
5 kx .IP "^W"
5 kx WRAP around the current file.
5 kx That is, if the search reaches the beginning of the current file
5 kx without finding a match, the search continues from the last line of the
5 kx current file up to the line where it started.
5 kx .RE
5 kx .IP "ESC-/pattern"
5 kx Same as "/*".
5 kx .IP "ESC-?pattern"
5 kx Same as "?*".
5 kx .IP n
5 kx Repeat previous search, for N-th line containing the last pattern.
5 kx If the previous search was modified by ^N, the search is made for the
5 kx N-th line NOT containing the pattern.
5 kx If the previous search was modified by ^E, the search continues
5 kx in the next (or previous) file if not satisfied in the current file.
5 kx If the previous search was modified by ^R, the search is done
5 kx without using regular expressions.
5 kx There is no effect if the previous search was modified by ^F or ^K.
5 kx .IP N
5 kx Repeat previous search, but in the reverse direction.
5 kx .IP "ESC-n"
5 kx Repeat previous search, but crossing file boundaries.
5 kx The effect is as if the previous search were modified by *.
5 kx .IP "ESC-N"
5 kx Repeat previous search, but in the reverse direction
5 kx and crossing file boundaries.
5 kx .IP "ESC-u"
5 kx Undo search highlighting.
5 kx Turn off highlighting of strings matching the current search pattern.
5 kx If highlighting is already off because of a previous ESC-u command,
5 kx turn highlighting back on.
5 kx Any search command will also turn highlighting back on.
5 kx (Highlighting can also be disabled by toggling the \-G option;
5 kx in that case search commands do not turn highlighting back on.)
5 kx .IP "ESC-U"
5 kx Like ESC-u but also clears the saved search pattern.
5 kx If the status column is enabled via the \-J option,
5 kx this clears all search matches marked in the status column.
5 kx .IP "&pattern"
5 kx Display only lines which match the pattern;
5 kx lines which do not match the pattern are not displayed.
5 kx If pattern is empty (if you type & immediately followed by ENTER),
5 kx any filtering is turned off, and all lines are displayed.
5 kx While filtering is in effect, an ampersand is displayed at the
5 kx beginning of the prompt,
5 kx as a reminder that some lines in the file may be hidden.
5 kx Multiple & commands may be entered, in which case only lines
5 kx which match all of the patterns will be displayed.
5 kx .sp
5 kx Certain characters are special as in the / command:
5 kx .RS
5 kx .IP "^N or !"
5 kx Display only lines which do NOT match the pattern.
5 kx .IP "^R"
5 kx Don't interpret regular expression metacharacters;
5 kx that is, do a simple textual comparison.
5 kx .RE
5 kx .IP ":e [filename]"
5 kx Examine a new file.
5 kx If the filename is missing, the "current" file (see the :n and :p commands
5 kx below) from the list of files in the command line is re-examined.
5 kx A percent sign (%) in the filename is replaced by the name of the
5 kx current file.
5 kx A pound sign (#) is replaced by the name of the previously examined file.
5 kx However, two consecutive percent signs are simply
5 kx replaced with a single percent sign.
5 kx This allows you to enter a filename that contains a percent sign
5 kx in the name.
5 kx Similarly, two consecutive pound signs are replaced with a single pound sign.
5 kx The filename is inserted into the command line list of files
5 kx so that it can be seen by subsequent :n and :p commands.
5 kx If the filename consists of several files, they are all inserted into
5 kx the list of files and the first one is examined.
5 kx If the filename contains one or more spaces,
5 kx the entire filename should be enclosed in double quotes
5 kx (also see the \-" option).
5 kx .IP "^X^V or E"
5 kx Same as :e.
5 kx Warning: some systems use ^V as a special literalization character.
5 kx On such systems, you may not be able to use ^V.
5 kx .IP ":n"
5 kx Examine the next file (from the list of files given in the command line).
5 kx If a number N is specified, the N-th next file is examined.
5 kx .IP ":p"
5 kx Examine the previous file in the command line list.
5 kx If a number N is specified, the N-th previous file is examined.
5 kx .IP ":x"
5 kx Examine the first file in the command line list.
5 kx If a number N is specified, the N-th file in the list is examined.
5 kx .IP ":d"
5 kx Remove the current file from the list of files.
5 kx .IP "t"
5 kx Go to the next tag, if there were more than one matches for the current tag.
5 kx See the \-t option for more details about tags.
5 kx .IP "T"
5 kx Go to the previous tag, if there were more than one matches for the current tag.
5 kx .IP "= or ^G or :f"
5 kx Prints some information about the file being viewed,
5 kx including its name
5 kx and the line number and byte offset of the bottom line being displayed.
5 kx If possible, it also prints the length of the file,
5 kx the number of lines in the file
5 kx and the percent of the file above the last displayed line.
5 kx .IP \-
5 kx Followed by one of the command line option letters (see OPTIONS below),
5 kx this will change the setting of that option
5 kx and print a message describing the new setting.
5 kx If a ^P (CONTROL-P) is entered immediately after the dash,
5 kx the setting of the option is changed but no message is printed.
5 kx If the option letter has a numeric value (such as \-b or \-h),
5 kx or a string value (such as \-P or \-t),
5 kx a new value may be entered after the option letter.
5 kx If no new value is entered, a message describing
5 kx the current setting is printed and nothing is changed.
5 kx .IP \-\-
5 kx Like the \- command, but takes a long option name (see OPTIONS below)
5 kx rather than a single option letter.
5 kx You must press ENTER or RETURN after typing the option name.
5 kx A ^P immediately after the second dash suppresses printing of a
5 kx message describing the new setting, as in the \- command.
5 kx .IP \-+
5 kx Followed by one of the command line option letters
5 kx this will reset the option to its default setting
5 kx and print a message describing the new setting.
5 kx (The "\-+\fIX\fP" command does the same thing
5 kx as "\-+\fIX\fP" on the command line.)
5 kx This does not work for string-valued options.
5 kx .IP \-\-+
5 kx Like the \-+ command, but takes a long option name
5 kx rather than a single option letter.
5 kx .IP \-!
5 kx Followed by one of the command line option letters,
5 kx this will reset the option to the "opposite" of its default setting
5 kx and print a message describing the new setting.
5 kx This does not work for numeric or string-valued options.
5 kx .IP \-\-!
5 kx Like the \-!\& command, but takes a long option name
5 kx rather than a single option letter.
5 kx .IP _
5 kx (Underscore.)
5 kx Followed by one of the command line option letters,
5 kx this will print a message describing the current setting of that option.
5 kx The setting of the option is not changed.
5 kx .IP __
5 kx (Double underscore.)
5 kx Like the _ (underscore) command, but takes a long option name
5 kx rather than a single option letter.
5 kx You must press ENTER or RETURN after typing the option name.
5 kx .IP +cmd
5 kx Causes the specified cmd to be executed each time a new file is examined.
5 kx For example, +G causes
5 kx .I less
5 kx to initially display each file starting at the end
5 kx rather than the beginning.
5 kx .IP V
5 kx Prints the version number of
5 kx .I less
5 kx being run.
5 kx .IP "q or Q or :q or :Q or ZZ"
5 kx Exits
5 kx .IR less .
5 kx .PP
5 kx The following
5 kx four
5 kx commands may or may not be valid, depending on your particular installation.
5 kx .
5 kx .IP v
5 kx Invokes an editor to edit the current file being viewed.
5 kx The editor is taken from the environment variable VISUAL if defined,
5 kx or EDITOR if VISUAL is not defined,
5 kx or defaults to "vi" if neither VISUAL nor EDITOR is defined.
5 kx See also the discussion of LESSEDIT under the section on PROMPTS below.
5 kx .IP "! shell-command"
5 kx Invokes a shell to run the shell-command given.
5 kx A percent sign (%) in the command is replaced by the name of the
5 kx current file.
5 kx A pound sign (#) is replaced by the name of the previously examined file.
5 kx "!!" repeats the last shell command.
5 kx "!" with no shell command simply invokes a shell.
5 kx On Unix systems, the shell is taken from the environment variable SHELL,
5 kx or defaults to "sh".
5 kx On MS-DOS and OS/2 systems, the shell is the normal command processor.
5 kx .IP "| <m> shell-command"
5 kx <m> represents any mark letter.
5 kx Pipes a section of the input file to the given shell command.
5 kx The section of the file to be piped is between the position marked by
5 kx the letter and the current screen.
5 kx The entire current screen is included, regardless of whether the
5 kx marked position is before or after the current screen.
5 kx <m> may also be ^ or $ to indicate beginning or end of file respectively.
5 kx If <m> is \&.\& or newline, the current screen is piped.
5 kx .IP "s filename"
5 kx Save the input to a file.
5 kx This only works if the input is a pipe, not an ordinary file.
5 kx .
5 kx .SH OPTIONS
5 kx Command line options are described below.
5 kx Most options may be changed while
5 kx .I less
5 kx is running, via the "\-" command.
5 kx .PP
5 kx Most options may be given in one of two forms:
5 kx either a dash followed by a single letter,
5 kx or two dashes followed by a long option name.
5 kx A long option name may be abbreviated as long as
5 kx the abbreviation is unambiguous.
5 kx For example, \-\-quit-at-eof may be abbreviated \-\-quit, but not
5 kx \-\-qui, since both \-\-quit-at-eof and \-\-quiet begin with \-\-qui.
5 kx Some long option names are in uppercase, such as \-\-QUIT-AT-EOF, as
5 kx distinct from \-\-quit-at-eof.
5 kx Such option names need only have their first letter capitalized;
5 kx the remainder of the name may be in either case.
5 kx For example, \-\-Quit-at-eof is equivalent to \-\-QUIT-AT-EOF.
5 kx .PP
5 kx Options are also taken from the environment variable "LESS".
5 kx For example,
5 kx to avoid typing "less \-options \&...\&" each time
5 kx .I less
5 kx is invoked, you might tell
5 kx .IR csh :
5 kx .sp
5 kx setenv LESS "\-options"
5 kx .sp
5 kx or if you use
5 kx .IR sh :
5 kx .sp
5 kx LESS="\-options"; export LESS
5 kx .sp
5 kx On MS-DOS, you don't need the quotes, but you should replace any
5 kx percent signs in the options string by double percent signs.
5 kx .sp
5 kx The environment variable is parsed before the command line,
5 kx so command line options override the LESS environment variable.
5 kx If an option appears in the LESS variable, it can be reset
5 kx to its default value on the command line by beginning the command
5 kx line option with "\-+".
5 kx .sp
5 kx Some options like \-k or \-D require a string to follow the option letter.
5 kx The string for that option is considered to end when a dollar sign ($) is found.
5 kx For example, you can set two \-D options on MS-DOS like this:
5 kx .sp
5 kx LESS="Dn9.1$Ds4.1"
5 kx .sp
5 kx If the \-\-use-backslash option appears earlier in the options, then
5 kx a dollar sign or backslash may be included literally in an option string
5 kx by preceding it with a backslash.
5 kx If the \-\-use-backslash option is not in effect, then backslashes are
5 kx not treated specially, and there is no way to include a dollar sign
5 kx in the option string.
5 kx .IP "\-? or \-\-help"
5 kx This option displays a summary of the commands accepted by
5 kx .I less
5 kx (the same as the h command).
5 kx (Depending on how your shell interprets the question mark,
5 kx it may be necessary to quote the question mark, thus: "\-\e?".)
5 kx .IP "\-a or \-\-search-skip-screen"
5 kx By default, forward searches start at the top of the displayed screen
5 kx and backwards searches start at the bottom of the displayed screen
5 kx (except for repeated searches invoked by the n or N commands,
5 kx which start after or before the "target" line respectively;
5 kx see the \-j option for more about the target line).
5 kx The \-a option causes forward searches to instead start at
5 kx the bottom of the screen
5 kx and backward searches to start at the top of the screen,
5 kx thus skipping all lines displayed on the screen.
5 kx .IP "\-A or \-\-SEARCH-SKIP-SCREEN"
5 kx Causes all forward searches (not just non-repeated searches)
5 kx to start just after the target line, and all backward searches
5 kx to start just before the target line.
5 kx Thus, forward searches will skip part of the displayed screen
5 kx (from the first line up to and including the target line).
5 kx Similarly backwards searches will skip the displayed screen
5 kx from the last line up to and including the target line.
5 kx This was the default behavior in less versions prior to 441.
5 kx .IP "\-b\fIn\fP or \-\-buffers=\fIn\fP"
5 kx Specifies the amount of buffer space
5 kx .I less
5 kx will use for each file, in units of kilobytes (1024 bytes).
5 kx By default 64\ KB of buffer space is used for each file
5 kx (unless the file is a pipe; see the \-B option).
5 kx The \-b option specifies instead that \fIn\fP kilobytes of
5 kx buffer space should be used for each file.
5 kx If \fIn\fP is \-1, buffer space is unlimited; that is,
5 kx the entire file can be read into memory.
5 kx .IP "\-B or \-\-auto-buffers"
5 kx By default, when data is read from a pipe,
5 kx buffers are allocated automatically as needed.
5 kx If a large amount of data is read from the pipe, this can cause
5 kx a large amount of memory to be allocated.
5 kx The \-B option disables this automatic allocation of buffers for pipes,
5 kx so that only 64\ KB
5 kx (or the amount of space specified by the \-b option)
5 kx is used for the pipe.
5 kx Warning: use of \-B can result in erroneous display, since only the
5 kx most recently viewed part of the piped data is kept in memory;
5 kx any earlier data is lost.
5 kx .IP "\-c or \-\-clear-screen"
5 kx Causes full screen repaints to be painted from the top line down.
5 kx By default,
5 kx full screen repaints are done by scrolling from the bottom of the screen.
5 kx .IP "\-C or \-\-CLEAR-SCREEN"
5 kx Same as \-c, for compatibility with older versions of
5 kx .IR less .
5 kx .IP "\-d or \-\-dumb"
5 kx The \-d option suppresses the error message
5 kx normally displayed if the terminal is dumb;
5 kx that is, lacks some important capability,
5 kx such as the ability to clear the screen or scroll backward.
5 kx The \-d option does not otherwise change the behavior of
5 kx .I less
5 kx on a dumb terminal.
5 kx .IP "\-D\fBx\fP\fIcolor\fP or \-\-color=\fBx\fP\fIcolor\fP"
5 kx Changes the color of different parts of the displayed text.
5 kx \fBx\fP is a single character which selects the type of text
5 kx whose color is being set:
5 kx .RS
5 kx .IP "B"
5 kx Binary characters.
5 kx .IP "C"
5 kx Control characters.
5 kx .IP "E"
5 kx Errors and informational messages.
5 kx .IP "M"
5 kx Mark letters in the status column.
5 kx .IP "N"
5 kx Line numbers enabled via the \-N option.
5 kx .IP "P"
5 kx Prompts.
5 kx .IP "R"
5 kx The rscroll character.
5 kx .IP "S"
5 kx Search results.
5 kx .IP "W"
5 kx The highlight enabled via the \-w option.
5 kx .IP "d"
5 kx Bold text.
5 kx .IP "k"
5 kx Blinking text.
5 kx .IP "s"
5 kx Standout text.
5 kx .IP "u"
5 kx Underlined text.
5 kx .RE
5 kx
5 kx .RS
5 kx The uppercase letters can be used only when the \-\-use-color option is enabled.
5 kx When text color is specified by both an uppercase letter and a lowercase letter,
5 kx the uppercase letter takes precedence.
5 kx For example, error messages are normally displayed as standout text.
5 kx So if both "s" and "E" are given a color, the "E" color applies
5 kx to error messages, and the "s" color applies to other standout text.
5 kx The "d" and "u" letters refer to bold and underline text formed by
5 kx overstriking with backspaces (see the \-u option),
5 kx not to text using ANSI escape sequences with the \-R option.
5 kx .PP
5 kx A lowercase letter may be followed by a + to indicate that
5 kx both the normal format change and the specified color should both be used.
5 kx For example, \-Dug displays underlined text as green without underlining;
5 kx the green color has replaced the usual underline formatting.
5 kx But \-Du+g displays underlined text as both green and in underlined format.
5 kx .PP
5 kx \fIcolor\fP is either a 4-bit color string or an 8-bit color string:
5 kx .PP
5 kx A 4-bit color string is zero, one or two characters, where
5 kx the first character specifies the foreground color and
5 kx the second specifies the background color as follows:
5 kx .IP "b"
5 kx Blue
5 kx .IP "c"
5 kx Cyan
5 kx .IP "g"
5 kx Green
5 kx .IP "k"
5 kx Black
5 kx .IP "m"
5 kx Magenta
5 kx .IP "r"
5 kx Red
5 kx .IP "w"
5 kx White
5 kx .IP "y"
5 kx Yellow
5 kx .PP
5 kx The corresponding upper-case letter denotes a brighter shade of the color.
5 kx For example, \-DNGk displays line numbers as bright green text on a black
5 kx background, and \-DEbR displays error messages as blue text on a
5 kx bright red background.
5 kx If either character is a "-" or is omitted, the corresponding color
5 kx is set to that of normal text.
5 kx .PP
5 kx An 8-bit color string is one or two decimal integers separated by a dot,
5 kx where the first integer specifies the foreground color and
5 kx the second specifies the background color.
5 kx Each integer is a value between 0 and 255 inclusive which selects
5 kx a "CSI 38;5" color value (see
5 kx .br
5 kx .nh
5 kx https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters)
5 kx .hy
5 kx If either integer is a "-" or is omitted,
5 kx the corresponding color is set to that of normal text.
5 kx On MS-DOS versions of
5 kx .IR less ,
5 kx 8-bit color is not supported; instead, decimal values are interpreted as 4-bit
5 kx CHAR_INFO.Attributes values
5 kx (see
5 kx .br
5 kx .nh
5 kx https://docs.microsoft.com/en-us/windows/console/char-info-str).
5 kx .hy
5 kx .RE
5 kx .IP "\-e or \-\-quit-at-eof"
5 kx Causes
5 kx .I less
5 kx to automatically exit
5 kx the second time it reaches end-of-file.
5 kx By default, the only way to exit
5 kx .I less
5 kx is via the "q" command.
5 kx .IP "\-E or \-\-QUIT-AT-EOF"
5 kx Causes
5 kx .I less
5 kx to automatically exit the first time it reaches end-of-file.
5 kx .IP "\-f or \-\-force"
5 kx Forces non-regular files to be opened.
5 kx (A non-regular file is a directory or a device special file.)
5 kx Also suppresses the warning message when a binary file is opened.
5 kx By default,
5 kx .I less
5 kx will refuse to open non-regular files.
5 kx Note that some operating systems will not allow directories
5 kx to be read, even if \-f is set.
5 kx .IP "\-F or \-\-quit-if-one-screen"
5 kx Causes
5 kx .I less
5 kx to automatically exit
5 kx if the entire file can be displayed on the first screen.
5 kx .IP "\-g or \-\-hilite-search"
5 kx Normally,
5 kx .I less
5 kx will highlight ALL strings which match the last search command.
5 kx The \-g option changes this behavior to highlight only the particular string
5 kx which was found by the last search command.
5 kx This can cause
5 kx .I less
5 kx to run somewhat faster than the default.
5 kx .IP "\-G or \-\-HILITE-SEARCH"
5 kx The \-G option suppresses all highlighting of strings found by search commands.
5 kx .IP "\-h\fIn\fP or \-\-max-back-scroll=\fIn\fP"
5 kx Specifies a maximum number of lines to scroll backward.
5 kx If it is necessary to scroll backward more than \fIn\fP lines,
5 kx the screen is repainted in a forward direction instead.
5 kx (If the terminal does not have the ability to scroll
5 kx backward, \-h0 is implied.)
5 kx .IP "\-i or \-\-ignore-case"
5 kx Causes searches to ignore case; that is,
5 kx uppercase and lowercase are considered identical.
5 kx This option is ignored if any uppercase letters
5 kx appear in the search pattern;
5 kx in other words,
5 kx if a pattern contains uppercase letters, then that search does not ignore case.
5 kx .IP "\-I or \-\-IGNORE-CASE"
5 kx Like \-i, but searches ignore case even if
5 kx the pattern contains uppercase letters.
5 kx .IP "\-j\fIn\fP or \-\-jump-target=\fIn\fP"
5 kx Specifies a line on the screen where the "target" line
5 kx is to be positioned.
5 kx The target line is the line specified by any command to
5 kx search for a pattern, jump to a line number,
5 kx jump to a file percentage or jump to a tag.
5 kx The screen line may be specified by a number: the top line on the screen
5 kx is 1, the next is 2, and so on.
5 kx The number may be negative to specify a line relative to the bottom
5 kx of the screen: the bottom line on the screen is \-1, the second
5 kx to the bottom is \-2, and so on.
5 kx Alternately, the screen line may be specified as a fraction of the height
5 kx of the screen, starting with a decimal point: \&.5 is in the middle of the
5 kx screen, \&.3 is three tenths down from the first line, and so on.
5 kx If the line is specified as a fraction, the actual line number
5 kx is recalculated if the terminal window is resized, so that the
5 kx target line remains at the specified fraction of the screen height.
5 kx If any form of the \-j option is used,
5 kx repeated forward searches (invoked with "n" or "N")
5 kx begin at the line immediately after the target line,
5 kx and repeated backward searches begin at the target line,
5 kx unless changed by \-a or \-A.
5 kx For example, if "\-j4" is used, the target line is the
5 kx fourth line on the screen, so forward searches begin at the fifth line
5 kx on the screen.
5 kx However nonrepeated searches (invoked with "/" or "?")
5 kx always begin at the start or end of the current screen respectively.
5 kx .IP "\-J or \-\-status-column"
5 kx Displays a status column at the left edge of the screen.
5 kx The status column shows the lines that matched the current search,
5 kx and any lines that are marked (via the m or M command).
5 kx .IP "\-k\fIfilename\fP or \-\-lesskey-file=\fIfilename\fP"
5 kx Causes
5 kx .I less
5 kx to open and interpret the named file as a
5 kx .IR lesskey (1)
5 kx file.
5 kx Multiple \-k options may be specified.
5 kx If the LESSKEY or LESSKEY_SYSTEM environment variable is set, or
5 kx if a lesskey file is found in a standard place (see KEY BINDINGS),
5 kx it is also used as a
5 kx .I lesskey
5 kx file.
5 kx .IP "\-K or \-\-quit-on-intr"
5 kx Causes
5 kx .I less
5 kx to exit immediately (with status 2)
5 kx when an interrupt character (usually ^C) is typed.
5 kx Normally, an interrupt character causes
5 kx .I less
5 kx to stop whatever it is doing and return to its command prompt.
5 kx Note that use of this option makes it impossible to return to the
5 kx command prompt from the "F" command.
5 kx .IP "\-L or \-\-no-lessopen"
5 kx Ignore the LESSOPEN environment variable
5 kx (see the INPUT PREPROCESSOR section below).
5 kx This option can be set from within
5 kx .IR less ,
5 kx but it will apply only to files opened subsequently, not to the
5 kx file which is currently open.
5 kx .IP "\-m or \-\-long-prompt"
5 kx Causes
5 kx .I less
5 kx to prompt verbosely (like \fImore\fP),
5 kx with the percent into the file.
5 kx By default,
5 kx .I less
5 kx prompts with a colon.
5 kx .IP "\-M or \-\-LONG-PROMPT"
5 kx Causes
5 kx .I less
5 kx to prompt even more verbosely than
5 kx .IR more .
5 kx .IP "\-n or \-\-line-numbers"
5 kx Suppresses line numbers.
5 kx The default (to use line numbers) may cause
5 kx .I less
5 kx to run more slowly in some cases, especially with a very large input file.
5 kx Suppressing line numbers with the \-n option will avoid this problem.
5 kx Using line numbers means: the line number will be displayed in the verbose
5 kx prompt and in the = command,
5 kx and the v command will pass the current line number to the editor
5 kx (see also the discussion of LESSEDIT in PROMPTS below).
5 kx .IP "\-N or \-\-LINE-NUMBERS"
5 kx Causes a line number to be displayed at the beginning of
5 kx each line in the display.
5 kx .IP "\-o\fIfilename\fP or \-\-log-file=\fIfilename\fP"
5 kx Causes
5 kx .I less
5 kx to copy its input to the named file as it is being viewed.
5 kx This applies only when the input file is a pipe,
5 kx not an ordinary file.
5 kx If the file already exists,
5 kx .I less
5 kx will ask for confirmation before overwriting it.
5 kx .IP "\-O\fIfilename\fP or \-\-LOG-FILE=\fIfilename\fP"
5 kx The \-O option is like \-o, but it will overwrite an existing
5 kx file without asking for confirmation.
5 kx .sp
5 kx If no log file has been specified,
5 kx the \-o and \-O options can be used from within
5 kx .I less
5 kx to specify a log file.
5 kx Without a file name, they will simply report the name of the log file.
5 kx The "s" command is equivalent to specifying \-o from within
5 kx .IR less .
5 kx .IP "\-p\fIpattern\fP or \-\-pattern=\fIpattern\fP"
5 kx The \-p option on the command line is equivalent to
5 kx specifying +/\fIpattern\fP;
5 kx that is, it tells
5 kx .I less
5 kx to start at the first occurrence of \fIpattern\fP in the file.
5 kx .IP "\-P\fIprompt\fP or \-\-prompt=\fIprompt\fP"
5 kx Provides a way to tailor the three prompt
5 kx styles to your own preference.
5 kx This option would normally be put in the LESS environment
5 kx variable, rather than being typed in with each
5 kx .I less
5 kx command.
5 kx Such an option must either be the last option in the LESS variable,
5 kx or be terminated by a dollar sign.
5 kx \-Ps followed by a string changes the default (short) prompt
5 kx to that string.
5 kx \-Pm changes the medium (\-m) prompt.
5 kx \-PM changes the long (\-M) prompt.
5 kx \-Ph changes the prompt for the help screen.
5 kx \-P= changes the message printed by the = command.
5 kx \-Pw changes the message printed while waiting for data (in the F command).
5 kx .sp 1
5 kx All prompt strings consist of a sequence of
5 kx letters and special escape sequences.
5 kx See the section on PROMPTS for more details.
5 kx .IP "\-q or \-\-quiet or \-\-silent"
5 kx Causes moderately "quiet" operation:
5 kx the terminal bell is not rung
5 kx if an attempt is made to scroll past the end of the file
5 kx or before the beginning of the file.
5 kx If the terminal has a "visual bell", it is used instead.
5 kx The bell will be rung on certain other errors,
5 kx such as typing an invalid character.
5 kx The default is to ring the terminal bell in all such cases.
5 kx .IP "\-Q or \-\-QUIET or \-\-SILENT"
5 kx Causes totally "quiet" operation:
5 kx the terminal bell is never rung.
5 kx If the terminal has a "visual bell", it is used in all cases
5 kx where the terminal bell would have been rung.
5 kx .IP "\-r or \-\-raw-control-chars"
5 kx Causes "raw" control characters to be displayed.
5 kx The default is to display control characters using the caret notation;
5 kx for example, a control-A (octal 001) is displayed as "^A".
5 kx Warning: when the \-r option is used,
5 kx .I less
5 kx cannot keep track of the actual appearance of the screen
5 kx (since this depends on how the screen responds to
5 kx each type of control character).
5 kx Thus, various display problems may result,
5 kx such as long lines being split in the wrong place.
5 kx .IP "\-R or \-\-RAW-CONTROL-CHARS"
5 kx Like \-r, but only ANSI "color" escape sequences and OSC 8 hyperlink
5 kx sequences are output in "raw" form.
5 kx Unlike \-r, the screen appearance is maintained correctly,
5 kx provided that there are no escape sequences in the file
5 kx other than these types of escape sequences.
5 kx Color escape sequences are only supported when the color
5 kx is changed within one line, not across lines.
5 kx In other words, the beginning of each line is assumed to be
5 kx normal (non-colored), regardless of any escape sequences in previous lines.
5 kx For the purpose of keeping track of screen appearance,
5 kx these escape sequences are assumed to not move the cursor.
5 kx .sp
5 kx OSC 8 hyperlinks are sequences of the form:
5 kx .sp
5 kx ESC ] 8 ; \&...\& \\7
5 kx .sp
5 kx The terminating sequence may be either a BEL character (\\7)
5 kx or the two-character sequence "ESC \\".
5 kx .sp
5 kx ANSI color escape sequences are sequences of the form:
5 kx .sp
5 kx ESC [ \&...\& m
5 kx .sp
5 kx where the "...\&" is zero or more color specification characters.
5 kx You can make
5 kx .I less
5 kx think that characters other than "m" can end ANSI color escape sequences
5 kx by setting the environment variable LESSANSIENDCHARS to the list of
5 kx characters which can end a color escape sequence.
5 kx And you can make
5 kx .I less
5 kx think that characters other than the standard ones may appear between
5 kx the ESC and the m by setting the environment variable LESSANSIMIDCHARS
5 kx to the list of characters which can appear.
5 kx .IP "\-s or \-\-squeeze-blank-lines"
5 kx Causes consecutive blank lines to be squeezed into a single blank line.
5 kx This is useful when viewing
5 kx .I nroff
5 kx output.
5 kx .IP "\-S or \-\-chop-long-lines"
5 kx Causes lines longer than the screen width to be
5 kx chopped (truncated) rather than wrapped.
5 kx That is, the portion of a long line that does not fit in
5 kx the screen width is not displayed until you press RIGHT-ARROW.
5 kx The default is to wrap long lines; that is, display the remainder
5 kx on the next line.
5 kx .IP "\-t\fItag\fP or \-\-tag=\fItag\fP"
5 kx The \-t option, followed immediately by a TAG,
5 kx will edit the file containing that tag.
5 kx For this to work, tag information must be available;
5 kx for example, there may be a file in the current directory called "tags",
5 kx which was previously built by
5 kx .IR ctags (1)
5 kx or an equivalent command.
5 kx If the environment variable LESSGLOBALTAGS is set, it is taken to be
5 kx the name of a command compatible with
5 kx .IR global (1),
5 kx and that command is executed to find the tag.
5 kx (See
5 kx .nh
5 kx http://www.gnu.org/software/global/global.html).
5 kx .hy
5 kx The \-t option may also be specified from within
5 kx .I less
5 kx (using the \- command) as a way of examining a new file.
5 kx The command ":t" is equivalent to specifying \-t from within
5 kx .IR less .
5 kx .IP "\-T\fItagsfile\fP or \-\-tag-file=\fItagsfile\fP"
5 kx Specifies a tags file to be used instead of "tags".
5 kx .IP "\-u or \-\-underline-special"
5 kx Causes backspaces and carriage returns to be treated as printable characters;
5 kx that is, they are sent to the terminal when they appear in the input.
5 kx .IP "\-U or \-\-UNDERLINE-SPECIAL"
5 kx Causes backspaces, tabs, carriage returns and "formatting characters"
5 kx (as defined by Unicode) to be treated as control characters;
5 kx that is, they are handled as specified by the \-r option.
5 kx .sp
5 kx By default, if neither \-u nor \-U is given,
5 kx backspaces which appear adjacent to an underscore character
5 kx are treated specially:
5 kx the underlined text is displayed
5 kx using the terminal's hardware underlining capability.
5 kx Also, backspaces which appear between two identical characters
5 kx are treated specially:
5 kx the overstruck text is printed
5 kx using the terminal's hardware boldface capability.
5 kx Other backspaces are deleted, along with the preceding character.
5 kx Carriage returns immediately followed by a newline are deleted.
5 kx Other carriage returns are handled as specified by the \-r option.
5 kx Unicode formatting characters, such as the Byte Order Mark,
5 kx are sent to the terminal.
5 kx Text which is overstruck or underlined can be searched for
5 kx if neither \-u nor \-U is in effect.
5 kx .IP "\-V or \-\-version"
5 kx Displays the version number of
5 kx .IR less .
5 kx .IP "\-w or \-\-hilite-unread"
5 kx Temporarily highlights the first "new" line after a forward movement
5 kx of a full page.
5 kx The first "new" line is the line immediately following the line previously
5 kx at the bottom of the screen.
5 kx Also highlights the target line after a g or p command.
5 kx The highlight is removed at the next command which causes movement.
5 kx The entire line is highlighted, unless the \-J option is in effect,
5 kx in which case only the status column is highlighted.
5 kx .IP "\-W or \-\-HILITE-UNREAD"
5 kx Like \-w, but temporarily highlights the first new line after any
5 kx forward movement command larger than one line.
5 kx .IP "\-x\fIn\fP,...\& or \-\-tabs=\fIn\fP,..."
5 kx Sets tab stops.
5 kx If only one \fIn\fP is specified, tab stops are set at multiples of \fIn\fP.
5 kx If multiple values separated by commas are specified, tab stops
5 kx are set at those positions, and then continue with the same spacing as the
5 kx last two.
5 kx For example, \fI\-x9,17\fP will set tabs at positions 9, 17, 25, 33, etc.
5 kx The default for \fIn\fP is 8.
5 kx .IP "\-X or \-\-no-init"
5 kx Disables sending the termcap initialization and deinitialization strings
5 kx to the terminal.
5 kx This is sometimes desirable if the deinitialization string does
5 kx something unnecessary, like clearing the screen.
5 kx .IP "\-y\fIn\fP or \-\-max-forw-scroll=\fIn\fP"
5 kx Specifies a maximum number of lines to scroll forward.
5 kx If it is necessary to scroll forward more than \fIn\fP lines,
5 kx the screen is repainted instead.
5 kx The \-c or \-C option may be used to repaint from the top of
5 kx the screen if desired.
5 kx By default, any forward movement causes scrolling.
5 kx .IP "\-z\fIn\fP or \-\-window=\fIn\fP or \-\fIn\fP"
5 kx Changes the default scrolling window size to \fIn\fP lines.
5 kx The default is one screenful.
5 kx The z and w commands can also be used to change the window size.
5 kx The "z" may be omitted for compatibility with some versions of
5 kx .IR more .
5 kx If the number
5 kx .I n
5 kx is negative, it indicates
5 kx .I n
5 kx lines less than the current screen size.
5 kx For example, if the screen is 24 lines, \fI\-z\-4\fP sets the
5 kx scrolling window to 20 lines. If the screen is resized to 40 lines,
5 kx the scrolling window automatically changes to 36 lines.
5 kx .IP "\-\(dq\fIcc\fP\ or\ \-\-quotes=\fIcc\fP"
5 kx Changes the filename quoting character.
5 kx This may be necessary if you are trying to name a file
5 kx which contains both spaces and quote characters.
5 kx Followed by a single character, this changes the quote character to that
5 kx character.
5 kx Filenames containing a space should then be surrounded by that character
5 kx rather than by double quotes.
5 kx Followed by two characters, changes the open quote to the first character,
5 kx and the close quote to the second character.
5 kx Filenames containing a space should then be preceded by the open quote
5 kx character and followed by the close quote character.
5 kx Note that even after the quote characters are changed, this option
5 kx remains \-" (a dash followed by a double quote).
5 kx .IP "\-~ or \-\-tilde"
5 kx Normally lines after end of file are displayed as a single tilde (~).
5 kx This option causes lines after end of file to be displayed as blank lines.
5 kx .IP "\-# or \-\-shift"
5 kx Specifies the default number of positions to scroll horizontally
5 kx in the RIGHTARROW and LEFTARROW commands.
5 kx If the number specified is zero, it sets the default number of
5 kx positions to one half of the screen width.
5 kx Alternately, the number may be specified as a fraction of the width
5 kx of the screen, starting with a decimal point: \&.5 is half of the
5 kx screen width, \&.3 is three tenths of the screen width, and so on.
5 kx If the number is specified as a fraction, the actual number of
5 kx scroll positions is recalculated if the terminal window is resized,
5 kx so that the actual scroll remains at the specified fraction
5 kx of the screen width.
5 kx .IP "\-\-follow-name"
5 kx Normally, if the input file is renamed while an F command is executing,
5 kx .I less
5 kx will continue to display the contents of the original file despite
5 kx its name change.
5 kx If \-\-follow-name is specified, during an F command
5 kx .I less
5 kx will periodically attempt to reopen the file by name.
5 kx If the reopen succeeds and the file is a different file from the original
5 kx (which means that a new file has been created
5 kx with the same name as the original (now renamed) file),
5 kx .I less
5 kx will display the contents of that new file.
5 kx .IP "\-\-incsearch"
5 kx Subsequent search commands will be "incremental"; that is,
5 kx .I less
5 kx will advance to the next line containing the search pattern
5 kx as each character of the pattern is typed in.
5 kx .IP "\-\-line-num-width"
5 kx Sets the minimum width of the line number field when the \-N option is in effect.
5 kx The default is 7 characters.
5 kx .IP "\-\-mouse"
5 kx Enables mouse input:
5 kx scrolling the mouse wheel down moves forward in the file,
5 kx scrolling the mouse wheel up moves backwards in the file,
5 kx and clicking the mouse sets the "#" mark to the line
5 kx where the mouse is clicked.
5 kx The number of lines to scroll when the wheel is moved
5 kx can be set by the \-\-wheel-lines option.
5 kx Mouse input works only on terminals which support X11 mouse reporting,
5 kx and on the Windows version of
5 kx .IR less .
5 kx .IP "\-\-MOUSE"
5 kx Like \-\-mouse, except the direction scrolled
5 kx on mouse wheel movement is reversed.
5 kx .IP "\-\-no-keypad"
5 kx Disables sending the keypad initialization and deinitialization strings
5 kx to the terminal.
5 kx This is sometimes useful if the keypad strings make the numeric
5 kx keypad behave in an undesirable manner.
5 kx .IP "\-\-no-histdups"
5 kx This option changes the behavior so that if a search string or
5 kx file name is typed in, and the same string is already in the history list,
5 kx the existing copy is removed from the history list before the new one is added.
5 kx Thus, a given string will appear only once in the history list.
5 kx Normally, a string may appear multiple times.
5 kx .IP "\-\-rscroll"
5 kx This option changes the character used to mark truncated lines.
5 kx It may begin with a two-character attribute indicator like LESSBINFMT does.
5 kx If there is no attribute indicator, standout is used.
5 kx If set to "\-", truncated lines are not marked.
5 kx .IP "\-\-save-marks"
5 kx Save marks in the history file, so marks are retained
5 kx across different invocations of
5 kx .IR less .
5 kx .IP "\-\-status-col-width"
5 kx Sets the width of the status column when the \-J option is in effect.
5 kx The default is 2 characters.
5 kx .IP "\-\-use-backslash"
5 kx This option changes the interpretations of options which follow this one.
5 kx After the \-\-use-backslash option, any backslash in an option string is
5 kx removed and the following character is taken literally.
5 kx This allows a dollar sign to be included in option strings.
5 kx .IP "\-\-use-color"
5 kx Enables the colored text in various places.
5 kx The -D option can be used to change the colors.
5 kx Colored text works only if the terminal supports
5 kx ANSI color escape sequences (as defined in ECMA-48 SGR;
5 kx see
5 kx .br
5 kx .nh
5 kx https://www.ecma-international.org/publications-and-standards/standards/ecma-48).
5 kx .hy
5 kx .IP "\-\-wheel-lines=\fIn\fP"
5 kx Set the number of lines to scroll when the mouse wheel is scrolled
5 kx and the \-\-mouse or \-\-MOUSE option is in effect.
5 kx The default is 1 line.
5 kx .IP \-\-
5 kx A command line argument of "\-\-" marks the end of option arguments.
5 kx Any arguments following this are interpreted as filenames.
5 kx This can be useful when viewing a file whose name begins with a "\-" or "+".
5 kx .IP +
5 kx If a command line option begins with \fB+\fP,
5 kx the remainder of that option is taken to be an initial command to
5 kx .IR less .
5 kx For example, +G tells
5 kx .I less
5 kx to start at the end of the file rather than the beginning,
5 kx and +/xyz tells it to start at the first occurrence of "xyz" in the file.
5 kx As a special case, +<number> acts like +<number>g;
5 kx that is, it starts the display at the specified line number
5 kx (however, see the caveat under the "g" command above).
5 kx If the option starts with ++, the initial command applies to
5 kx every file being viewed, not just the first one.
5 kx The + command described previously
5 kx may also be used to set (or change) an initial command for every file.
5 kx .
5 kx .SH "LINE EDITING"
5 kx When entering a command line at the bottom of the screen
5 kx (for example, a filename for the :e command,
5 kx or the pattern for a search command),
5 kx certain keys can be used to manipulate the command line.
5 kx Most commands have an alternate form in [ brackets ] which can be used if
5 kx a key does not exist on a particular keyboard.
5 kx (Note that the forms beginning with ESC do not work
5 kx in some MS-DOS and Windows systems because ESC is the line erase character.)
5 kx Any of these special keys may be entered literally by preceding
5 kx it with the "literal" character, either ^V or ^A.
5 kx A backslash itself may also be entered literally by entering two backslashes.
5 kx .IP "LEFTARROW [ ESC-h ]"
5 kx Move the cursor one space to the left.
5 kx .IP "RIGHTARROW [ ESC-l ]"
5 kx Move the cursor one space to the right.
5 kx .IP "^LEFTARROW [ ESC-b or ESC-LEFTARROW ]"
5 kx (That is, CONTROL and LEFTARROW simultaneously.)
5 kx Move the cursor one word to the left.
5 kx .IP "^RIGHTARROW [ ESC-w or ESC-RIGHTARROW ]"
5 kx (That is, CONTROL and RIGHTARROW simultaneously.)
5 kx Move the cursor one word to the right.
5 kx .IP "HOME [ ESC-0 ]"
5 kx Move the cursor to the beginning of the line.
5 kx .IP "END [ ESC-$ ]"
5 kx Move the cursor to the end of the line.
5 kx .IP "BACKSPACE"
5 kx Delete the character to the left of the cursor,
5 kx or cancel the command if the command line is empty.
5 kx .IP "DELETE or [ ESC-x ]"
5 kx Delete the character under the cursor.
5 kx .IP "^BACKSPACE [ ESC-BACKSPACE ]"
5 kx (That is, CONTROL and BACKSPACE simultaneously.)
5 kx Delete the word to the left of the cursor.
5 kx .IP "^DELETE [ ESC-X or ESC-DELETE ]"
5 kx (That is, CONTROL and DELETE simultaneously.)
5 kx Delete the word under the cursor.
5 kx .IP "UPARROW [ ESC-k ]"
5 kx Retrieve the previous command line.
5 kx If you first enter some text and then press UPARROW,
5 kx it will retrieve the previous command which begins with that text.
5 kx .IP "DOWNARROW [ ESC-j ]"
5 kx Retrieve the next command line.
5 kx If you first enter some text and then press DOWNARROW,
5 kx it will retrieve the next command which begins with that text.
5 kx .IP "TAB"
5 kx Complete the partial filename to the left of the cursor.
5 kx If it matches more than one filename, the first match
5 kx is entered into the command line.
5 kx Repeated TABs will cycle thru the other matching filenames.
5 kx If the completed filename is a directory, a "/" is appended to the filename.
5 kx (On MS-DOS systems, a "\e" is appended.)
5 kx The environment variable LESSSEPARATOR can be used to specify a
5 kx different character to append to a directory name.
5 kx .IP "BACKTAB [ ESC-TAB ]"
5 kx Like, TAB, but cycles in the reverse direction thru the matching filenames.
5 kx .IP "^L"
5 kx Complete the partial filename to the left of the cursor.
5 kx If it matches more than one filename, all matches are entered into
5 kx the command line (if they fit).
5 kx .IP "^U (Unix and OS/2) or ESC (MS-DOS)"
5 kx Delete the entire command line,
5 kx or cancel the command if the command line is empty.
5 kx If you have changed your line-kill character in Unix to something
5 kx other than ^U, that character is used instead of ^U.
5 kx .IP "^G"
5 kx Delete the entire command line and return to the main prompt.
5 kx .
5 kx .SH "KEY BINDINGS"
5 kx You may define your own
5 kx .I less
5 kx commands by using the program
5 kx .IR lesskey (1)
5 kx to create a lesskey file.
5 kx This file specifies a set of command keys and an action
5 kx associated with each key.
5 kx You may also use
5 kx .I lesskey
5 kx to change the line-editing keys (see LINE EDITING),
5 kx and to set environment variables.
5 kx If the environment variable LESSKEY is set,
5 kx .I less
5 kx uses that as the name of the lesskey file.
5 kx Otherwise,
5 kx .I less
5 kx looks in a standard place for the lesskey file:
5 kx On Unix systems,
5 kx .I less
5 kx looks for a lesskey file called "$HOME/.less".
5 kx On MS-DOS and Windows systems,
5 kx .I less
5 kx looks for a lesskey file called "$HOME/_less", and if it is not found there,
5 kx then looks for a lesskey file called "_less" in any directory specified
5 kx in the PATH environment variable.
5 kx On OS/2 systems,
5 kx .I less
5 kx looks for a lesskey file called "$HOME/less.ini", and if it is not found,
5 kx then looks for a lesskey file called "less.ini" in any directory specified
5 kx in the INIT environment variable, and if it not found there,
5 kx then looks for a lesskey file called "less.ini" in any directory specified
5 kx in the PATH environment variable.
5 kx See the
5 kx .I lesskey
5 kx manual page for more details.
5 kx .P
5 kx A system-wide lesskey file may also be set up to provide key bindings.
5 kx If a key is defined in both a local lesskey file and in the
5 kx system-wide file, key bindings in the local file take precedence over
5 kx those in the system-wide file.
5 kx If the environment variable LESSKEY_SYSTEM is set,
5 kx .I less
5 kx uses that as the name of the system-wide lesskey file.
5 kx Otherwise,
5 kx .I less
5 kx looks in a standard place for the system-wide lesskey file:
5 kx On Unix systems, the system-wide lesskey file is /etc/sysless.
5 kx (However, if
5 kx .I less
5 kx was built with a different sysconf directory than /etc,
5 kx that directory is where the sysless file is found.)
5 kx On MS-DOS and Windows systems, the system-wide lesskey file is c:\e_sysless.
5 kx On OS/2 systems, the system-wide lesskey file is c:\esysless.ini.
5 kx .
5 kx .SH "INPUT PREPROCESSOR"
5 kx You may define an "input preprocessor" for
5 kx .IR less .
5 kx Before
5 kx .I less
5 kx opens a file, it first gives your input preprocessor a chance to modify the
5 kx way the contents of the file are displayed.
5 kx An input preprocessor is simply an executable program (or shell script),
5 kx which writes the contents of the file to a different file,
5 kx called the replacement file.
5 kx The contents of the replacement file are then displayed
5 kx in place of the contents of the original file.
5 kx However, it will appear to the user as if the original file is opened;
5 kx that is,
5 kx .I less
5 kx will display the original filename as the name of the current file.
5 kx .PP
5 kx An input preprocessor receives one command line argument, the original filename,
5 kx as entered by the user.
5 kx It should create the replacement file, and when finished,
5 kx print the name of the replacement file to its standard output.
5 kx If the input preprocessor does not output a replacement filename,
5 kx .I less
5 kx uses the original file, as normal.
5 kx The input preprocessor is not called when viewing standard input.
5 kx To set up an input preprocessor, set the LESSOPEN environment variable
5 kx to a command line which will invoke your input preprocessor.
5 kx This command line should include one occurrence of the string "%s",
5 kx which will be replaced by the filename
5 kx when the input preprocessor command is invoked.
5 kx .PP
5 kx When
5 kx .I less
5 kx closes a file opened in such a way, it will call another program,
5 kx called the input postprocessor,
5 kx which may perform any desired clean-up action (such as deleting the
5 kx replacement file created by LESSOPEN).
5 kx This program receives two command line arguments, the original filename
5 kx as entered by the user, and the name of the replacement file.
5 kx To set up an input postprocessor, set the LESSCLOSE environment variable
5 kx to a command line which will invoke your input postprocessor.
5 kx It may include two occurrences of the string "%s";
5 kx the first is replaced with the original name of the file and
5 kx the second with the name of the replacement file,
5 kx which was output by LESSOPEN.
5 kx .PP
5 kx For example, on many Unix systems, these two scripts will allow you
5 kx to keep files in compressed format, but still let
5 kx .I less
5 kx view them directly:
5 kx .PP
5 kx lessopen.sh:
5 kx .br
5 kx #! /bin/sh
5 kx .br
5 kx case "$1" in
5 kx .br
5 kx *.Z) TEMPFILE=$(mktemp)
5 kx .br
5 kx uncompress \-c $1 >$TEMPFILE 2>/dev/null
5 kx .br
5 kx if [ \-s $TEMPFILE ]; then
5 kx .br
5 kx echo $TEMPFILE
5 kx .br
5 kx else
5 kx .br
5 kx rm \-f $TEMPFILE
5 kx .br
5 kx fi
5 kx .br
5 kx ;;
5 kx .br
5 kx esac
5 kx .PP
5 kx lessclose.sh:
5 kx .br
5 kx #! /bin/sh
5 kx .br
5 kx rm $2
5 kx .PP
5 kx To use these scripts, put them both where they can be executed and
5 kx set LESSOPEN="lessopen.sh\ %s", and
5 kx LESSCLOSE="lessclose.sh\ %s\ %s".
5 kx More complex LESSOPEN and LESSCLOSE scripts may be written
5 kx to accept other types of compressed files, and so on.
5 kx .PP
5 kx It is also possible to set up an input preprocessor to
5 kx pipe the file data directly to
5 kx .IR less ,
5 kx rather than putting the data into a replacement file.
5 kx This avoids the need to decompress the entire file before
5 kx starting to view it.
5 kx An input preprocessor that works this way is called an input pipe.
5 kx An input pipe, instead of writing the name of a replacement file on
5 kx its standard output,
5 kx writes the entire contents of the replacement file on its standard output.
5 kx If the input pipe does not write any characters on its standard output,
5 kx then there is no replacement file and
5 kx .I less
5 kx uses the original file, as normal.
5 kx To use an input pipe,
5 kx make the first character in the LESSOPEN environment variable a
5 kx vertical bar (|) to signify that the input preprocessor is an input pipe.
5 kx As with non-pipe input preprocessors, the command string must contain one
5 kx occurrence of %s, which is replaced with the filename of the input file.
5 kx .PP
5 kx For example, on many Unix systems, this script will work like the
5 kx previous example scripts:
5 kx .PP
5 kx lesspipe.sh:
5 kx .br
5 kx #! /bin/sh
5 kx .br
5 kx case "$1" in
5 kx .br
5 kx *.Z) uncompress \-c $1 2>/dev/null
5 kx .br
5 kx ;;
5 kx .br
5 kx *) exit 1
5 kx .br
5 kx ;;
5 kx .br
5 kx esac
5 kx .br
5 kx exit $?
5 kx .br
5 kx .PP
5 kx To use this script, put it where it can be executed and set
5 kx LESSOPEN="|lesspipe.sh %s".
5 kx .PP
5 kx Note that a preprocessor cannot output an empty file, since that
5 kx is interpreted as meaning there is no replacement, and
5 kx the original file is used.
5 kx To avoid this, if LESSOPEN starts with two vertical bars,
5 kx the exit status of the script becomes meaningful.
5 kx If the exit status is zero, the output is considered to be
5 kx replacement text, even if it is empty.
5 kx If the exit status is nonzero, any output is ignored and the
5 kx original file is used.
5 kx For compatibility with previous versions of
5 kx .IR less ,
5 kx if LESSOPEN starts with only one vertical bar, the exit status
5 kx of the preprocessor is ignored.
5 kx .PP
5 kx When an input pipe is used, a LESSCLOSE postprocessor can be used,
5 kx but it is usually not necessary since there is no replacement file
5 kx to clean up.
5 kx In this case, the replacement file name passed to the LESSCLOSE
5 kx postprocessor is "\-".
5 kx .PP
5 kx For compatibility with previous versions of
5 kx .IR less ,
5 kx the input preprocessor or pipe is not used if
5 kx .I less
5 kx is viewing standard input.
5 kx However, if the first character of LESSOPEN is a dash (\-),
5 kx the input preprocessor is used on standard input as well as other files.
5 kx In this case, the dash is not considered to be part of
5 kx the preprocessor command.
5 kx If standard input is being viewed, the input preprocessor is passed
5 kx a file name consisting of a single dash.
5 kx Similarly, if the first two characters of LESSOPEN are vertical bar and dash
5 kx (|\-) or two vertical bars and a dash (||\-),
5 kx the input pipe is used on standard input as well as other files.
5 kx Again, in this case the dash is not considered to be part of
5 kx the input pipe command.
5 kx .
5 kx .SH "NATIONAL CHARACTER SETS"
5 kx There are three types of characters in the input file:
5 kx .IP "normal characters"
5 kx can be displayed directly to the screen.
5 kx .IP "control characters"
5 kx should not be displayed directly, but are expected to be found
5 kx in ordinary text files (such as backspace and tab).
5 kx .IP "binary characters"
5 kx should not be displayed directly and are not expected to be found
5 kx in text files.
5 kx .PP
5 kx A "character set" is simply a description of which characters are to
5 kx be considered normal, control, and binary.
5 kx The LESSCHARSET environment variable may be used to select a character set.
5 kx Possible values for LESSCHARSET are:
5 kx .IP ascii
5 kx BS, TAB, NL, CR, and formfeed are control characters,
5 kx all chars with values between 32 and 126 are normal,
5 kx and all others are binary.
5 kx .IP iso8859
5 kx Selects an ISO 8859 character set.
5 kx This is the same as ASCII, except characters between 160 and 255 are
5 kx treated as normal characters.
5 kx .IP latin1
5 kx Same as iso8859.
5 kx .IP latin9
5 kx Same as iso8859.
5 kx .IP dos
5 kx Selects a character set appropriate for MS-DOS.
5 kx .IP ebcdic
5 kx Selects an EBCDIC character set.
5 kx .IP IBM-1047
5 kx Selects an EBCDIC character set used by OS/390 Unix Services.
5 kx This is the EBCDIC analogue of latin1. You get similar results
5 kx by setting either LESSCHARSET=IBM-1047 or LC_CTYPE=en_US
5 kx in your environment.
5 kx .IP koi8-r
5 kx Selects a Russian character set.
5 kx .IP next
5 kx Selects a character set appropriate for NeXT computers.
5 kx .IP utf-8
5 kx Selects the UTF-8 encoding of the ISO 10646 character set.
5 kx UTF-8 is special in that it supports multi-byte characters in the input file.
5 kx It is the only character set that supports multi-byte characters.
5 kx .IP windows
5 kx Selects a character set appropriate for Microsoft Windows (cp 1251).
5 kx .PP
5 kx In rare cases, it may be desired to tailor
5 kx .I less
5 kx to use a character set other than the ones definable by LESSCHARSET.
5 kx In this case, the environment variable LESSCHARDEF can be used
5 kx to define a character set.
5 kx It should be set to a string where each character in the string represents
5 kx one character in the character set.
5 kx The character ".\&" is used for a normal character, "c" for control,
5 kx and "b" for binary.
5 kx A decimal number may be used for repetition.
5 kx For example, "bccc4b.\&" would mean character 0 is binary,
5 kx 1, 2 and 3 are control, 4, 5, 6 and 7 are binary, and 8 is normal.
5 kx All characters after the last are taken to be the same as the last,
5 kx so characters 9 through 255 would be normal.
5 kx (This is an example, and does not necessarily
5 kx represent any real character set.)
5 kx .PP
5 kx This table shows the value of LESSCHARDEF which is equivalent
5 kx to each of the possible values for LESSCHARSET:
5 kx .
5 kx .RS 5m
5 kx .TS
5 kx l l.
5 kx ascii 8bcccbcc18b95.b
5 kx dos 8bcccbcc12bc5b95.b.
5 kx ebcdic 5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b
5 kx 9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b.
5 kx IBM-1047 4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc
5 kx 191.b
5 kx iso8859 8bcccbcc18b95.33b.
5 kx koi8-r 8bcccbcc18b95.b128.
5 kx latin1 8bcccbcc18b95.33b.
5 kx next 8bcccbcc18b95.bb125.bb
5 kx .TE
5 kx .RE
5 kx .PP
5 kx If neither LESSCHARSET nor LESSCHARDEF is set,
5 kx but any of the strings "UTF-8", "UTF8", "utf-8" or "utf8"
5 kx is found in the LC_ALL, LC_CTYPE or LANG
5 kx environment variables, then the default character set is utf-8.
5 kx .PP
5 kx If that string is not found, but your system supports the
5 kx .I setlocale
5 kx interface,
5 kx .I less
5 kx will use setlocale to determine the character set.
5 kx setlocale is controlled by setting the LANG or LC_CTYPE environment
5 kx variables.
5 kx .PP
5 kx Finally, if the
5 kx .I setlocale
5 kx interface is also not available, the default character set is latin1.
5 kx .PP
5 kx Control and binary characters are displayed in standout (reverse video).
5 kx Each such character is displayed in caret notation if possible
5 kx (e.g.\& ^A for control-A). Caret notation is used only if
5 kx inverting the 0100 bit results in a normal printable character.
5 kx Otherwise, the character is displayed as a hex number in angle brackets.
5 kx This format can be changed by
5 kx setting the LESSBINFMT environment variable.
5 kx LESSBINFMT may begin with a "*" and one character to select
5 kx the display attribute:
5 kx "*k" is blinking, "*d" is bold, "*u" is underlined, "*s" is standout,
5 kx and "*n" is normal.
5 kx If LESSBINFMT does not begin with a "*", normal attribute is assumed.
5 kx The remainder of LESSBINFMT is a string which may include one
5 kx printf-style escape sequence (a % followed by x, X, o, d, etc.).
5 kx For example, if LESSBINFMT is "*u[%x]", binary characters
5 kx are displayed in underlined hexadecimal surrounded by brackets.
5 kx The default if no LESSBINFMT is specified is "*s<%02X>".
5 kx Warning: the result of expanding the character via LESSBINFMT must
5 kx be less than 31 characters.
5 kx .PP
5 kx When the character set is utf-8, the LESSUTFBINFMT environment variable
5 kx acts similarly to LESSBINFMT but it applies to Unicode code points
5 kx that were successfully decoded but are unsuitable for display (e.g.,
5 kx unassigned code points).
5 kx Its default value is "<U+%04lX>".
5 kx Note that LESSUTFBINFMT and LESSBINFMT share their display attribute
5 kx setting ("*x") so specifying one will affect both;
5 kx LESSUTFBINFMT is read after LESSBINFMT so its setting, if any,
5 kx will have priority.
5 kx Problematic octets in a UTF-8 file (octets of a truncated sequence,
5 kx octets of a complete but non-shortest form sequence, invalid octets,
5 kx and stray trailing octets)
5 kx are displayed individually using LESSBINFMT so as to facilitate diagnostic
5 kx of how the UTF-8 file is ill-formed.
5 kx .
5 kx .SH "PROMPTS"
5 kx The \-P option allows you to tailor the prompt to your preference.
5 kx The string given to the \-P option replaces the specified prompt string.
5 kx Certain characters in the string are interpreted specially.
5 kx The prompt mechanism is rather complicated to provide flexibility,
5 kx but the ordinary user need not understand the details of constructing
5 kx personalized prompt strings.
5 kx .sp
5 kx A percent sign followed by a single character is expanded
5 kx according to what the following character is:
5 kx .IP "%b\fIX\fP"
5 kx Replaced by the byte offset into the current input file.
5 kx The b is followed by a single character (shown as \fIX\fP above)
5 kx which specifies the line whose byte offset is to be used.
5 kx If the character is a "t", the byte offset of the top line in the
5 kx display is used,
5 kx an "m" means use the middle line,
5 kx a "b" means use the bottom line,
5 kx a "B" means use the line just after the bottom line,
5 kx and a "j" means use the "target" line, as specified by the \-j option.
5 kx .IP "%B"
5 kx Replaced by the size of the current input file.
5 kx .IP "%c"
5 kx Replaced by the column number of the text appearing in the first
5 kx column of the screen.
5 kx .IP "%d\fIX\fP"
5 kx Replaced by the page number of a line in the input file.
5 kx The line to be used is determined by the \fIX\fP, as with the %b option.
5 kx .IP "%D"
5 kx Replaced by the number of pages in the input file,
5 kx or equivalently, the page number of the last line in the input file.
5 kx .IP "%E"
5 kx Replaced by the name of the editor (from the VISUAL environment variable,
5 kx or the EDITOR environment variable if VISUAL is not defined).
5 kx See the discussion of the LESSEDIT feature below.
5 kx .IP "%f"
5 kx Replaced by the name of the current input file.
5 kx .IP "%F"
5 kx Replaced by the last component of the name of the current input file.
5 kx .IP "%g"
5 kx Replaced by the shell-escaped name of the current input file.
5 kx This is useful when the expanded string will be used in a shell command,
5 kx such as in LESSEDIT.
5 kx .IP "%i"
5 kx Replaced by the index of the current file in the list of
5 kx input files.
5 kx .IP "%l\fIX\fP"
5 kx Replaced by the line number of a line in the input file.
5 kx The line to be used is determined by the \fIX\fP, as with the %b option.
5 kx .IP "%L"
5 kx Replaced by the line number of the last line in the input file.
5 kx .IP "%m"
5 kx Replaced by the total number of input files.
5 kx .IP "%p\fIX\fP"
5 kx Replaced by the percent into the current input file, based on byte offsets.
5 kx The line used is determined by the \fIX\fP as with the %b option.
5 kx .IP "%P\fIX\fP"
5 kx Replaced by the percent into the current input file, based on line numbers.
5 kx The line used is determined by the \fIX\fP as with the %b option.
5 kx .IP "%s"
5 kx Same as %B.
5 kx .IP "%t"
5 kx Causes any trailing spaces to be removed.
5 kx Usually used at the end of the string, but may appear anywhere.
5 kx .IP "%T"
5 kx Normally expands to the word "file".
5 kx However if viewing files via a tags list using the \-t option,
5 kx it expands to the word "tag".
5 kx .IP "%x"
5 kx Replaced by the name of the next input file in the list.
5 kx .PP
5 kx If any item is unknown (for example, the file size if input
5 kx is a pipe), a question mark is printed instead.
5 kx .PP
5 kx The format of the prompt string can be changed
5 kx depending on certain conditions.
5 kx A question mark followed by a single character acts like an "IF":
5 kx depending on the following character, a condition is evaluated.
5 kx If the condition is true, any characters following the question mark
5 kx and condition character, up to a period, are included in the prompt.
5 kx If the condition is false, such characters are not included.
5 kx A colon appearing between the question mark and the
5 kx period can be used to establish an "ELSE": any characters between
5 kx the colon and the period are included in the string if and only if
5 kx the IF condition is false.
5 kx Condition characters (which follow a question mark) may be:
5 kx .IP "?a"
5 kx True if any characters have been included in the prompt so far.
5 kx .IP "?b\fIX\fP"
5 kx True if the byte offset of the specified line is known.
5 kx .IP "?B"
5 kx True if the size of current input file is known.
5 kx .IP "?c"
5 kx True if the text is horizontally shifted (%c is not zero).
5 kx .IP "?d\fIX\fP"
5 kx True if the page number of the specified line is known.
5 kx .IP "?e"
5 kx True if at end-of-file.
5 kx .IP "?f"
5 kx True if there is an input filename
5 kx (that is, if input is not a pipe).
5 kx .IP "?l\fIX\fP"
5 kx True if the line number of the specified line is known.
5 kx .IP "?L"
5 kx True if the line number of the last line in the file is known.
5 kx .IP "?m"
5 kx True if there is more than one input file.
5 kx .IP "?n"
5 kx True if this is the first prompt in a new input file.
5 kx .IP "?p\fIX\fP"
5 kx True if the percent into the current input file, based on byte offsets,
5 kx of the specified line is known.
5 kx .IP "?P\fIX\fP"
5 kx True if the percent into the current input file, based on line numbers,
5 kx of the specified line is known.
5 kx .IP "?s"
5 kx Same as "?B".
5 kx .IP "?x"
5 kx True if there is a next input file
5 kx (that is, if the current input file is not the last one).
5 kx .PP
5 kx Any characters other than the special ones
5 kx (question mark, colon, period, percent, and backslash)
5 kx become literally part of the prompt.
5 kx Any of the special characters may be included in the prompt literally
5 kx by preceding it with a backslash.
5 kx .PP
5 kx Some examples:
5 kx .sp
5 kx ?f%f:Standard input.
5 kx .sp
5 kx This prompt prints the filename, if known;
5 kx otherwise the string "Standard input".
5 kx .sp
5 kx ?f%f \&.?ltLine %lt:?pt%pt\e%:?btByte %bt:-...
5 kx .sp
5 kx This prompt would print the filename, if known.
5 kx The filename is followed by the line number, if known,
5 kx otherwise the percent if known, otherwise the byte offset if known.
5 kx Otherwise, a dash is printed.
5 kx Notice how each question mark has a matching period,
5 kx and how the % after the %pt
5 kx is included literally by escaping it with a backslash.
5 kx .sp
5 kx ?n?f%f\ .?m(%T %i of %m)\ ..?e(END)\ ?x-\ Next\e:\ %x..%t";
5 kx .sp
5 kx This prints the filename if this is the first prompt in a file,
5 kx followed by the "file N of N" message if there is more
5 kx than one input file.
5 kx Then, if we are at end-of-file, the string "(END)" is printed
5 kx followed by the name of the next file, if there is one.
5 kx Finally, any trailing spaces are truncated.
5 kx This is the default prompt.
5 kx For reference, here are the defaults for
5 kx the other two prompts (\-m and \-M respectively).
5 kx Each is broken into two lines here for readability only.
5 kx .nf
5 kx .sp
5 kx ?n?f%f\ .?m(%T\ %i\ of\ %m)\ ..?e(END)\ ?x-\ Next\e:\ %x.:
5 kx ?pB%pB\e%:byte\ %bB?s/%s...%t
5 kx .sp
5 kx ?f%f\ .?n?m(%T\ %i\ of\ %m)\ ..?ltlines\ %lt-%lb?L/%L.\ :
5 kx byte\ %bB?s/%s.\ .?e(END)\ ?x-\ Next\e:\ %x.:?pB%pB\e%..%t
5 kx .sp
5 kx .fi
5 kx And here is the default message produced by the = command:
5 kx .nf
5 kx .sp
5 kx ?f%f\ .?m(%T\ %i\ of\ %m)\ .?ltlines\ %lt-%lb?L/%L.\ .
5 kx byte\ %bB?s/%s.\ ?e(END)\ :?pB%pB\e%..%t
5 kx .fi
5 kx .PP
5 kx The prompt expansion features are also used for another purpose:
5 kx if an environment variable LESSEDIT is defined, it is used
5 kx as the command to be executed when the v command is invoked.
5 kx The LESSEDIT string is expanded in the same way as the prompt strings.
5 kx The default value for LESSEDIT is:
5 kx .nf
5 kx .sp
5 kx %E\ ?lm+%lm.\ %g
5 kx .sp
5 kx .fi
5 kx Note that this expands to the editor name, followed by a + and the
5 kx line number, followed by the shell-escaped file name.
5 kx If your editor does not accept the "+linenumber" syntax, or has other
5 kx differences in invocation syntax, the LESSEDIT variable can be
5 kx changed to modify this default.
5 kx .
5 kx .SH SECURITY
5 kx When the environment variable LESSSECURE is set to 1,
5 kx .I less
5 kx runs in a "secure" mode.
5 kx This means these features are disabled:
5 kx .RS
5 kx .IP "!"
5 kx the shell command
5 kx .IP "|"
5 kx the pipe command
5 kx .IP ":e"
5 kx the examine command.
5 kx .IP "v"
5 kx the editing command
5 kx .IP "s \-o"
5 kx log files
5 kx .IP "\-k"
5 kx use of lesskey files
5 kx .IP "\-t"
5 kx use of tags files
5 kx .IP
5 kx metacharacters in filenames, such as *
5 kx .IP
5 kx filename completion (TAB, ^L)
5 kx .RE
5 kx .PP
5 kx Less can also be compiled to be permanently in "secure" mode.
5 kx .
5 kx .SH "COMPATIBILITY WITH MORE"
5 kx If the environment variable LESS_IS_MORE is set to 1,
5 kx or if the program is invoked via a file link named "more",
5 kx .I less
5 kx behaves (mostly) in conformance with the POSIX "more" command specification.
5 kx In this mode, less behaves differently in these ways:
5 kx .PP
5 kx The \-e option works differently.
5 kx If the \-e option is not set,
5 kx .I less
5 kx behaves as if the \-e option were set.
5 kx If the \-e option is set,
5 kx .I less
5 kx behaves as if the \-E option were set.
5 kx .PP
5 kx The \-m option works differently.
5 kx If the \-m option is not set, the medium prompt is used,
5 kx and it is prefixed with the string "\-\-More\-\-".
5 kx If the \-m option is set, the short prompt is used.
5 kx .PP
5 kx The \-n option acts like the \-z option.
5 kx The normal behavior of the \-n option is unavailable in this mode.
5 kx .PP
5 kx The parameter to the \-p option is taken to be a
5 kx .I less
5 kx command rather than a search pattern.
5 kx .PP
5 kx The LESS environment variable is ignored,
5 kx and the MORE environment variable is used in its place.
5 kx .
5 kx .SH "ENVIRONMENT VARIABLES"
5 kx Environment variables may be specified either in the system environment
5 kx as usual, or in a
5 kx .IR lesskey (1)
5 kx file.
5 kx If environment variables are defined in more than one place,
5 kx variables defined in a local lesskey file take precedence over
5 kx variables defined in the system environment, which take precedence
5 kx over variables defined in the system-wide lesskey file.
5 kx .IP COLUMNS
5 kx Sets the number of columns on the screen.
5 kx Takes precedence over the number of columns specified by the TERM variable.
5 kx (But if you have a windowing system which supports TIOCGWINSZ or WIOCGETD,
5 kx the window system's idea of the screen size takes precedence over the
5 kx LINES and COLUMNS environment variables.)
5 kx .IP EDITOR
5 kx The name of the editor (used for the v command).
5 kx .IP HOME
5 kx Name of the user's home directory
5 kx (used to find a lesskey file on Unix and OS/2 systems).
5 kx .IP "HOMEDRIVE, HOMEPATH"
5 kx Concatenation of the HOMEDRIVE and HOMEPATH environment variables is
5 kx the name of the user's home directory if the HOME variable is not set
5 kx (only in the Windows version).
5 kx .IP INIT
5 kx Name of the user's init directory (used to find a lesskey file on OS/2 systems).
5 kx .IP LANG
5 kx Language for determining the character set.
5 kx .IP LC_CTYPE
5 kx Language for determining the character set.
5 kx .IP LESS
5 kx Options which are passed to
5 kx .I less
5 kx automatically.
5 kx .IP LESSANSIENDCHARS
5 kx Characters which may end an ANSI color escape sequence
5 kx (default "m").
5 kx .IP LESSANSIMIDCHARS
5 kx Characters which may appear between the ESC character and the
5 kx end character in an ANSI color escape sequence
5 kx (default "0123456789:;[?!"'#%()*+\ ".
5 kx .IP LESSBINFMT
5 kx Format for displaying non-printable, non-control characters.
5 kx .IP LESSCHARDEF
5 kx Defines a character set.
5 kx .IP LESSCHARSET
5 kx Selects a predefined character set.
5 kx .IP LESSCLOSE
5 kx Command line to invoke the (optional) input-postprocessor.
5 kx .IP LESSECHO
5 kx Name of the lessecho program (default "lessecho").
5 kx The lessecho program is needed to expand metacharacters, such as * and ?,
5 kx in filenames on Unix systems.
5 kx .IP LESSEDIT
5 kx Editor prototype string (used for the v command).
5 kx See discussion under PROMPTS.
5 kx .IP LESSGLOBALTAGS
5 kx Name of the command used by the \-t option to find global tags.
5 kx Normally should be set to "global" if your system has the
5 kx .IR global (1)
5 kx command. If not set, global tags are not used.
5 kx .IP LESSHISTFILE
5 kx Name of the history file used to remember search commands and
5 kx shell commands between invocations of
5 kx .IR less .
5 kx If set to "\-" or "/dev/null", a history file is not used.
5 kx The default is "$HOME/.lesshst" on Unix systems, "$HOME/_lesshst" on
5 kx DOS and Windows systems, or "$HOME/lesshst.ini" or "$INIT/lesshst.ini"
5 kx on OS/2 systems.
5 kx .IP LESSHISTSIZE
5 kx The maximum number of commands to save in the history file.
5 kx The default is 100.
5 kx .IP LESSKEY
5 kx Name of the default
5 kx .IR lesskey (1)
5 kx file.
5 kx .IP LESSKEY_SYSTEM
5 kx Name of the default system-wide
5 kx .IR lesskey (1)
5 kx file.
5 kx .IP LESSMETACHARS
5 kx List of characters which are considered "metacharacters" by the shell.
5 kx .IP LESSMETAESCAPE
5 kx Prefix which less will add before each metacharacter in a
5 kx command sent to the shell.
5 kx If LESSMETAESCAPE is an empty string, commands containing
5 kx metacharacters will not be passed to the shell.
5 kx .IP LESSOPEN
5 kx Command line to invoke the (optional) input-preprocessor.
5 kx .IP LESSSECURE
5 kx Runs less in "secure" mode.
5 kx See discussion under SECURITY.
5 kx .IP LESSSEPARATOR
5 kx String to be appended to a directory name in filename completion.
5 kx .IP LESSUTFBINFMT
5 kx Format for displaying non-printable Unicode code points.
5 kx .IP LESS_IS_MORE
5 kx Emulate the
5 kx .IR more (1)
5 kx command.
5 kx .IP LINES
5 kx Sets the number of lines on the screen.
5 kx Takes precedence over the number of lines specified by the TERM variable.
5 kx (But if you have a windowing system which supports TIOCGWINSZ or WIOCGETD,
5 kx the window system's idea of the screen size takes precedence over the
5 kx LINES and COLUMNS environment variables.)
5 kx .IP MORE
5 kx Options which are passed to
5 kx .I less
5 kx automatically when running in
5 kx .I more
5 kx compatible mode.
5 kx .IP PATH
5 kx User's search path (used to find a lesskey file
5 kx on MS-DOS and OS/2 systems).
5 kx .IP SHELL
5 kx The shell used to execute the !\& command, as well as to expand filenames.
5 kx .IP TERM
5 kx The type of terminal on which
5 kx .I less
5 kx is being run.
5 kx .IP VISUAL
5 kx The name of the editor (used for the v command).
5 kx .
5 kx .SH "SEE ALSO"
5 kx .BR lesskey (1)
5 kx .
5 kx .SH COPYRIGHT
5 kx Copyright (C) 1984-2021 Mark Nudelman
5 kx .PP
5 kx less is part of the GNU project and is free software.
5 kx You can redistribute it and/or modify it
5 kx under the terms of either
5 kx (1) the GNU General Public License as published by
5 kx the Free Software Foundation; or (2) the Less License.
5 kx See the file README in the less distribution for more details
5 kx regarding redistribution.
5 kx You should have received a copy of the GNU General Public License
5 kx along with the source for less; see the file COPYING.
5 kx If not, write to the Free Software Foundation, 59 Temple Place,
5 kx Suite 330, Boston, MA 02111-1307, USA.
5 kx You should also have received a copy of the Less License;
5 kx see the file LICENSE.
5 kx .PP
5 kx less is distributed in the hope that it will be useful, but
5 kx WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
5 kx or FITNESS FOR A PARTICULAR PURPOSE.
5 kx See the GNU General Public License for more details.
5 kx .
5 kx .SH AUTHOR
5 kx .
5 kx Mark Nudelman
5 kx .br
5 kx Report bugs at https://github.com/gwsw/less/issues.
5 kx .br
5 kx For more information, see the less homepage at
5 kx .br
5 kx https://greenwoodsoftware.com/less.