2 .TH LESS 1 "Version 661: 29 Jun 2024"
4 less \- display the contents of a file in a terminal
14 .B "less [\-[+]aABcCdeEfFgGiIJKLmMnNqQrRsSuUVwWX\(ti]"
16 .B " [\-b \fIspace\/\fP] [\-h \fIlines\/\fP] [\-j \fIline\/\fP] [\-k \fIkeyfile\/\fP]"
18 .B " [\-{oO} \fIlogfile\/\fP] [\-p \fIpattern\/\fP] [\-P \fIprompt\/\fP] [\-t \fItag\/\fP]"
20 .B " [\-T \fItagsfile\/\fP] [\-x \fItab\/\fP,...] [\-y \fIlines\/\fP] [\-[z] \fIlines\/\fP]"
22 .B " [\-# \fIshift\/\fP] [+[+]\fIcmd\/\fP] [\-\-] [\fIfilename\/\fP]..."
24 (See the OPTIONS section for alternate option syntax with long option names.)
28 is a program similar to
30 but it has many more features.
32 does not have to read the entire input file before starting,
33 so with large input files it starts up faster than text editors like
36 uses termcap (or terminfo on some systems),
37 so it can run on a variety of terminals.
38 There is even limited support for hardcopy terminals.
39 (On a hardcopy terminal, lines which should be printed at the top
40 of the screen are prefixed with a caret.)
42 Commands are based on both
46 Commands may be preceded by a decimal number,
47 called N in the descriptions below.
48 The number is used by some commands, as indicated.
51 In the following descriptions, \(haX means control-X.
52 ESC stands for the ESCAPE key; for example ESC-v means the
53 two character sequence "ESCAPE", then "v".
55 Help: display a summary of these commands.
56 If you forget all the other commands, remember this one.
57 .IP "SPACE or \(haV or f or \(haF"
58 Scroll forward N lines, default one window (see option \-z below).
59 If N is more than the screen size, only the final screenful is displayed.
60 Warning: some systems use \(haV as a special literalization character.
62 Like SPACE, but if N is specified, it becomes the new window size.
64 Like SPACE, but scrolls a full screenful, even if it reaches
65 end-of-file in the process.
66 .IP "ENTER or RETURN or \(haN or e or \(haE or j or \(haJ"
67 Scroll forward N lines, default 1.
68 The entire N lines are displayed, even if N is more than the screen size.
70 Scroll forward N lines, default one half of the screen size.
71 If N is specified, it becomes the new default for
72 subsequent d and u commands.
73 .IP "b or \(haB or ESC-v"
74 Scroll backward N lines, default one window (see option \-z below).
75 If N is more than the screen size, only the final screenful is displayed.
77 Like ESC-v, but if N is specified, it becomes the new window size.
78 .IP "y or \(haY or \(haP or k or \(haK"
79 Scroll backward N lines, default 1.
80 The entire N lines are displayed, even if N is more than the screen size.
81 Warning: some systems use \(haY as a special job control character.
83 Scroll backward N lines, default one half of the screen size.
84 If N is specified, it becomes the new default for
85 subsequent d and u commands.
87 Like j, but continues to scroll beyond the end of the file.
89 Like k, but continues to scroll beyond the beginning of the file.
90 .IP "ESC-) or RIGHTARROW"
91 Scroll horizontally right N characters, default half the screen width
93 If a number N is specified, it becomes the default for future RIGHTARROW
94 and LEFTARROW commands.
95 While the text is scrolled, it acts as though the \-S option
96 (chop lines) were in effect.
97 .IP "ESC-( or LEFTARROW"
98 Scroll horizontally left N characters, default half the screen width
100 If a number N is specified, it becomes the default for future RIGHTARROW
101 and LEFTARROW commands.
102 .IP "ESC-} or \(haRIGHTARROW"
103 Scroll horizontally right to show the end of the longest displayed line.
104 .IP "ESC-{ or \(haLEFTARROW"
105 Scroll horizontally left back to the first column.
106 .IP "r or \(haR or \(haL"
109 Repaint the screen, discarding any buffered input.
110 That is, reload the current file.
111 Useful if the file is changing while it is being viewed.
113 Scroll forward, and keep trying to read when the
114 end of file is reached.
115 Normally this command would be used when already at the end of the file.
116 It is a way to monitor the tail of a file which is growing
117 while it is being viewed.
118 (The behavior is similar to the "tail \-f" command.)
119 To stop waiting for more data, enter the interrupt character (usually \(haC).
120 On systems which support
122 you can also use \(haX or the character specified by the \-\-intr option.
123 If the input is a pipe and the \-\-exit-follow-on-close option is in effect,
125 will automatically stop waiting for data when the input side
126 of the pipe is closed.
128 Like F, but as soon as a line is found which matches
129 the last search pattern, the terminal bell is rung
130 and forward scrolling stops.
131 .IP "g or < or ESC-<"
132 Go to line N in the file, default 1 (beginning of file).
133 (Warning: this may be slow if N is large.)
134 .IP "G or > or ESC->"
135 Go to line N in the file, default the end of the file.
136 (Warning: this may be slow if N is large,
137 or if N is not specified and
138 standard input, rather than a file, is being read.)
140 Same as G, except if no number N is specified and the input is standard input,
141 goes to the last line which is currently buffered.
143 Go to a position N percent into the file.
144 N should be between 0 and 100, and may contain a decimal point.
146 Go to the line containing byte offset N in the file.
148 If a left curly bracket appears in the top line displayed
150 the { command will go to the matching right curly bracket.
151 The matching right curly bracket is positioned on the bottom
153 If there is more than one left curly bracket on the top line,
154 a number N may be used to specify the N-th bracket on the line.
156 If a right curly bracket appears in the bottom line displayed
158 the } command will go to the matching left curly bracket.
159 The matching left curly bracket is positioned on the top
161 If there is more than one right curly bracket on the bottom line,
162 a number N may be used to specify the N-th bracket on the line.
164 Like {, but applies to parentheses rather than curly brackets.
166 Like }, but applies to parentheses rather than curly brackets.
168 Like {, but applies to square brackets rather than curly brackets.
170 Like }, but applies to square brackets rather than curly brackets.
172 Followed by two characters,
173 acts like {, but uses the two characters as open and close brackets,
175 For example, "ESC \(haF < >" could be used to
176 go forward to the > which matches the < in the top displayed line.
178 Followed by two characters,
179 acts like }, but uses the two characters as open and close brackets,
181 For example, "ESC \(haB < >" could be used to
182 go backward to the < which matches the > in the bottom displayed line.
184 Followed by any lowercase or uppercase letter,
185 marks the first displayed line with that letter.
186 If the status column is enabled via the \-J option,
187 the status column shows the marked line.
189 Acts like m, except the last displayed line is marked
190 rather than the first displayed line.
193 Followed by any lowercase or uppercase letter, returns to the position which
194 was previously marked with that letter.
195 Followed by another single quote, returns to the position at
196 which the last "large" movement command was executed.
197 Followed by a \(ha or $, jumps to the beginning or end of the
199 Marks are preserved when a new file is examined,
200 so the \(aq command can be used to switch between input files.
202 Same as single quote.
204 Followed by any lowercase or uppercase letter,
205 clears the mark identified by that letter.
207 Search forward in the file for the N-th line containing the pattern.
209 The pattern is a regular expression, as recognized by
210 the regular expression library supplied by your system.
211 By default, searching is case-sensitive (uppercase and lowercase
212 are considered different); the \-i option can be used to change this.
213 The search starts at the first line displayed
214 (but see the \-a and \-j options, which change this).
216 Certain characters are special
217 if entered at the beginning of the pattern;
218 they modify the type of search rather than become part of the pattern:
221 Search for lines which do NOT match the pattern.
223 Search multiple files.
224 That is, if the search reaches the END of the current file
225 without finding a match,
226 the search continues in the next file in the command line list.
228 Begin the search at the first line of the FIRST file
229 in the command line list,
230 regardless of what is currently displayed on the screen
231 or the settings of the \-a or \-j options.
233 Highlight any text which matches the pattern on the current screen,
234 but don't move to the first match (KEEP current position).
236 Don't interpret regular expression metacharacters;
237 that is, do a simple textual comparison.
239 Followed by a digit N between 1 and 5.
240 Only text which has a non-empty match for the N-th parenthesized SUB-PATTERN
241 will be considered to match the pattern.
244 is built with one of the regular expression libraries
245 .BR posix ", " pcre ", or " pcre2 ".)"
246 Multiple \(haS modifiers can be specified,
247 to match more than one sub-pattern.
249 WRAP around the current file.
250 That is, if the search reaches the end of the current file
251 without finding a match, the search continues from the first line of the
252 current file up to the line where it started.
253 If the \(haW modifier is set, the \(haE modifier is ignored.
255 The next character is taken literally; that is, it becomes part of the pattern
256 even if it is one of the above search modifier characters.
259 Search backward in the file for the N-th line containing the pattern.
260 The search starts at the last line displayed
261 (but see the \-a and \-j options, which change this).
263 Certain characters are special as in the / command:
266 Search for lines which do NOT match the pattern.
268 Search multiple files.
269 That is, if the search reaches the beginning of the current file
270 without finding a match,
271 the search continues in the previous file in the command line list.
273 Begin the search at the last line of the last file
274 in the command line list,
275 regardless of what is currently displayed on the screen
276 or the settings of the \-a or \-j options.
278 As in forward searches.
280 As in forward searches.
282 As in forward searches.
284 WRAP around the current file.
285 That is, if the search reaches the beginning of the current file
286 without finding a match, the search continues from the last line of the
287 current file up to the line where it started.
294 Repeat previous search, for N-th line containing the last pattern.
295 If the previous search was modified by \(haN, the search is made for the
296 N-th line NOT containing the pattern.
297 If the previous search was modified by \(haE, the search continues
298 in the next (or previous) file if not satisfied in the current file.
299 If the previous search was modified by \(haR, the search is done
300 without using regular expressions.
301 There is no effect if the previous search was modified by \(haF or \(haK.
303 Repeat previous search, but in the reverse direction.
305 Repeat previous search, but crossing file boundaries.
306 The effect is as if the previous search were modified by *.
308 Repeat previous search, but in the reverse direction
309 and crossing file boundaries.
311 Undo search highlighting.
312 Turn off highlighting of strings matching the current search pattern.
313 If highlighting is already off because of a previous ESC-u command,
314 turn highlighting back on.
315 Any search command will also turn highlighting back on.
316 (Highlighting can also be disabled by toggling the \-G option;
317 in that case search commands do not turn highlighting back on.)
319 Like ESC-u but also clears the saved search pattern.
320 If the status column is enabled via the \-J option,
321 this clears all search matches marked in the status column.
323 Display only lines which match the pattern;
324 lines which do not match the pattern are not displayed.
325 If pattern is empty (if you type & immediately followed by ENTER),
326 any filtering is turned off, and all lines are displayed.
327 While filtering is in effect, an ampersand is displayed at the
328 beginning of the prompt,
329 as a reminder that some lines in the file may be hidden.
330 Multiple & commands may be entered, in which case only lines
331 which match all of the patterns will be displayed.
333 Certain characters are special as in the / command:
336 Display only lines which do NOT match the pattern.
338 Don't interpret regular expression metacharacters;
339 that is, do a simple textual comparison.
343 If the filename is missing, the "current" file (see the :n and :p commands
344 below) from the list of files in the command line is re-examined.
345 A percent sign (%) in the filename is replaced by the name of the
347 A pound sign (#) is replaced by the name of the previously examined file.
348 However, two consecutive percent signs are simply
349 replaced with a single percent sign.
350 This allows you to enter a filename that contains a percent sign
352 Similarly, two consecutive pound signs are replaced with a single pound sign.
353 The filename is inserted into the command line list of files
354 so that it can be seen by subsequent :n and :p commands.
355 If the filename consists of several files, they are all inserted into
356 the list of files and the first one is examined.
357 If the filename contains one or more spaces,
358 the entire filename should be enclosed in double quotes
359 (also see the \-" option).
360 .IP "\(haX\(haV or E"
362 Warning: some systems use \(haV as a special literalization character.
363 On such systems, you may not be able to use \(haV.
365 Examine the next file (from the list of files given in the command line).
366 If a number N is specified, the N-th next file is examined.
368 Examine the previous file in the command line list.
369 If a number N is specified, the N-th previous file is examined.
371 Examine the first file in the command line list.
372 If a number N is specified, the N-th file in the list is examined.
374 Remove the current file from the list of files.
376 Go to the next tag, if there were more than one matches for the current tag.
377 See the \-t option for more details about tags.
379 Go to the previous tag, if there were more than one matches for the current tag.
380 .IP "\(haO\(haN or \(haOn"
381 Search forward in the file for the N-th next OSC 8 hyperlink.
382 .IP "\(haO\(haP or \(haOp"
383 Search backward in the file for the N-th previous OSC 8 hyperlink.
384 .IP "\(haO\(haL or \(haOl"
385 Jump to the currently selected OSC 8 hyperlink.
386 .IP "= or \(haG or :f"
387 Prints some information about the file being viewed,
389 and the line number and byte offset of the bottom line being displayed.
390 If possible, it also prints the length of the file,
391 the number of lines in the file
392 and the percent of the file above the last displayed line.
394 Followed by one of the command line option letters (see OPTIONS below),
395 this will change the setting of that option
396 and print a message describing the new setting.
397 If a \(haP (CONTROL-P) is entered immediately after the dash,
398 the setting of the option is changed but no message is printed.
399 If the option letter has a numeric value (such as \-b or \-h),
400 or a string value (such as \-P or \-t),
401 a new value may be entered after the option letter.
402 If no new value is entered, a message describing
403 the current setting is printed and nothing is changed.
405 Like the \- command, but takes a long option name (see OPTIONS below)
406 rather than a single option letter.
407 You must press ENTER or RETURN after typing the option name.
408 A \(haP immediately after the second dash suppresses printing of a
409 message describing the new setting, as in the \- command.
411 Followed by one of the command line option letters
412 this will reset the option to its default setting
413 and print a message describing the new setting.
414 (The "\-+\fIX\fP" command does the same thing
415 as "\-+\fIX\fP" on the command line.)
416 This does not work for string-valued options.
418 Like the \-+ command, but takes a long option name
419 rather than a single option letter.
421 Followed by one of the command line option letters,
422 this will reset the option to the "opposite" of its default setting
423 and print a message describing the new setting.
424 This does not work for numeric or string-valued options.
426 Like the \-!\& command, but takes a long option name
427 rather than a single option letter.
430 Followed by one of the command line option letters,
431 this will print a message describing the current setting of that option.
432 The setting of the option is not changed.
435 Like the _ (underscore) command, but takes a long option name
436 rather than a single option letter.
437 You must press ENTER or RETURN after typing the option name.
439 Causes the specified cmd to be executed each time a new file is examined.
440 For example, +G causes
442 to initially display each file starting at the end
443 rather than the beginning.
445 Prints the version number of
448 .IP "q or Q or :q or :Q or ZZ"
454 commands may or may not be valid, depending on your particular installation.
457 Invokes an editor to edit the current file being viewed.
458 The editor is taken from the environment variable VISUAL if defined,
459 or EDITOR if VISUAL is not defined,
460 or defaults to "vi" if neither VISUAL nor EDITOR is defined.
461 See also the discussion of LESSEDIT under the section on PROMPTS below.
462 .IP "! shell-command"
463 Invokes a shell to run the shell-command given.
464 A percent sign (%) in the command is replaced by the name of the
466 A pound sign (#) is replaced by the name of the previously examined file.
467 "!!" repeats the last shell command.
468 "!" with no shell command simply invokes a shell.
469 If a \(haP (CONTROL-P) is entered immediately after the !,
470 no "done" message is printed after the shell command is executed.
471 On Unix systems, the shell is taken from the environment variable SHELL,
473 On MS-DOS, Windows, and OS/2 systems, the shell is the normal command processor.
474 .IP "# shell-command"
475 Similar to the "!" command,
476 except that the command is expanded in the same way as prompt strings.
477 For example, the name of the current file would be given as "%f".
478 .IP "| <m> shell-command"
479 <m> represents any mark letter.
480 Pipes a section of the input file to the given shell command.
481 The section of the file to be piped is between the position marked by
482 the letter and the current screen.
483 The entire current screen is included, regardless of whether the
484 marked position is before or after the current screen.
485 <m> may also be \(ha or $ to indicate beginning or end of file respectively.
486 If <m> is \&.\& or newline, the current screen is piped.
487 If a \(haP (CONTROL-P) is entered immediately after the mark letter,
488 no "done" message is printed after the shell command is executed.
490 Save the input to a file.
491 This works only if the input is a pipe, not an ordinary file.
494 Run a shell command to open the URI in the current OSC 8 hyperlink,
495 selected by a previous \(haO\(haN or \(haO\(haP command.
496 To find the shell command,
497 the environment variable named "LESS_OSC8_xxx" is read,
498 where "xxx" is the scheme from the URI (the part before the first colon),
499 or is empty if there is no colon in the URI.
500 The value of the environment variable is then expanded in the same way as
501 prompt strings (in particular, any instance of "%o" is replaced with the URI)
502 to produce an OSC 8 "handler" shell command.
503 The standard output from the handler is an "opener" shell command
504 which is then executed to open the URI.
506 There are two special cases:
509 If the URI begins with "#", the remainder of the URI is taken to be
510 the value of the id parameter in another OSC 8 link in the same file,
511 and \(haO\(haO will simply jump to that link.
513 If the opener begins with the characters ":e" followed by
514 whitespace and a filename,
515 then instead of running the opener as a shell command,
516 the specified filename is opened in the current instance of
520 In a simple case where the opener accepts the complete URI
521 as a command line parameter, the handler may be as simple as
527 In other cases, the URI may need to be modified, so the handler
528 may have to do some manipulation of the %o value.
530 If the LESS_OSC8_xxx variable is not set, the variable LESS_OSC8_ANY is tried.
531 If neither LESS_OSC8_xxx nor LESS_OSC8_ANY is set,
532 links using the "xxx" scheme cannot be opened.
533 However, there are default handlers for the
534 schemes "man" (used when LESS_OSC8_man is not set)
535 and "file" (used when LESS_OSC8_file is not set),
536 which should work on systems which provide the
538 command and a shell with syntax compatible with the Bourne shell
540 If you use LESS_OSC8_ANY to override LESS_OSC8_file, you must
541 set LESS_OSC8_file to "-" to indicate that the default value
542 should not be used, and likewise for LESS_OSC8_man.
544 The URI passed to an OSC8 handler via %o is guaranteed not to contain any single quote
545 or double quote characters, but it may contain any other shell metacharacters
546 such as semicolons, dollar signs, ampersands, etc.
547 The handler should take care to appropriately quote parameters in the opener command,
548 to prevent execution of unintended shell commands in the case of opening
549 a URI which contains shell metacharacters.
550 Also, since the handler command is expanded like a command prompt,
551 any metacharacters interpreted by prompt expansion
552 (such as percent, dot, colon, backslash, etc.) must be escaped with a backslash
553 (see the PROMPTS section for details).
556 When the "Waiting for data" message is displayed,
557 such as while in the F command, pressing \(haX
560 from waiting and return to a prompt.
563 to think that the file ends at the current position,
564 so it may be necessary to use the R or F command to see more data.
565 The \-\-intr option can be used to specify a different character
566 to use instead of \(haX.
567 This command works only on systems that support the
572 the interrupt character (usually \(haC) can be used instead.
575 Command line options are described below.
576 Most options may be changed while
578 is running, via the "\-" command.
580 Some options may be given in one of two forms:
581 either a dash followed by a single letter,
582 or two dashes followed by a long option name.
583 A long option name may be abbreviated as long as
584 the abbreviation is unambiguous.
585 For example, \-\-quit-at-eof may be abbreviated \-\-quit, but not
586 \-\-qui, since both \-\-quit-at-eof and \-\-quiet begin with \-\-qui.
587 Some long option names are in uppercase, such as \-\-QUIT-AT-EOF, as
588 distinct from \-\-quit-at-eof.
589 Such option names need only have their first letter capitalized;
590 the remainder of the name may be in either case.
591 For example, \-\-Quit-at-eof is equivalent to \-\-QUIT-AT-EOF.
593 Options are also taken from the environment variable "LESS".
595 to avoid typing "less \-options \&...\&" each time
597 is invoked, you might tell
600 setenv LESS "\-options"
605 LESS="\-options"; export LESS
607 On MS-DOS and Windows, you don't need the quotes, but you should
608 be careful that any percent signs in the options string are not
609 interpreted as an environment variable expansion.
611 The environment variable is parsed before the command line,
612 so command line options override the LESS environment variable.
613 If an option appears in the LESS variable, it can be reset
614 to its default value on the command line by beginning the command
615 line option with "\-+".
617 Some options like \-k or \-D require a string to follow the option letter.
618 The string for that option is considered to end when a dollar sign ($) is found.
619 For example, you can set two \-D options like this:
623 If the \-\-use-backslash option appears earlier in the options, then
624 a dollar sign or backslash may be included literally in an option string
625 by preceding it with a backslash.
626 If the \-\-use-backslash option is not in effect, then backslashes are
627 not treated specially, and there is no way to include a dollar sign
628 in the option string.
629 .IP "\-? or \-\-help"
630 This option displays a summary of the commands accepted by
632 (the same as the h command).
633 (Depending on how your shell interprets the question mark,
634 it may be necessary to quote the question mark, thus: "\-\e?".)
635 .IP "\-a or \-\-search-skip-screen"
636 By default, forward searches start at the top of the displayed screen
637 and backwards searches start at the bottom of the displayed screen
638 (except for repeated searches invoked by the n or N commands,
639 which start after or before the "target" line respectively;
640 see the \-j option for more about the target line).
641 The \-a option causes forward searches to instead start at
642 the bottom of the screen
643 and backward searches to start at the top of the screen,
644 thus skipping all lines displayed on the screen.
645 .IP "\-A or \-\-SEARCH-SKIP-SCREEN"
646 Causes all forward searches (not just non-repeated searches)
647 to start just after the target line, and all backward searches
648 to start just before the target line.
649 Thus, forward searches will skip part of the displayed screen
650 (from the first line up to and including the target line).
651 Similarly backwards searches will skip the displayed screen
652 from the last line up to and including the target line.
653 This was the default behavior in less versions prior to 441.
654 .IP "\-b\fIn\fP or \-\-buffers=\fIn\fP"
655 Specifies the amount of buffer space
657 will use for each file, in units of kilobytes (1024 bytes).
658 By default 64\ KB of buffer space is used for each file
659 (unless the file is a pipe; see the \-B option).
660 The \-b option specifies instead that \fIn\fP kilobytes of
661 buffer space should be used for each file.
662 If \fIn\fP is \-1, buffer space is unlimited; that is,
663 the entire file can be read into memory.
664 .IP "\-B or \-\-auto-buffers"
665 By default, when data is read from a pipe,
666 buffers are allocated automatically as needed.
667 If a large amount of data is read from the pipe, this can cause
668 a large amount of memory to be allocated.
669 The \-B option disables this automatic allocation of buffers for pipes,
671 (or the amount of space specified by the \-b option)
672 is used for the pipe.
673 Warning: use of \-B can result in erroneous display, since only the
674 most recently viewed part of the piped data is kept in memory;
675 any earlier data is lost.
676 Lost characters are displayed as question marks.
677 .IP "\-c or \-\-clear-screen"
678 Causes full screen repaints to be painted from the top line down.
680 full screen repaints are done by scrolling from the bottom of the screen.
681 .IP "\-C or \-\-CLEAR-SCREEN"
682 Same as \-c, for compatibility with older versions of
684 .IP "\-d or \-\-dumb"
685 The \-d option suppresses the error message
686 normally displayed if the terminal is dumb;
687 that is, lacks some important capability,
688 such as the ability to clear the screen or scroll backward.
689 The \-d option does not otherwise change the behavior of
692 .IP "\-D\fBx\fP\fIcolor\fP or \-\-color=\fBx\fP\fIcolor\fP"
693 Changes the color of different parts of the displayed text.
694 \fBx\fP is a single character which selects the type of text
695 whose color is being set:
702 Errors and informational messages.
704 Header lines and columns, set via the \-\-header option.
706 Mark letters in the status column.
708 Line numbers enabled via the \-N option.
712 The rscroll character.
716 The highlight enabled via the \-w option.
718 The text in a search result which matches
719 the first through fifth parenthesized sub-pattern.
720 Sub-pattern coloring works only if
722 is built with one of the regular expression libraries
723 .BR posix ", " pcre ", or " pcre2 .
735 The uppercase letters and digits can be used only when the \-\-use-color option is enabled.
736 When text color is specified by both an uppercase letter and a lowercase letter,
737 the uppercase letter takes precedence.
738 For example, error messages are normally displayed as standout text.
739 So if both "s" and "E" are given a color, the "E" color applies
740 to error messages, and the "s" color applies to other standout text.
741 The lowercase letters refer to bold and underline text formed by
742 overstriking with backspaces (see the \-U option) and to non-content
743 text (such as line numbers and prompts),
744 but not to text formatted using ANSI escape sequences with the \-R option
745 (but see the note below for different behavior on Windows and MS-DOS).
747 A lowercase letter may be followed by a + to indicate that
748 the normal format change and the specified color should both be used.
749 For example, \-Dug displays underlined text as green without underlining;
750 the green color has replaced the usual underline formatting.
751 But \-Du+g displays underlined text as both green and in underlined format.
753 \fIcolor\fP is either a 4-bit color string or an 8-bit color string:
755 A 4-bit color string is one or two characters, where
756 the first character specifies the foreground color and
757 the second specifies the background color as follows:
775 The corresponding uppercase letter denotes a brighter shade of the color.
776 For example, \-DNGk displays line numbers as bright green text on a black
777 background, and \-DEbR displays error messages as blue text on a
778 bright red background.
779 If either character is a "-" or is omitted, the corresponding color
780 is set to that of normal text.
782 An 8-bit color string is one or two decimal integers separated by a dot,
783 where the first integer specifies the foreground color and
784 the second specifies the background color.
785 Each integer is a value between 0 and 255 inclusive which selects
786 a "CSI 38;5" color value (see
788 https://en.wikipedia.org/wiki/ANSI_escape_code#SGR).
790 If either integer is a "-" or is omitted,
791 the corresponding color is set to that of normal text.
793 A 4-bit or 8-bit color string may be followed by one or more of the
794 following characters to set text attributes in addition to the color.
796 Standout (reverse video)
804 On MS-DOS and Windows, the \-\-color option behaves
805 differently from what is described above in these ways:
807 The bold (d and *) and blinking (l and &) text attributes
808 at the end of a color string are not supported.
810 Lowercase color selector letters refer to text formatted by ANSI
811 escape sequences with \-R,
812 in addition to overstruck and non-content text (but see \-Da).
814 For historical reasons, when a lowercase color selector letter
815 is followed by a numeric color value,
816 the number is not interpreted as an "CSI 38;5" color value as described above,
817 but instead as a 4-bit
821 value, between 0 and 15 inclusive
824 https://learn.microsoft.com/en-us/windows/console/char-info-str).
827 To avoid confusion, it is recommended that the equivalent letters rather than numbers
828 be used after a lowercase color selector on MS-DOS/Windows.
830 Numeric color values ("CSI 38;5" color) following an uppercase color selector letter
831 are not supported on systems earlier than Windows 10.
833 Only a limited set of ANSI escape sequences to set color in the content work correctly.
834 4-bit color sequences work, but "CSI 38;5" color sequences do not.
836 The \-Da option makes the behavior of \-\-color
837 more similar to its behavior on non-MS-DOS/Windows systems by (1)
838 making lowercase color selector letters not affect text formatted
839 with ANSI escape sequences, and (2)
840 allowing "CSI 38;5" color sequences in the content
841 work by passing them to the terminal (only on Windows 10 and later; on
842 earlier Windows systems, such sequences do not work regardless of the setting of \-Da).
844 .IP "\-e or \-\-quit-at-eof"
847 to automatically exit
848 the second time it reaches end-of-file.
849 By default, the only way to exit
851 is via the "q" command.
852 .IP "\-E or \-\-QUIT-AT-EOF"
855 to automatically exit the first time it reaches end-of-file.
856 .IP "\-f or \-\-force"
857 Forces non-regular files to be opened.
858 (A non-regular file is a directory or a device special file.)
859 Also suppresses the warning message when a binary file is opened.
862 will refuse to open non-regular files.
863 Note that some operating systems will not allow directories
864 to be read, even if \-f is set.
865 .IP "\-F or \-\-quit-if-one-screen"
868 to automatically exit
869 if the entire file can be displayed on the first screen.
870 .IP "\-g or \-\-hilite-search"
873 will highlight ALL strings which match the last search command.
874 The \-g option changes this behavior to highlight only the particular string
875 which was found by the last search command.
878 to run somewhat faster than the default.
879 .IP "\-G or \-\-HILITE-SEARCH"
880 The \-G option suppresses all highlighting of strings found by search commands.
881 .IP "\-h\fIn\fP or \-\-max-back-scroll=\fIn\fP"
882 Specifies a maximum number of lines to scroll backward.
883 If it is necessary to scroll backward more than \fIn\fP lines,
884 the screen is repainted in a forward direction instead.
885 (If the terminal does not have the ability to scroll
886 backward, \-h0 is implied.)
887 .IP "\-i or \-\-ignore-case"
888 Causes searches to ignore case; that is,
889 uppercase and lowercase are considered identical.
890 This option is ignored if any uppercase letters
891 appear in the search pattern;
893 if a pattern contains uppercase letters, then that search does not ignore case.
894 .IP "\-I or \-\-IGNORE-CASE"
895 Like \-i, but searches ignore case even if
896 the pattern contains uppercase letters.
897 .IP "\-j\fIn\fP or \-\-jump-target=\fIn\fP"
898 Specifies a line on the screen where the "target" line
900 The target line is the line specified by any command to
901 search for a pattern, jump to a line number,
902 jump to a file percentage or jump to a tag.
903 The screen line may be specified by a number: the top line on the screen
904 is 1, the next is 2, and so on.
905 The number may be negative to specify a line relative to the bottom
906 of the screen: the bottom line on the screen is \-1, the second
907 to the bottom is \-2, and so on.
908 Alternately, the screen line may be specified as a fraction of the height
909 of the screen, starting with a decimal point: \&.5 is in the middle of the
910 screen, \&.3 is three tenths down from the first line, and so on.
911 If the line is specified as a fraction, the actual line number
912 is recalculated if the terminal window is resized.
913 If the \-\-header option is used and the target line specified by \-j
914 would be obscured by the header, the target line is moved to the first
915 line after the header.
916 While the \-\-header option is active, the \-S option is ignored,
917 and lines longer than the screen width are truncated.
920 If any form of the \-j option is used,
921 repeated forward searches (invoked with "n" or "N")
922 begin at the line immediately after the target line,
923 and repeated backward searches begin at the target line,
924 unless changed by \-a or \-A.
925 For example, if "\-j4" is used, the target line is the
926 fourth line on the screen, so forward searches begin at the fifth line
928 However nonrepeated searches (invoked with "/" or "?")
929 always begin at the start or end of the current screen respectively.
931 .IP "\-J or \-\-status-column"
932 Displays a status column at the left edge of the screen.
933 The character displayed in the status column may be one of:
936 The line is chopped with the \-S option, and
937 the text that is chopped off beyond the right edge of the screen
938 contains a match for the current search.
940 The line is horizontally shifted, and
941 the text that is shifted beyond the left side of the screen
942 contains a match for the current search.
944 The line is both chopped and shifted,
945 and there are matches beyond both sides of the screen.
947 There are matches in the visible part of the line
948 but none to the right or left of it.
950 The line has been marked with the corresponding letter via the m command.
952 .IP "\-k\fIfilename\fP or \-\-lesskey-file=\fIfilename\fP"
955 to open and interpret the named file as a
958 Multiple \-k options may be specified.
959 If the LESSKEY or LESSKEY_SYSTEM environment variable is set, or
960 if a lesskey file is found in a standard place (see KEY BINDINGS),
964 Note the warning under "\-\-lesskey-content" below.
965 .IP "\-\-lesskey-src=\fIfilename\fP"
968 to open and interpret the named file as a
971 If the LESSKEYIN or LESSKEYIN_SYSTEM environment variable is set, or
972 if a lesskey source file is found in a standard place (see KEY BINDINGS),
976 Prior to version 582, the
978 program needed to be run to convert a
989 file directly and ignore the binary file if the source file exists.
990 Note the warning under "\-\-lesskey-content" below.
991 .IP "\-\-lesskey-content=\fItext\fP"
992 Causes less to interpret the specified text as the contents of a
997 lines may be separated by either newlines as usual, or by semicolons.
998 A literal semicolon may be represented by a backslash followed by a semicolon.
1000 Warning: certain environment variables such as
1001 LESS, LESSSECURE, LESSCHARSET and others,
1002 which are used early in startup,
1003 cannot be set in a file specified by a command line option
1004 (\-\-lesskey, \-\-lesskey-src or \-\-lesskey-content). When using a
1006 file to set environment variables, it is safer to use the
1007 default lesskey file, or to specify the file using the
1008 LESSKEYIN or LESSKEY_CONTENT environment variables rather than using
1009 a command line option.
1010 .IP "\-K or \-\-quit-on-intr"
1013 to exit immediately (with status 2)
1014 when an interrupt character (usually \(haC) is typed.
1015 Normally, an interrupt character causes
1017 to stop whatever it is doing and return to its command prompt.
1018 Note that use of this option makes it impossible to return to the
1019 command prompt from the "F" command.
1020 .IP "\-L or \-\-no-lessopen"
1021 Ignore the LESSOPEN environment variable
1022 (see the INPUT PREPROCESSOR section below).
1023 This option can be set from within
1025 but it will apply only to files opened subsequently, not to the
1026 file which is currently open.
1027 .IP "\-m or \-\-long-prompt"
1030 to prompt verbosely (like
1032 with the percent into the file.
1035 prompts with a colon.
1036 .IP "\-M or \-\-LONG-PROMPT"
1039 to prompt even more verbosely than
1041 .IP "\-n or \-\-line-numbers"
1042 Suppresses line numbers.
1043 The default (to use line numbers) may cause
1045 to run more slowly in some cases, especially with a very large input file.
1046 Suppressing line numbers with the \-n option will avoid this problem.
1047 Using line numbers means: the line number will be displayed in the verbose
1048 prompt and in the = command,
1049 and the v command will pass the current line number to the editor
1050 (see also the discussion of LESSEDIT in PROMPTS below).
1051 .IP "\-N or \-\-LINE-NUMBERS"
1052 Causes a line number to be displayed at the beginning of
1053 each line in the display.
1054 .IP "\-o\fIfilename\fP or \-\-log-file=\fIfilename\fP"
1057 to copy its input to the named file as it is being viewed.
1058 This applies only when the input file is a pipe,
1059 not an ordinary file.
1060 If the file already exists,
1062 will ask for confirmation before overwriting it.
1063 .IP "\-O\fIfilename\fP or \-\-LOG-FILE=\fIfilename\fP"
1064 The \-O option is like \-o, but it will overwrite an existing
1065 file without asking for confirmation.
1067 If no log file has been specified,
1068 the \-o and \-O options can be used from within
1070 to specify a log file.
1071 Without a file name, they will simply report the name of the log file.
1072 The "s" command is equivalent to specifying \-o from within
1074 .IP "\-p\fIpattern\fP or \-\-pattern=\fIpattern\fP"
1075 The \-p option on the command line is equivalent to
1076 specifying +/\fIpattern\fP;
1079 to start at the first occurrence of \fIpattern\fP in the file.
1080 .IP "\-P\fIprompt\fP or \-\-prompt=\fIprompt\fP"
1081 Provides a way to tailor the three prompt
1082 styles to your own preference.
1083 This option would normally be put in the LESS environment
1084 variable, rather than being typed in with each
1087 Such an option must either be the last option in the LESS variable,
1088 or be terminated by a dollar sign.
1089 \-Ps followed by a string changes the default (short) prompt
1091 \-Pm changes the medium (\-m) prompt.
1092 \-PM changes the long (\-M) prompt.
1093 \-Ph changes the prompt for the help screen.
1094 \-P= changes the message printed by the = command.
1095 \-Pw changes the message printed while waiting for data (in the "F" command).
1097 All prompt strings consist of a sequence of
1098 letters and special escape sequences.
1099 See the section on PROMPTS for more details.
1100 .IP "\-q or \-\-quiet or \-\-silent"
1101 Causes moderately "quiet" operation:
1102 the terminal bell is not rung
1103 if an attempt is made to scroll past the end of the file
1104 or before the beginning of the file.
1105 If the terminal has a "visual bell", it is used instead.
1106 The bell will be rung on certain other errors,
1107 such as typing an invalid character.
1108 The default is to ring the terminal bell in all such cases.
1109 .IP "\-Q or \-\-QUIET or \-\-SILENT"
1110 Causes totally "quiet" operation:
1111 the terminal bell is never rung.
1112 If the terminal has a "visual bell", it is used in all cases
1113 where the terminal bell would have been rung.
1114 .IP "\-r or \-\-raw-control-chars"
1115 Causes "raw" control characters to be displayed.
1116 The default is to display control characters using the caret notation;
1117 for example, a control-A (octal 001) is displayed as "\(haA"
1118 (with some exceptions as described under the \-U option).
1119 Warning: when the \-r option is used,
1121 cannot keep track of the actual appearance of the screen
1122 (since this depends on how the screen responds to
1123 each type of control character).
1124 Thus, various display problems may result,
1125 such as long lines being split in the wrong place.
1127 USE OF THE \-r OPTION IS NOT RECOMMENDED.
1128 .IP "\-R or \-\-RAW-CONTROL-CHARS"
1129 Like \-r, but only ANSI "color" escape sequences and OSC 8 hyperlink
1130 sequences are output in "raw" form.
1131 Unlike \-r, the screen appearance is maintained correctly,
1132 provided that there are no escape sequences in the file
1133 other than these types of escape sequences.
1134 Color escape sequences are only supported when the color
1135 is changed within one line, not across lines.
1136 In other words, the beginning of each line is assumed to be
1137 normal (non-colored), regardless of any escape sequences in previous lines.
1138 For the purpose of keeping track of screen appearance,
1139 these escape sequences are assumed to not move the cursor.
1141 OSC 8 hyperlinks are sequences of the form:
1143 ESC ] 8 ; \&...\& \\7
1145 The terminating sequence may be either a BEL character (\\7)
1146 or the two-character sequence "ESC \\".
1148 ANSI color escape sequences are sequences of the form:
1152 where the "...\&" is zero or more color specification characters.
1155 think that characters other than "m" can end ANSI color escape sequences
1156 by setting the environment variable LESSANSIENDCHARS to the list of
1157 characters which can end a color escape sequence.
1160 think that characters other than the standard ones may appear between
1161 the ESC and the m by setting the environment variable LESSANSIMIDCHARS
1162 to the list of characters which can appear.
1163 .IP "\-s or \-\-squeeze-blank-lines"
1164 Causes consecutive blank lines to be squeezed into a single blank line.
1165 This is useful when viewing
1168 .IP "\-S or \-\-chop-long-lines"
1169 Causes lines longer than the screen width to be
1170 chopped (truncated) rather than wrapped.
1171 That is, the portion of a long line that does not fit in
1172 the screen width is not displayed until you press RIGHT-ARROW.
1173 The default is to wrap long lines; that is, display the remainder
1175 See also the \-\-wordwrap option.
1176 .IP "\-t\fItag\fP or \-\-tag=\fItag\fP"
1177 The \-t option, followed immediately by a TAG,
1178 will edit the file containing that tag.
1179 For this to work, tag information must be available;
1180 for example, there may be a file in the current directory called "tags",
1181 which was previously built by
1183 or an equivalent command.
1184 If the environment variable LESSGLOBALTAGS is set, it is taken to be
1185 the name of a command compatible with
1187 and that command is executed to find the tag.
1190 http://www.gnu.org/software/global/global.html).
1192 The \-t option may also be specified from within
1194 (using the \- command) as a way of examining a new file.
1195 The command ":t" is equivalent to specifying \-t from within
1197 .IP "\-T\fItagsfile\fP or \-\-tag-file=\fItagsfile\fP"
1198 Specifies a tags file to be used instead of "tags".
1199 .IP "\-u or \-\-underline-special"
1200 Causes backspaces and carriage returns to be treated as printable characters;
1201 that is, they are sent to the terminal when they appear in the input.
1202 .IP "\-U or \-\-UNDERLINE-SPECIAL"
1203 Causes backspaces, tabs, carriage returns and "formatting characters"
1204 (as defined by Unicode) to be treated as control characters;
1205 that is, they are handled as specified by the \-r option.
1207 By default, if neither \-u nor \-U is given,
1208 backspaces which appear adjacent to an underscore character
1209 are treated specially:
1210 the underlined text is displayed
1211 using the terminal's hardware underlining capability.
1212 Also, backspaces which appear between two identical characters
1213 are treated specially:
1214 the overstruck text is printed
1215 using the terminal's hardware boldface capability.
1216 Other backspaces are deleted, along with the preceding character.
1217 Carriage returns immediately followed by a newline are deleted.
1218 Other carriage returns are handled as specified by the \-r option.
1219 Unicode formatting characters, such as the Byte Order Mark,
1220 are sent to the terminal.
1221 Text which is overstruck or underlined can be searched for
1222 if neither \-u nor \-U is in effect.
1224 See also the \-\-proc-backspace, \-\-proc-tab,
1225 and \-\-proc-return options.
1226 .IP "\-V or \-\-version"
1227 Displays the version number of
1229 .IP "\-w or \-\-hilite-unread"
1230 Temporarily highlights the first "new" line after a forward movement
1232 The first "new" line is the line immediately following the line previously
1233 at the bottom of the screen.
1234 Also highlights the target line after a g or p command.
1235 The highlight is removed at the next command which causes movement.
1236 If the \-\-status-line option is in effect, the entire line
1237 (the width of the screen) is highlighted.
1238 Otherwise, only the text in the line is highlighted,
1239 unless the \-J option is in effect,
1240 in which case only the status column is highlighted.
1241 .IP "\-W or \-\-HILITE-UNREAD"
1242 Like \-w, but temporarily highlights the first new line after any
1243 forward movement command larger than one line.
1244 .IP "\-x\fIn\fP,...\& or \-\-tabs=\fIn\fP,..."
1246 If only one \fIn\fP is specified, tab stops are set at multiples of \fIn\fP.
1247 If multiple values separated by commas are specified, tab stops
1248 are set at those positions, and then continue with the same spacing as the
1250 For example, "-x9,17" will set tabs at positions 9, 17, 25, 33, etc.
1251 The default for \fIn\fP is 8.
1252 .IP "\-X or \-\-no-init"
1253 Disables sending the termcap initialization and deinitialization strings
1255 This is sometimes desirable if the deinitialization string does
1256 something unnecessary, like clearing the screen.
1257 .IP "\-y\fIn\fP or \-\-max-forw-scroll=\fIn\fP"
1258 Specifies a maximum number of lines to scroll forward.
1259 If it is necessary to scroll forward more than \fIn\fP lines,
1260 the screen is repainted instead.
1261 The \-c or \-C option may be used to repaint from the top of
1262 the screen if desired.
1263 By default, any forward movement causes scrolling.
1264 .IP "\-z\fIn\fP or \-\-window=\fIn\fP or \-\fIn\fP"
1265 Changes the default scrolling window size to \fIn\fP lines.
1266 The default is one screenful.
1267 The z and w commands can also be used to change the window size.
1268 The "z" may be omitted for compatibility with some versions of
1272 is negative, it indicates
1274 lines less than the current screen size.
1275 For example, if the screen is 24 lines, \fI\-z\-4\fP sets the
1276 scrolling window to 20 lines. If the screen is resized to 40 lines,
1277 the scrolling window automatically changes to 36 lines.
1278 .IP "\-\(dq\fIcc\fP\ or\ \-\-quotes=\fIcc\fP"
1279 Changes the filename quoting character.
1280 This may be necessary if you are trying to name a file
1281 which contains both spaces and quote characters.
1282 Followed by a single character, this changes the quote character to that
1284 Filenames containing a space should then be surrounded by that character
1285 rather than by double quotes.
1286 Followed by two characters, changes the open quote to the first character,
1287 and the close quote to the second character.
1288 Filenames containing a space should then be preceded by the open quote
1289 character and followed by the close quote character.
1290 Note that even after the quote characters are changed, this option
1291 remains \-" (a dash followed by a double quote).
1292 .IP "\-\(ti or \-\-tilde"
1293 Normally lines after end of file are displayed as a single tilde (\(ti).
1294 This option causes lines after end of file to be displayed as blank lines.
1295 .IP "\-# or \-\-shift"
1296 Specifies the default number of positions to scroll horizontally
1297 in the RIGHTARROW and LEFTARROW commands.
1298 If the number specified is zero, it sets the default number of
1299 positions to one half of the screen width.
1300 Alternately, the number may be specified as a fraction of the width
1301 of the screen, starting with a decimal point: \&.5 is half of the
1302 screen width, \&.3 is three tenths of the screen width, and so on.
1303 If the number is specified as a fraction, the actual number of
1304 scroll positions is recalculated if the terminal window is resized.
1305 .IP "\-\-exit-follow-on-close"
1306 When using the "F" command on a pipe,
1308 will automatically stop waiting for more data when the input side of the
1311 If \-\-file-size is specified,
1313 will determine the size of the file
1314 immediately after opening the file.
1315 Then the "=" command will display the number of lines in the file.
1316 Normally this is not done, because it can be slow if the input file
1317 is non-seekable (such as a pipe) and is large.
1318 .IP "\-\-follow-name"
1319 Normally, if the input file is renamed while an F command is executing,
1321 will continue to display the contents of the original file despite
1323 If \-\-follow-name is specified, during an F command
1325 will periodically attempt to reopen the file by name.
1326 If the reopen succeeds and the file is a different file from the original
1327 (which means that a new file has been created
1328 with the same name as the original (now renamed) file),
1330 will display the contents of that new file.
1331 .IP "\-\-header=\fIL\fP,\fIC\fP,\fIN\fP"
1333 Sets the number of header lines and columns displayed on the screen.
1334 The number of header lines is set to \fIL\fP.
1335 If \fIL\fP is 0, header lines are disabled.
1336 If \fIL\fP is empty or missing, the number of header lines is unchanged.
1337 The number of header columns is set to \fIC\fP.
1338 If \fIC\fP is 0, header columns are disabled.
1339 If \fIC\fP is empty or missing, the number of header columns is unchanged.
1340 The first header line is set to line number \fIN\fP in the file.
1341 If \fIN\fP is empty or missing, it is taken to be
1342 the number of the line currently displayed in the first line of the screen
1343 (if the \-\-header command has been issued from within
1345 or 1 (if the \-\-header option has been given on the command line).
1346 The special form "\-\-header=\-" disables header lines and header columns,
1347 and is equivalent to "\-\-header=0,0".
1349 When \fIL\fP is nonzero, the first \fIL\fP lines at the top
1350 of the screen are replaced with the \fIL\fP lines of the file beginning at line \fIN\fP,
1351 regardless of what part of the file is being viewed.
1352 When header lines are displayed, any file contents before the header line cannot be viewed.
1353 When \fIC\fP is nonzero, the first \fIC\fP characters displayed at the
1354 beginning of each line are replaced with the first \fIC\fP characters of the line,
1355 even if the rest of the line is scrolled horizontally.
1358 Subsequent search commands will be "incremental"; that is,
1360 will advance to the next line containing the search pattern
1361 as each character of the pattern is typed in.
1362 .IP "\-\-intr=\fIc\fP"
1363 Use the character \fIc\fP instead of \(haX to interrupt a read
1364 when the "Waiting for data" message is displayed.
1365 \fIc\fP must be an ASCII character; that is, one with a value
1366 between 1 and 127 inclusive.
1367 A caret followed by a single character can be used
1368 to specify a control character.
1369 .IP "\-\-line-num-width=\fIn\fP"
1370 Sets the minimum width of the line number field when the \-N option is in effect
1371 to \fIn\fP characters.
1373 .IP "\-\-match-shift=\fIn\fP"
1374 When \-S is in effect, if a search match is not visible
1375 because it is shifted to the left or right of the currently
1376 visible screen, the text will horizontally shift
1377 to ensure that the search match is visible.
1378 This option selects the column in which the first character
1379 of the search match will be placed after the shift.
1380 In other words, there will be \fIn\fP characters visible
1381 to the left of the search match.
1383 Alternately, the number may be specified as a fraction of the width
1384 of the screen, starting with a decimal point: \&.5 is half of the
1385 screen width, \&.3 is three tenths of the screen width, and so on.
1386 If the number is specified as a fraction, the actual number of
1387 scroll positions is recalculated if the terminal window is resized.
1388 .IP "\-\-modelines=\fIn\fP"
1390 Before displaying a file,
1392 will read the first \fIn\fP lines to try to find a vim-compatible
1396 does not try to find modelines.
1397 By using a modeline, the file itself can specify the tab stops
1398 that should be used when viewing it.
1400 A modeline contains, anywhere in the line,
1401 a program name ("vi", "vim", "ex", or "less"),
1402 followed by a colon,
1403 possibly followed by the word "set",
1404 and finally followed by zero or more option settings.
1405 If the word "set" is used,
1406 option settings are separated by spaces, and end at the first colon.
1407 If the word "set" is not used,
1408 option settings may be separated by either spaces or colons.
1409 The word "set" is required if the program name is "less"
1410 but optional if any of the other three names are used.
1411 If any option setting is of the form "tabstop=\fIn\fP" or "ts=\fIn\fP",
1412 then tab stops are automatically set as if \-\-tabs=\fIn\fP had been given.
1413 See the \-\-tabs description for acceptable values of \fIn\fP.
1416 Enables mouse input:
1417 scrolling the mouse wheel down moves forward in the file,
1418 scrolling the mouse wheel up moves backwards in the file,
1419 left-click sets the "#" mark to the line where the mouse is clicked,
1420 and right-click (or any other) returns to the "#" mark position.
1421 If a left-click is performed with the mouse cursor on an OSC 8 hyperlink,
1422 the hyperlink is selected as if by the \(haO\(haN command.
1423 If a left-click is performed with the mouse cursor on an OSC 8 hyperlink
1424 which is already selected, the hyperlink is opened as if by the \(haO\(haO command.
1425 The number of lines to scroll when the wheel is moved
1426 can be set by the \-\-wheel-lines option.
1427 Mouse input works only on terminals which support X11 mouse reporting,
1428 and on the Windows version of
1431 Like \-\-mouse, except the direction scrolled
1432 on mouse wheel movement is reversed.
1434 Disables sending the keypad initialization and deinitialization strings
1436 This is sometimes useful if the keypad strings make the numeric
1437 keypad behave in an undesirable manner.
1438 .IP "\-\-no-histdups"
1439 This option changes the behavior so that if a search string or
1440 file name is typed in, and the same string is already in the history list,
1441 the existing copy is removed from the history list before the new one is added.
1442 Thus, a given string will appear only once in the history list.
1443 Normally, a string may appear multiple times.
1444 .IP "\-\-no-number-headers"
1445 Header lines (defined via the \-\-header option) are not assigned line numbers.
1446 Line number 1 is assigned to the first line after any header lines.
1447 .IP "\-\-no-search-header-lines"
1448 Searches do not include header lines, but still include header columns.
1449 .IP "\-\-no-search-header-columns"
1450 Searches do not include header columns, but still include header lines.
1451 .IP "\-\-no-search-headers"
1452 Searches do not include header lines or header columns.
1454 Disables the terminal's visual bell.
1455 .IP "\-\-proc-backspace"
1456 If set, backspaces are handled as if neither the \-u option
1457 nor the \-U option were set.
1458 That is, a backspace adjacent to an underscore causes text to be
1459 displayed in underline mode, and a backspace between identical
1460 characters cause text to be displayed in boldface mode.
1461 This option overrides the \-u and \-U options, so that display of
1462 backspaces can be controlled separate from tabs and carriage returns.
1463 If not set, backspace display is controlled by the \-u and \-U options.
1464 .IP "\-\-PROC-BACKSPACE"
1465 If set, backspaces are handled as if the \-U option were set;
1466 that is backspaces are treated as control characters.
1467 .IP "\-\-proc-return"
1468 If set, carriage returns are handled as if neither the \-u option
1469 nor the \-U option were set.
1470 That is, a carriage return immediately before a newline is deleted.
1471 This option overrides the \-u and \-U options, so that display of
1472 carriage returns can be controlled separate from that of backspaces and tabs.
1473 If not set, carriage return display is controlled by the \-u and \-U options.
1474 .IP "\-\-PROC-RETURN"
1475 If set, carriage returns are handled as if the \-U option were set;
1476 that is carriage returns are treated as control characters.
1478 If set, tabs are handled as if the \-U option were not set.
1479 That is, tabs are expanded to spaces.
1480 This option overrides the \-U option, so that display of
1481 tabs can be controlled separate from that of backspaces and carriage returns.
1482 If not set, tab display is controlled by the \-U options.
1484 If set, tabs are handled as if the \-U option were set;
1485 that is tabs are treated as control characters.
1486 .IP "\-\-redraw-on-quit"
1487 When quitting, after sending the terminal deinitialization string,
1488 redraws the entire last screen.
1489 On terminals whose terminal deinitialization string causes the
1490 terminal to switch from an alternate screen,
1491 this makes the last screenful of the current file remain visible after
1494 .IP "\-\-rscroll=\fIc\fP"
1495 This option changes the character used to mark truncated lines.
1496 It may begin with a two-character attribute indicator like LESSBINFMT does.
1497 If there is no attribute indicator, standout is used.
1498 If set to "\-", truncated lines are not marked.
1499 .IP "\-\-save-marks"
1500 Save marks in the history file, so marks are retained
1501 across different invocations of
1503 .IP "\-\-search-options=\fI...\fP"
1504 Sets default search modifiers.
1505 The value is a string of one or more of the characters
1507 Setting any of these has the same effect as typing that
1508 control character at the beginning of every search pattern.
1509 For example, setting \-\-search-options=W is the same as
1510 typing \(haW at the beginning of every pattern.
1511 The value may also contain a digit between 1 and 5,
1512 which has the same effect as typing \(haS followed by that digit
1513 at the beginning of every search pattern.
1514 The value "-" disables all default search modifiers.
1515 .IP "\-\-show-preproc-errors"
1516 If a preprocessor produces data,
1517 then exits with a non-zero exit code,
1519 will display a warning.
1520 .IP "\-\-status-col-width=\fIn\fP"
1521 Sets the width of the status column when the \-J option is in effect.
1522 The default is 2 characters.
1523 .IP "\-\-status-line"
1524 If a line is marked, the entire line (rather than just the status column)
1526 Also lines highlighted due to the \-w option will have
1527 the entire line highlighted.
1528 If \-\-use-color is set, the line is colored rather than highlighted.
1529 .IP "\-\-use-backslash"
1530 This option changes the interpretations of options which follow this one.
1531 After the \-\-use-backslash option, any backslash in an option string is
1532 removed and the following character is taken literally.
1533 This allows a dollar sign to be included in option strings.
1535 Enables colored text in various places.
1536 The \-D option can be used to change the colors.
1537 Colored text works only if the terminal supports
1538 ANSI color escape sequences (as defined in
1540 https://www.ecma-international.org/publications-and-standards/standards/ecma-48).
1542 .IP "\-\-wheel-lines=\fIn\fP"
1543 Set the number of lines to scroll when the mouse wheel is scrolled
1544 and the \-\-mouse or \-\-MOUSE option is in effect.
1545 The default is 1 line.
1547 When the \-S option is not in use,
1548 wrap each line at a space or tab if possible,
1549 so that a word is not split between two lines.
1550 The default is to wrap at any character.
1552 A command line argument of "\-\-" marks the end of option arguments.
1553 Any arguments following this are interpreted as filenames.
1554 This can be useful when viewing a file whose name begins with a "\-" or "+".
1556 If a command line option begins with \fB+\fP,
1557 the remainder of that option is taken to be an initial command to
1559 For example, +G tells
1561 to start at the end of the file rather than the beginning,
1562 and +/xyz tells it to start at the first occurrence of "xyz" in the file.
1563 As a special case, +<number> acts like +<number>g;
1564 that is, it starts the display at the specified line number
1565 (however, see the caveat under the "g" command above).
1566 If the option starts with ++, the initial command applies to
1567 every file being viewed, not just the first one.
1568 The + command described previously
1569 may also be used to set (or change) an initial command for every file.
1572 When entering a command line at the bottom of the screen
1573 (for example, a filename for the :e command,
1574 or the pattern for a search command),
1575 certain keys can be used to manipulate the command line.
1576 Most commands have an alternate form in [ brackets ] which can be used if
1577 a key does not exist on a particular keyboard.
1578 (Note that the forms beginning with ESC do not work
1579 in some MS-DOS and Windows systems because ESC is the line erase character.)
1580 Any of these special keys may be entered literally by preceding
1581 it with the "literal" character, either \(haV or \(haA.
1582 A backslash itself may also be entered literally by entering two backslashes.
1583 .IP "LEFTARROW [ ESC-h ]"
1584 Move the cursor one space to the left.
1585 .IP "RIGHTARROW [ ESC-l ]"
1586 Move the cursor one space to the right.
1587 .IP "\(haLEFTARROW [ ESC-b or ESC-LEFTARROW ]"
1588 (That is, CONTROL and LEFTARROW simultaneously.)
1589 Move the cursor one word to the left.
1590 .IP "\(haRIGHTARROW [ ESC-w or ESC-RIGHTARROW ]"
1591 (That is, CONTROL and RIGHTARROW simultaneously.)
1592 Move the cursor one word to the right.
1593 .IP "HOME [ ESC-0 ]"
1594 Move the cursor to the beginning of the line.
1596 Move the cursor to the end of the line.
1598 Delete the character to the left of the cursor,
1599 or cancel the command if the command line is empty.
1600 .IP "DELETE or [ ESC-x ]"
1601 Delete the character under the cursor.
1602 .IP "\(haBACKSPACE [ ESC-BACKSPACE ]"
1603 (That is, CONTROL and BACKSPACE simultaneously.)
1604 Delete the word to the left of the cursor.
1605 .IP "\(haDELETE [ ESC-X or ESC-DELETE ]"
1606 (That is, CONTROL and DELETE simultaneously.)
1607 Delete the word under the cursor.
1608 .IP "UPARROW [ ESC-k ]"
1609 Retrieve the previous command line.
1610 If you first enter some text and then press UPARROW,
1611 it will retrieve the previous command which begins with that text.
1612 .IP "DOWNARROW [ ESC-j ]"
1613 Retrieve the next command line.
1614 If you first enter some text and then press DOWNARROW,
1615 it will retrieve the next command which begins with that text.
1617 Complete the partial filename to the left of the cursor.
1618 If it matches more than one filename, the first match
1619 is entered into the command line.
1620 Repeated TABs will cycle thru the other matching filenames.
1621 If the completed filename is a directory, a "/" is appended to the filename.
1622 (On MS-DOS and Windows systems, a "\e" is appended.)
1623 The environment variable LESSSEPARATOR can be used to specify a
1624 different character to append to a directory name.
1625 .IP "BACKTAB [ ESC-TAB ]"
1626 Like, TAB, but cycles in the reverse direction thru the matching filenames.
1628 Complete the partial filename to the left of the cursor.
1629 If it matches more than one filename, all matches are entered into
1630 the command line (if they fit).
1631 .IP "\(haU (Unix and OS/2) or ESC (MS-DOS and Windows)"
1632 Delete the entire command line,
1633 or cancel the command if the command line is empty.
1634 If you have changed your line-kill character in Unix to something
1635 other than \(haU, that character is used instead of \(haU.
1637 Delete the entire command line and return to the main prompt.
1640 You may define your own
1642 commands by creating a lesskey source file.
1643 This file specifies a set of command keys and an action
1644 associated with each key.
1645 You may also change the line-editing keys (see LINE EDITING),
1646 and set environment variables used by
1650 manual page for details about the file format.
1652 If the environment variable LESSKEYIN is set,
1654 uses that as the name of the lesskey source file.
1657 looks in a standard place for the lesskey source file:
1660 looks for a lesskey file called "$XDG_CONFIG_HOME/lesskey" or "$HOME/.config/lesskey" or "$HOME/.lesskey".
1661 On MS-DOS and Windows systems,
1663 looks for a lesskey file called "$HOME/_lesskey", and if it is not found there,
1664 then looks for a lesskey file called "_lesskey" in any directory specified
1665 in the PATH environment variable.
1668 looks for a lesskey file called "$HOME/lesskey.ini", and if it is not found,
1669 then looks for a lesskey file called "lesskey.ini" in any directory specified
1670 in the INIT environment variable, and if it not found there,
1671 then looks for a lesskey file called "lesskey.ini" in any directory specified
1672 in the PATH environment variable.
1674 A system-wide lesskey source file may also be set up to provide key bindings.
1675 If a key is defined in both a local lesskey file and in the
1676 system-wide file, key bindings in the local file take precedence over
1677 those in the system-wide file.
1678 If the environment variable LESSKEYIN_SYSTEM is set,
1680 uses that as the name of the system-wide lesskey file.
1683 looks in a standard place for the system-wide lesskey file:
1684 On Unix systems, the system-wide lesskey file is /usr/local/etc/syslesskey.
1687 was built with a different sysconf directory than /usr/local/etc,
1688 that directory is where the sysless file is found.)
1689 On MS-DOS and Windows systems, the system-wide lesskey file is c:\e_syslesskey.
1690 On OS/2 systems, the system-wide lesskey file is c:\esyslesskey.ini.
1692 Previous versions of
1694 (before v582) used lesskey files with a binary format, produced by the
1696 program. It is no longer necessary to use the
1700 .SH "INPUT PREPROCESSOR"
1701 You may define an "input preprocessor" for
1705 opens a file, it first gives your input preprocessor a chance to modify the
1706 way the contents of the file are displayed.
1707 An input preprocessor is simply an executable program (or shell script),
1708 which writes the contents of the file to a different file,
1709 called the replacement file.
1710 The contents of the replacement file are then displayed
1711 in place of the contents of the original file.
1712 However, it will appear to the user as if the original file is opened;
1715 will display the original filename as the name of the current file.
1717 An input preprocessor receives one command line argument, the original filename,
1718 as entered by the user.
1719 It should create the replacement file, and when finished,
1720 print the name of the replacement file to its standard output.
1721 If the input preprocessor does not output a replacement filename,
1723 uses the original file, as normal.
1724 The input preprocessor is not called when viewing standard input.
1725 To set up an input preprocessor, set the LESSOPEN environment variable
1726 to a command line which will invoke your input preprocessor.
1727 This command line should include one occurrence of the string "%s",
1728 which will be replaced by the filename
1729 when the input preprocessor command is invoked.
1733 closes a file opened in such a way, it will call another program,
1734 called the input postprocessor,
1735 which may perform any desired clean-up action (such as deleting the
1736 replacement file created by LESSOPEN).
1737 This program receives two command line arguments, the original filename
1738 as entered by the user, and the name of the replacement file.
1739 To set up an input postprocessor, set the LESSCLOSE environment variable
1740 to a command line which will invoke your input postprocessor.
1741 It may include two occurrences of the string "%s";
1742 the first is replaced with the original name of the file and
1743 the second with the name of the replacement file,
1744 which was output by LESSOPEN.
1746 For example, on many Unix systems, these two scripts will allow you
1747 to keep files in compressed format, but still let
1757 *.Z) TEMPFILE=$(mktemp)
1759 uncompress \-c $1 >$TEMPFILE 2>/dev/null
1761 if [ \-s $TEMPFILE ]; then
1781 To use these scripts, put them both where they can be executed and
1782 set LESSOPEN="lessopen.sh\ %s", and
1783 LESSCLOSE="lessclose.sh\ %s\ %s".
1784 More complex LESSOPEN and LESSCLOSE scripts may be written
1785 to accept other types of compressed files, and so on.
1787 It is also possible to set up an input preprocessor to
1788 pipe the file data directly to
1790 rather than putting the data into a replacement file.
1791 This avoids the need to decompress the entire file before
1792 starting to view it.
1793 An input preprocessor that works this way is called an input pipe.
1794 An input pipe, instead of writing the name of a replacement file on
1795 its standard output,
1796 writes the entire contents of the replacement file on its standard output.
1797 If the input pipe does not write any characters on its standard output,
1798 then there is no replacement file and
1800 uses the original file, as normal.
1801 To use an input pipe,
1802 make the first character in the LESSOPEN environment variable a
1803 vertical bar (|) to signify that the input preprocessor is an input pipe.
1804 As with non-pipe input preprocessors, the command string must contain one
1805 occurrence of %s, which is replaced with the filename of the input file.
1807 For example, on many Unix systems, this script will work like the
1808 previous example scripts:
1816 *.Z) uncompress \-c $1 2>/dev/null
1829 To use this script, put it where it can be executed and set
1830 LESSOPEN="|lesspipe.sh %s".
1832 Note that a preprocessor cannot output an empty file, since that
1833 is interpreted as meaning there is no replacement, and
1834 the original file is used.
1835 To avoid this, if LESSOPEN starts with two vertical bars,
1836 the exit status of the script determines the behavior when the output is empty.
1837 If the output is empty and the exit status is zero,
1838 the empty output is considered to be replacement text.
1839 If the output is empty and the exit status is nonzero,
1840 the original file is used.
1841 For compatibility with previous versions of
1843 if LESSOPEN starts with only one vertical bar, the exit status
1844 of the preprocessor is ignored.
1846 When an input pipe is used, a LESSCLOSE postprocessor can be used,
1847 but it is usually not necessary since there is no replacement file
1849 In this case, the replacement file name passed to the LESSCLOSE
1850 postprocessor is "\-".
1852 For compatibility with previous versions of
1854 the input preprocessor or pipe is not used if
1856 is viewing standard input.
1857 However, if the first character of LESSOPEN is a dash (\-),
1858 the input preprocessor is used on standard input as well as other files.
1859 In this case, the dash is not considered to be part of
1860 the preprocessor command.
1861 If standard input is being viewed, the input preprocessor is passed
1862 a file name consisting of a single dash.
1863 Similarly, if the first two characters of LESSOPEN are vertical bar and dash
1864 (|\-) or two vertical bars and a dash (||\-),
1865 the input pipe is used on standard input as well as other files.
1866 Again, in this case the dash is not considered to be part of
1867 the input pipe command.
1869 .SH "NATIONAL CHARACTER SETS"
1870 There are three types of characters in the input file:
1871 .IP "normal characters"
1872 can be displayed directly to the screen.
1873 .IP "control characters"
1874 should not be displayed directly, but are expected to be found
1875 in ordinary text files (such as backspace and tab).
1876 .IP "binary characters"
1877 should not be displayed directly and are not expected to be found
1880 A "character set" is simply a description of which characters are to
1881 be considered normal, control, and binary.
1882 The LESSCHARSET environment variable may be used to select a character set.
1883 Possible values for LESSCHARSET are:
1885 BS, TAB, NL, CR, and formfeed are control characters,
1886 all chars with values between 32 and 126 are normal,
1887 and all others are binary.
1889 Selects an ISO 8859 character set.
1890 This is the same as ASCII, except characters between 160 and 255 are
1891 treated as normal characters.
1897 Selects a character set appropriate for MS-DOS.
1899 Selects an EBCDIC character set.
1901 Selects an EBCDIC character set used by OS/390 Unix Services.
1902 This is the EBCDIC analogue of latin1. You get similar results
1903 by setting either LESSCHARSET=IBM-1047 or LC_CTYPE=en_US
1904 in your environment.
1906 Selects a Russian character set.
1908 Selects a character set appropriate for NeXT computers.
1910 Selects the UTF-8 encoding of the ISO 10646 character set.
1911 UTF-8 is special in that it supports multi-byte characters in the input file.
1912 It is the only character set that supports multi-byte characters.
1914 Selects a character set appropriate for Microsoft Windows (cp 1252).
1916 In rare cases, it may be desired to tailor
1918 to use a character set other than the ones definable by LESSCHARSET.
1919 In this case, the environment variable LESSCHARDEF can be used
1920 to define a character set.
1921 It should be set to a string where each character in the string represents
1922 one character in the character set.
1923 The character ".\&" is used for a normal character, "c" for control,
1925 A decimal number may be used for repetition.
1926 For example, "bccc4b.\&" would mean character 0 is binary,
1927 1, 2 and 3 are control, 4, 5, 6 and 7 are binary, and 8 is normal.
1928 All characters after the last are taken to be the same as the last,
1929 so characters 9 through 255 would be normal.
1930 (This is an example, and does not necessarily
1931 represent any real character set.)
1933 This table shows the value of LESSCHARDEF which is equivalent
1934 to each of the possible values for LESSCHARSET:
1939 ascii 8bcccbcc18b95.b
1940 dos 8bcccbcc12bc5b95.b.
1941 ebcdic 5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b
1942 9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b.
1943 IBM-1047 4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc
1945 iso8859 8bcccbcc18b95.33b.
1946 koi8-r 8bcccbcc18b95.b128.
1947 latin1 8bcccbcc18b95.33b.
1948 next 8bcccbcc18b95.bb125.bb
1952 If neither LESSCHARSET nor LESSCHARDEF is set,
1953 but any of the strings "UTF-8", "UTF8", "utf-8" or "utf8"
1954 is found in the LC_ALL, LC_CTYPE or LANG
1955 environment variables, then the default character set is utf-8.
1957 If that string is not found, but your system supports the
1961 will use setlocale to determine the character set.
1962 setlocale is controlled by setting the LANG or LC_CTYPE environment
1967 interface is also not available, the default character set is utf-8.
1969 Control and binary characters are displayed in standout (reverse video).
1970 Each such character is displayed in caret notation if possible
1971 (e.g.\& \(haA for control-A). Caret notation is used only if
1972 inverting the 0100 bit results in a normal printable character.
1973 Otherwise, the character is displayed as a hex number in angle brackets.
1974 This format can be changed by
1975 setting the LESSBINFMT environment variable.
1976 LESSBINFMT may begin with a "*" and one character to select
1977 the display attribute:
1978 "*k" is blinking, "*d" is bold, "*u" is underlined, "*s" is standout,
1980 If LESSBINFMT does not begin with a "*", normal attribute is assumed.
1981 The remainder of LESSBINFMT is a string which may include one
1982 printf-style escape sequence (a % followed by x, X, o, d, etc.).
1983 For example, if LESSBINFMT is "*u[%x]", binary characters
1984 are displayed in underlined hexadecimal surrounded by brackets.
1985 The default if no LESSBINFMT is specified is "*s<%02X>".
1986 Warning: the result of expanding the character via LESSBINFMT must
1987 be less than 31 characters.
1989 When the character set is utf-8, the LESSUTFBINFMT environment variable
1990 acts similarly to LESSBINFMT but it applies to Unicode code points
1991 that were successfully decoded but are unsuitable for display (e.g.,
1992 unassigned code points).
1993 Its default value is "<U+%04lX>".
1994 Note that LESSUTFBINFMT and LESSBINFMT share their display attribute
1995 setting ("*x") so specifying one will affect both;
1996 LESSUTFBINFMT is read after LESSBINFMT so its setting, if any,
1998 Problematic octets in a UTF-8 file (octets of a truncated sequence,
1999 octets of a complete but non-shortest form sequence, invalid octets,
2000 and stray trailing octets)
2001 are displayed individually using LESSBINFMT so as to facilitate diagnostic
2002 of how the UTF-8 file is ill-formed.
2004 When the character set is utf-8, in rare cases it may be desirable to
2005 override the Unicode definition of the type of certain characters.
2006 For example, characters in a Private Use Area are normally treated as control
2007 characters, but if you are using a custom font with printable characters
2008 in that range, it may be desirable to tell
2010 to treat such characters as printable.
2011 This can be done by setting the LESSUTFCHARDEF environment variable
2012 to a comma-separated list of
2015 Each character type definition consists of either one hexadecimal codepoint
2016 or a pair of codepoints separated by a dash,
2017 followed by a colon and a type character.
2018 Each hexadecimal codepoint may optionally be preceded by a "U" or "U+".
2019 If a pair of codepoints is given, the type is set for
2020 all characters inclusively between the two values.
2021 If there are multiple comma-separated codepoint values,
2022 they must be in ascending numerical order.
2023 The type character may be one of:
2026 A normal printable character.
2028 A wide (2-space) printable character.
2030 A binary (non-printable) character.
2032 A composing (zero width) character.
2035 For example, setting LESSUTFCHARDEF to
2038 E000-F8FF:p,F0000-FFFFD:p,100000-10FFFD:p
2041 would make all Private Use Area characters be treated as printable.
2043 The \-P option allows you to tailor the prompt to your preference.
2044 The string given to the \-P option replaces the specified prompt string.
2045 Certain characters in the string are interpreted specially.
2046 The prompt mechanism is rather complicated to provide flexibility,
2047 but the ordinary user need not understand the details of constructing
2048 personalized prompt strings.
2050 A percent sign followed by a single character is expanded
2051 according to what the following character is.
2052 (References to the input file size below refer to the preprocessed size,
2053 if an input preprocessor is being used.)
2055 Replaced by the byte offset into the current input file.
2056 The b is followed by a single character (shown as \fIX\fP above)
2057 which specifies the line whose byte offset is to be used.
2058 If the character is a "t", the byte offset of the top line in the
2060 an "m" means use the middle line,
2061 a "b" means use the bottom line,
2062 a "B" means use the line just after the bottom line,
2063 and a "j" means use the "target" line, as specified by the \-j option.
2065 Replaced by the size of the current input file.
2067 Replaced by the column number of the text appearing in the first
2068 column of the screen.
2070 Replaced by the page number of a line in the input file.
2071 The line to be used is determined by the \fIX\fP, as with the %b option.
2073 Replaced by the number of pages in the input file,
2074 or equivalently, the page number of the last line in the input file.
2076 Replaced by the name of the editor (from the VISUAL environment variable,
2077 or the EDITOR environment variable if VISUAL is not defined).
2078 See the discussion of the LESSEDIT feature below.
2080 Replaced by the name of the current input file.
2082 Replaced by the last component of the name of the current input file.
2084 Replaced by the shell-escaped name of the current input file.
2085 This is useful when the expanded string will be used in a shell command,
2086 such as in LESSEDIT.
2088 Replaced by the index of the current file in the list of
2091 Replaced by the line number of a line in the input file.
2092 The line to be used is determined by the \fIX\fP, as with the %b option.
2094 Replaced by the line number of the last line in the input file.
2096 Replaced by the total number of input files.
2098 Replaced by the URI of the currently selected OSC 8 hyperlink,
2099 or a question mark if no hyperlink is selected.
2100 This is used by OSC 8 handlers as explained in the \(haO\(haO command description.
2102 Replaced by the percent into the current input file, based on byte offsets.
2103 The line used is determined by the \fIX\fP as with the %b option.
2105 Replaced by the percent into the current input file, based on line numbers.
2106 The line used is determined by the \fIX\fP as with the %b option.
2110 Causes any trailing spaces to be removed.
2111 Usually used at the end of the string, but may appear anywhere.
2113 Normally expands to the word "file".
2114 However if viewing files via a tags list using the \-t option,
2115 it expands to the word "tag".
2117 Replaced by the name of the next input file in the list.
2119 If any item is unknown (for example, the file size if input
2120 is a pipe), a question mark is printed instead.
2122 The format of the prompt string can be changed
2123 depending on certain conditions.
2124 A question mark followed by a single character acts like an "IF":
2125 depending on the following character, a condition is evaluated.
2126 If the condition is true, any characters following the question mark
2127 and condition character, up to a period, are included in the prompt.
2128 If the condition is false, such characters are not included.
2129 A colon appearing between the question mark and the
2130 period can be used to establish an "ELSE": any characters between
2131 the colon and the period are included in the string if and only if
2132 the IF condition is false.
2133 Condition characters (which follow a question mark) may be:
2135 True if any characters have been included in the prompt so far.
2137 True if the byte offset of the specified line is known.
2139 True if the size of current input file is known.
2141 True if the text is horizontally shifted (%c is not zero).
2143 True if the page number of the specified line is known.
2145 True if at end-of-file.
2147 True if there is an input filename
2148 (that is, if input is not a pipe).
2150 True if the line number of the specified line is known.
2152 True if the line number of the last line in the file is known.
2154 True if there is more than one input file.
2156 True if this is the first prompt in a new input file.
2158 True if the percent into the current input file, based on byte offsets,
2159 of the specified line is known.
2161 True if the percent into the current input file, based on line numbers,
2162 of the specified line is known.
2166 True if there is a next input file
2167 (that is, if the current input file is not the last one).
2169 Any characters other than the special ones
2170 (question mark, colon, period, percent, and backslash)
2171 become literally part of the prompt.
2172 Any of the special characters may be included in the prompt literally
2173 by preceding it with a backslash.
2177 ?f%f:Standard input.
2179 This prompt prints the filename, if known;
2180 otherwise the string "Standard input".
2182 ?f%f \&.?ltLine %lt:?pt%pt\e%:?btByte %bt:-...
2184 This prompt would print the filename, if known.
2185 The filename is followed by the line number, if known,
2186 otherwise the percent if known, otherwise the byte offset if known.
2187 Otherwise, a dash is printed.
2188 Notice how each question mark has a matching period,
2189 and how the % after the %pt
2190 is included literally by escaping it with a backslash.
2192 ?n?f%f\ .?m(%T %i of %m)\ ..?e(END)\ ?x-\ Next\e:\ %x..%t
2194 This prints the filename if this is the first prompt in a file,
2195 followed by the "file N of N" message if there is more
2196 than one input file.
2197 Then, if we are at end-of-file, the string "(END)" is printed
2198 followed by the name of the next file, if there is one.
2199 Finally, any trailing spaces are truncated.
2200 This is the default prompt.
2201 For reference, here are the defaults for
2202 the other two prompts (\-m and \-M respectively).
2203 Each is broken into two lines here for readability only.
2206 ?n?f%f\ .?m(%T\ %i\ of\ %m)\ ..?e(END)\ ?x-\ Next\e:\ %x.:
2207 ?pB%pB\e%:byte\ %bB?s/%s...%t
2209 ?f%f\ .?n?m(%T\ %i\ of\ %m)\ ..?ltlines\ %lt-%lb?L/%L.\ :
2210 byte\ %bB?s/%s.\ .?e(END)\ ?x-\ Next\e:\ %x.:?pB%pB\e%..%t
2213 And here is the default message produced by the = command:
2216 ?f%f\ .?m(%T\ %i\ of\ %m)\ .?ltlines\ %lt-%lb?L/%L.\ .
2217 byte\ %bB?s/%s.\ ?e(END)\ :?pB%pB\e%..%t
2220 The prompt expansion features are also used for another purpose:
2221 if an environment variable LESSEDIT is defined, it is used
2222 as the command to be executed when the v command is invoked.
2223 The LESSEDIT string is expanded in the same way as the prompt strings.
2224 The default value for LESSEDIT is:
2230 Note that this expands to the editor name, followed by a + and the
2231 line number, followed by the shell-escaped file name.
2232 If your editor does not accept the "+linenumber" syntax, or has other
2233 differences in invocation syntax, the LESSEDIT variable can be
2234 changed to modify this default.
2237 When the environment variable LESSSECURE is set to 1,
2239 runs in a "secure" mode.
2240 In this mode, these features are disabled:
2242 the edit command (v)
2244 the examine command (:e)
2246 metacharacters such as * in filenames,
2248 and filename completion (TAB, \(haL)
2252 use of lesskey files (-k and \-\-lesskey-src)
2254 input preprocessor (LESSOPEN environment variable)
2256 log files (s and \-o)
2258 opening OSC 8 links (\(haO\(haO)
2260 the pipe command (|)
2262 the shell and pshell commands (! and #)
2266 via a SIGSTOP signal
2268 use of tags files (-t)
2270 The LESSSECURE_ALLOW environment variable can be set to a comma-separated list
2271 of names of features which are selectively enabled when LESSSECURE is set.
2272 Each feature name is the first word in each line in the above list.
2273 A feature name may be abbreviated as long as the abbreviation is unambiguous.
2280 LESSSECURE_ALLOW=hist,edit
2282 were set, all of the above features would be disabled
2283 except for history files and the edit command.
2285 Less can also be compiled to be permanently in "secure" mode.
2286 In that case, the LESSSECURE and LESSSECURE_ALLOW variables are ignored.
2288 .SH "COMPATIBILITY WITH MORE"
2289 If the environment variable LESS_IS_MORE is set to 1,
2290 or if the program is invoked via a file link named "more",
2292 behaves (mostly) in conformance with the POSIX
2294 command specification.
2295 In this mode, less behaves differently in these ways:
2297 The \-e option works differently.
2298 If the \-e option is not set,
2300 behaves as if the \-e option were set.
2301 If the \-e option is set,
2303 behaves as if the \-E option were set.
2305 The \-m option works differently.
2306 If the \-m option is not set, the medium prompt is used,
2307 and it is prefixed with the string "\-\-More\-\-".
2308 If the \-m option is set, the short prompt is used.
2310 The \-n option acts like the \-z option.
2311 The normal behavior of the \-n option is unavailable in this mode.
2313 The parameter to the \-p option is taken to be a
2315 command rather than a search pattern.
2317 The LESS environment variable is ignored,
2318 and the MORE environment variable is used in its place.
2320 .SH "ENVIRONMENT VARIABLES"
2321 Environment variables may be specified either in the system environment
2325 If environment variables are defined in more than one place,
2326 variables defined in a local lesskey file take precedence over
2327 variables defined in the system environment, which take precedence
2328 over variables defined in the system-wide lesskey file.
2330 Sets the number of columns on the screen.
2331 Takes precedence over the number of columns specified by the TERM variable.
2332 (But if you have a windowing system which supports TIOCGWINSZ or WIOCGETD,
2333 the window system's idea of the screen size takes precedence over the
2334 LINES and COLUMNS environment variables.)
2336 The name of the editor (used for the v command).
2338 Name of the user's home directory
2339 (used to find a lesskey file on Unix and OS/2 systems).
2340 .IP "HOMEDRIVE, HOMEPATH"
2341 Concatenation of the HOMEDRIVE and HOMEPATH environment variables is
2342 the name of the user's home directory if the HOME variable is not set
2343 (only in the Windows version).
2345 Name of the user's init directory (used to find a lesskey file on OS/2 systems).
2347 Language for determining the character set.
2349 Language for determining the character set.
2351 Options which are passed to
2354 .IP LESSANSIENDCHARS
2355 Characters which may end an ANSI color escape sequence
2357 .IP LESSANSIMIDCHARS
2358 Characters which may appear between the ESC character and the
2359 end character in an ANSI color escape sequence
2360 (default "0123456789:;[?!"\(aq#%()*+\ ".
2362 Format for displaying non-printable, non-control characters.
2364 Defines a character set.
2366 Selects a predefined character set.
2368 Command line to invoke the (optional) input-postprocessor.
2370 Name of the lessecho program (default "lessecho").
2371 The lessecho program is needed to expand metacharacters, such as * and ?,
2372 in filenames on Unix systems.
2374 Editor prototype string (used for the v command).
2375 See discussion under PROMPTS.
2377 Name of the command used by the \-t option to find global tags.
2378 Normally should be set to "global" if your system has the
2380 command. If not set, global tags are not used.
2382 Name of the history file used to remember search commands and
2383 shell commands between invocations of
2385 If set to "\-" or "/dev/null", a history file is not used.
2386 The default depends on the operating system, but is usually:
2388 .IP "Linux and Unix"
2389 "$XDG_STATE_HOME/lesshst" or "$HOME/.local/state/lesshst" or
2390 "$XDG_DATA_HOME/lesshst" or "$HOME/.lesshst".
2391 .IP "Windows and MS-DOS"
2394 "$HOME/lesshst.ini" or "$INIT/lesshst.ini".
2397 The maximum number of commands to save in the history file.
2406 file. (Not used if "$LESSKEYIN" exists.)
2408 The value is parsed as if it were the parameter of a \-\-lesskey-content option.
2409 .IP LESSKEYIN_SYSTEM
2410 Name of the default system-wide
2414 Name of the default system-wide
2416 file. (Not used if "$LESSKEYIN_SYSTEM" exists.)
2418 List of characters which are considered "metacharacters" by the shell.
2420 Prefix which less will add before each metacharacter in a
2421 command sent to the shell.
2422 If LESSMETAESCAPE is an empty string, commands containing
2423 metacharacters will not be passed to the shell.
2425 Command line to invoke the (optional) input-preprocessor.
2427 Runs less in "secure" mode.
2428 See discussion under SECURITY.
2429 .IP LESSSECURE_ALLOW
2430 Enables individual features which are normally disabled by LESSSECURE.
2431 See discussion under SECURITY.
2433 String to be appended to a directory name in filename completion.
2435 Format for displaying non-printable Unicode code points.
2437 Overrides the type of specified Unicode characters.
2439 Sets the number of columns on the screen.
2440 Unlike COLUMNS, takes precedence over the system's idea of the screen size,
2441 so it can be used to make
2443 use less than the full screen width.
2444 If set to a negative number, sets the number of columns used to
2445 this much less than the actual screen width.
2447 Sets the number of lines on the screen.
2448 Unlike LINES, takes precedence over the system's idea of the screen size,
2449 so it can be used to make
2451 use less than the full screen height.
2452 If set to a negative number, sets the number of lines used to
2453 this much less than the actual screen height.
2456 repaints the entire screen on every movement command,
2457 so scrolling may be slower.
2459 Duration (in milliseconds) after starting to read data from the input,
2460 after which the "Waiting for data" message will be displayed.
2461 The default is 4000 (4 seconds).
2467 Where "xxx" is a URI scheme such as "http" or "file",
2468 sets an OSC 8 handler for opening OSC 8 links containing a URI with that scheme.
2470 Sets an OSC 8 handler for opening OSC 8 links for which there is
2471 no specific LESS_OSC8_xxx handler set for the "xxx" scheme.
2473 Where "xx" is any two characters, overrides the definition
2474 of the termcap "xx" capability for the terminal.
2476 A space-separated list of command line options.
2477 These options will be ignored (with no error message) if they appear
2478 on the command line or in the LESS environment variable.
2479 Options listed in LESS_UNSUPPORT can still be changed by the \- and \-\- commands.
2480 Each option in LESS_UNSUPPORT is a dash followed by a single character
2481 option letter, or two dashes followed by a long option name.
2483 Sets the number of lines on the screen.
2484 Takes precedence over the number of lines specified by the TERM variable.
2485 (But if you have a windowing system which supports TIOCGWINSZ or WIOCGETD,
2486 the window system's idea of the screen size takes precedence over the
2487 LINES and COLUMNS environment variables.)
2489 Options which are passed to
2491 automatically when running in
2492 .BR more "-compatible mode."
2494 User's search path (used to find a lesskey file
2495 on MS-DOS, Windows, and OS/2 systems).
2497 The shell used to execute the !\& command, as well as to expand filenames.
2499 The type of terminal on which
2503 The name of the editor (used for the v command).
2505 Possible location of the
2507 file; see the KEY BINDINGS section.
2509 Possible location of the history file; see the description of the LESSHISTFILE environment variable.
2511 Possible location of the history file; see the description of the LESSHISTFILE environment variable.
2518 Copyright (C) 1984-2024 Mark Nudelman
2520 less is part of the GNU project and is free software.
2521 You can redistribute it and/or modify it
2522 under the terms of either
2523 (1) the GNU General Public License as published by
2524 the Free Software Foundation; or (2) the Less License.
2525 See the file README in the less distribution for more details
2526 regarding redistribution.
2527 You should have received a copy of the GNU General Public License
2528 along with the source for less; see the file COPYING.
2529 If not, write to the Free Software Foundation, 59 Temple Place,
2530 Suite 330, Boston, MA 02111-1307, USA.
2531 You should also have received a copy of the Less License;
2532 see the file LICENSE.
2534 less is distributed in the hope that it will be useful, but
2535 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
2536 or FITNESS FOR A PARTICULAR PURPOSE.
2537 See the GNU General Public License for more details.
2545 https://github.com/gwsw/less/issues.
2548 For more information, see the less homepage at
2551 https://greenwoodsoftware.com/less.