Imported Upstream version 643
[platform/upstream/less.git] / less.nro
1 '\" t
2 .TH LESS 1 "Version 643: 20 Jul 2023"
3 .SH NAME
4 less \- opposite of more
5 .SH SYNOPSIS
6 .B "less \-?"
7 .br
8 .B "less \-\-help"
9 .br
10 .B "less \-V"
11 .br
12 .B "less \-\-version"
13 .br
14 .B "less [\-[+]aABcCdeEfFgGiIJKLmMnNqQrRsSuUVwWX\(ti]"
15 .br
16 .B "     [\-b \fIspace\/\fP] [\-h \fIlines\/\fP] [\-j \fIline\/\fP] [\-k \fIkeyfile\/\fP]"
17 .br
18 .B "     [\-{oO} \fIlogfile\/\fP] [\-p \fIpattern\/\fP] [\-P \fIprompt\/\fP] [\-t \fItag\/\fP]"
19 .br
20 .B "     [\-T \fItagsfile\/\fP] [\-x \fItab\/\fP,...] [\-y \fIlines\/\fP] [\-[z] \fIlines\/\fP]"
21 .br
22 .B "     [\-# \fIshift\/\fP] [+[+]\fIcmd\/\fP] [\-\-] [\fIfilename\/\fP]..."
23 .br
24 (See the OPTIONS section for alternate option syntax with long option names.)
25 .
26 .SH DESCRIPTION
27 .B Less
28 is a program similar to
29 .BR more (1),
30 but which allows backward movement
31 in the file as well as forward movement.
32 Also,
33 .B less
34 does not have to read the entire input file before starting,
35 so with large input files it starts up faster than text editors like
36 .BR vi (1).
37 .B Less
38 uses termcap (or terminfo on some systems),
39 so it can run on a variety of terminals.
40 There is even limited support for hardcopy terminals.
41 (On a hardcopy terminal, lines which should be printed at the top
42 of the screen are prefixed with a caret.)
43 .PP
44 Commands are based on both
45 .B more
46 and
47 .BR vi .
48 Commands may be preceded by a decimal number,
49 called N in the descriptions below.
50 The number is used by some commands, as indicated.
51 .
52 .SH COMMANDS
53 In the following descriptions, \(haX means control-X.
54 ESC stands for the ESCAPE key; for example ESC-v means the
55 two character sequence "ESCAPE", then "v".
56 .IP "h or H"
57 Help: display a summary of these commands.
58 If you forget all the other commands, remember this one.
59 .IP "SPACE or \(haV or f or \(haF"
60 Scroll forward N lines, default one window (see option \-z below).
61 If N is more than the screen size, only the final screenful is displayed.
62 Warning: some systems use \(haV as a special literalization character.
63 .IP "z"
64 Like SPACE, but if N is specified, it becomes the new window size.
65 .IP "ESC-SPACE"
66 Like SPACE, but scrolls a full screenful, even if it reaches
67 end-of-file in the process.
68 .IP "ENTER or RETURN or \(haN or e or \(haE or j or \(haJ"
69 Scroll forward N lines, default 1.
70 The entire N lines are displayed, even if N is more than the screen size.
71 .IP "d or \(haD"
72 Scroll forward N lines, default one half of the screen size.
73 If N is specified, it becomes the new default for
74 subsequent d and u commands.
75 .IP "b or \(haB or ESC-v"
76 Scroll backward N lines, default one window (see option \-z below).
77 If N is more than the screen size, only the final screenful is displayed.
78 .IP "w"
79 Like ESC-v, but if N is specified, it becomes the new window size.
80 .IP "y or \(haY or \(haP or k or \(haK"
81 Scroll backward N lines, default 1.
82 The entire N lines are displayed, even if N is more than the screen size.
83 Warning: some systems use \(haY as a special job control character.
84 .IP "u or \(haU"
85 Scroll backward N lines, default one half of the screen size.
86 If N is specified, it becomes the new default for
87 subsequent d and u commands.
88 .IP "J"
89 Like j, but continues to scroll beyond the end of the file.
90 .IP "K or Y"
91 Like k, but continues to scroll beyond the beginning of the file.
92 .IP "ESC-) or RIGHTARROW"
93 Scroll horizontally right N characters, default half the screen width
94 (see the \-# option).
95 If a number N is specified, it becomes the default for future RIGHTARROW
96 and LEFTARROW commands.
97 While the text is scrolled, it acts as though the \-S option
98 (chop lines) were in effect.
99 .IP "ESC-( or LEFTARROW"
100 Scroll horizontally left N characters, default half the screen width
101 (see the \-# option).
102 If a number N is specified, it becomes the default for future RIGHTARROW
103 and LEFTARROW commands.
104 .IP "ESC-} or \(haRIGHTARROW"
105 Scroll horizontally right to show the end of the longest displayed line.
106 .IP "ESC-{ or \(haLEFTARROW"
107 Scroll horizontally left back to the first column.
108 .IP "r or \(haR or \(haL"
109 Repaint the screen.
110 .IP R
111 Repaint the screen, discarding any buffered input.
112 That is, reload the current file.
113 Useful if the file is changing while it is being viewed.
114 .IP "F"
115 Scroll forward, and keep trying to read when the
116 end of file is reached.
117 Normally this command would be used when already at the end of the file.
118 It is a way to monitor the tail of a file which is growing
119 while it is being viewed.
120 (The behavior is similar to the "tail \-f" command.)
121 To stop waiting for more data, enter the interrupt character (usually \(haC).
122 On systems which support
123 .BR poll (2)
124 you can also use \(haX or the character specified by the \-\-intr option.
125 If the input is a pipe and the \-\-exit-follow-on-close option is in effect,
126 .B less
127 will automatically stop waiting for data when the input side 
128 of the pipe is closed.
129 .IP "ESC-F"
130 Like F, but as soon as a line is found which matches
131 the last search pattern, the terminal bell is rung
132 and forward scrolling stops.
133 .IP "g or < or ESC-<"
134 Go to line N in the file, default 1 (beginning of file).
135 (Warning: this may be slow if N is large.)
136 .IP "G or > or ESC->"
137 Go to line N in the file, default the end of the file.
138 (Warning: this may be slow if N is large,
139 or if N is not specified and
140 standard input, rather than a file, is being read.)
141 .IP "ESC-G"
142 Same as G, except if no number N is specified and the input is standard input,
143 goes to the last line which is currently buffered.
144 .IP "p or %"
145 Go to a position N percent into the file.
146 N should be between 0 and 100, and may contain a decimal point.
147 .IP "P"
148 Go to the line containing byte offset N in the file.
149 .IP "{"
150 If a left curly bracket appears in the top line displayed
151 on the screen,
152 the { command will go to the matching right curly bracket.
153 The matching right curly bracket is positioned on the bottom
154 line of the screen.
155 If there is more than one left curly bracket on the top line,
156 a number N may be used to specify the N-th bracket on the line.
157 .IP "}"
158 If a right curly bracket appears in the bottom line displayed
159 on the screen,
160 the } command will go to the matching left curly bracket.
161 The matching left curly bracket is positioned on the top
162 line of the screen.
163 If there is more than one right curly bracket on the bottom line,
164 a number N may be used to specify the N-th bracket on the line.
165 .IP "("
166 Like {, but applies to parentheses rather than curly brackets.
167 .IP ")"
168 Like }, but applies to parentheses rather than curly brackets.
169 .IP "["
170 Like {, but applies to square brackets rather than curly brackets.
171 .IP "]"
172 Like }, but applies to square brackets rather than curly brackets.
173 .IP "ESC-\(haF"
174 Followed by two characters,
175 acts like {, but uses the two characters as open and close brackets,
176 respectively.
177 For example, "ESC \(haF < >" could be used to
178 go forward to the > which matches the < in the top displayed line.
179 .IP "ESC-\(haB"
180 Followed by two characters,
181 acts like }, but uses the two characters as open and close brackets,
182 respectively.
183 For example, "ESC \(haB < >" could be used to
184 go backward to the < which matches the > in the bottom displayed line.
185 .IP m
186 Followed by any lowercase or uppercase letter,
187 marks the first displayed line with that letter.
188 If the status column is enabled via the \-J option,
189 the status column shows the marked line.
190 .IP M
191 Acts like m, except the last displayed line is marked
192 rather than the first displayed line.
193 .IP "\(aq"
194 (Single quote.)
195 Followed by any lowercase or uppercase letter, returns to the position which
196 was previously marked with that letter.
197 Followed by another single quote, returns to the position at
198 which the last "large" movement command was executed.
199 Followed by a \(ha or $, jumps to the beginning or end of the
200 file respectively.
201 Marks are preserved when a new file is examined,
202 so the \(aq command can be used to switch between input files.
203 .IP "\(haX\(haX"
204 Same as single quote.
205 .IP "ESC-m"
206 Followed by any lowercase or uppercase letter,
207 clears the mark identified by that letter.
208 .IP /pattern
209 Search forward in the file for the N-th line containing the pattern.
210 N defaults to 1.
211 The pattern is a regular expression, as recognized by
212 the regular expression library supplied by your system.
213 By default, searching is case-sensitive (uppercase and lowercase 
214 are considered different); the \-i option can be used to change this.
215 The search starts at the first line displayed
216 (but see the \-a and \-j options, which change this).
217 .sp
218 Certain characters are special
219 if entered at the beginning of the pattern;
220 they modify the type of search rather than become part of the pattern:
221 .RS
222 .IP "\(haN or !"
223 Search for lines which do NOT match the pattern.
224 .IP "\(haE or *"
225 Search multiple files.
226 That is, if the search reaches the END of the current file
227 without finding a match,
228 the search continues in the next file in the command line list.
229 .IP "\(haF or @"
230 Begin the search at the first line of the FIRST file
231 in the command line list,
232 regardless of what is currently displayed on the screen
233 or the settings of the \-a or \-j options.
234 .IP "\(haK"
235 Highlight any text which matches the pattern on the current screen,
236 but don't move to the first match (KEEP current position).
237 .IP "\(haR"
238 Don't interpret regular expression metacharacters;
239 that is, do a simple textual comparison.
240 .IP "\(haS"
241 Followed by a digit N between 1 and 5.
242 Only text which has a non-empty match for the N-th parenthesized SUB-PATTERN 
243 will be considered to match the pattern.
244 (Supported only if
245 .B less 
246 is built with one of the regular expression libraries
247 .BR posix ", " pcre ", or " pcre2 ".)"
248 Multiple \(haS modifiers can be specified,
249 to match more than one sub-pattern.
250 .IP "\(haW"
251 WRAP around the current file.
252 That is, if the search reaches the end of the current file
253 without finding a match, the search continues from the first line of the
254 current file up to the line where it started.
255 If the \(haW modifier is set, the \(haE modifier is ignored.
256 .RE
257 .IP ?pattern
258 Search backward in the file for the N-th line containing the pattern.
259 The search starts at the last line displayed
260 (but see the \-a and \-j options, which change this).
261 .sp
262 Certain characters are special as in the / command:
263 .RS
264 .IP "\(haN or !"
265 Search for lines which do NOT match the pattern.
266 .IP "\(haE or *"
267 Search multiple files.
268 That is, if the search reaches the beginning of the current file
269 without finding a match,
270 the search continues in the previous file in the command line list.
271 .IP "\(haF or @"
272 Begin the search at the last line of the last file
273 in the command line list,
274 regardless of what is currently displayed on the screen
275 or the settings of the \-a or \-j options.
276 .IP "\(haK"
277 As in forward searches.
278 .IP "\(haR"
279 As in forward searches.
280 .IP "\(haS"
281 As in forward searches.
282 .IP "\(haW"
283 WRAP around the current file.
284 That is, if the search reaches the beginning of the current file
285 without finding a match, the search continues from the last line of the
286 current file up to the line where it started.
287 .RE
288 .IP "ESC-/pattern"
289 Same as "/*".
290 .IP "ESC-?pattern"
291 Same as "?*".
292 .IP n
293 Repeat previous search, for N-th line containing the last pattern.
294 If the previous search was modified by \(haN, the search is made for the
295 N-th line NOT containing the pattern.
296 If the previous search was modified by \(haE, the search continues
297 in the next (or previous) file if not satisfied in the current file.
298 If the previous search was modified by \(haR, the search is done
299 without using regular expressions.
300 There is no effect if the previous search was modified by \(haF or \(haK.
301 .IP N
302 Repeat previous search, but in the reverse direction.
303 .IP "ESC-n"
304 Repeat previous search, but crossing file boundaries.
305 The effect is as if the previous search were modified by *.
306 .IP "ESC-N"
307 Repeat previous search, but in the reverse direction
308 and crossing file boundaries.
309 .IP "ESC-u"
310 Undo search highlighting.
311 Turn off highlighting of strings matching the current search pattern.
312 If highlighting is already off because of a previous ESC-u command,
313 turn highlighting back on.
314 Any search command will also turn highlighting back on.
315 (Highlighting can also be disabled by toggling the \-G option;
316 in that case search commands do not turn highlighting back on.)
317 .IP "ESC-U"
318 Like ESC-u but also clears the saved search pattern.
319 If the status column is enabled via the \-J option,
320 this clears all search matches marked in the status column.
321 .IP "&pattern"
322 Display only lines which match the pattern;
323 lines which do not match the pattern are not displayed.
324 If pattern is empty (if you type & immediately followed by ENTER),
325 any filtering is turned off, and all lines are displayed.
326 While filtering is in effect, an ampersand is displayed at the
327 beginning of the prompt,
328 as a reminder that some lines in the file may be hidden.
329 Multiple & commands may be entered, in which case only lines
330 which match all of the patterns will be displayed.
331 .sp
332 Certain characters are special as in the / command:
333 .RS
334 .IP "\(haN or !"
335 Display only lines which do NOT match the pattern.
336 .IP "\(haR"
337 Don't interpret regular expression metacharacters;
338 that is, do a simple textual comparison.
339 .RE
340 .IP ":e [filename]"
341 Examine a new file.
342 If the filename is missing, the "current" file (see the :n and :p commands
343 below) from the list of files in the command line is re-examined.
344 A percent sign (%) in the filename is replaced by the name of the
345 current file.
346 A pound sign (#) is replaced by the name of the previously examined file.
347 However, two consecutive percent signs are simply
348 replaced with a single percent sign.
349 This allows you to enter a filename that contains a percent sign
350 in the name.
351 Similarly, two consecutive pound signs are replaced with a single pound sign.
352 The filename is inserted into the command line list of files
353 so that it can be seen by subsequent :n and :p commands.
354 If the filename consists of several files, they are all inserted into
355 the list of files and the first one is examined.
356 If the filename contains one or more spaces,
357 the entire filename should be enclosed in double quotes
358 (also see the \-" option).
359 .IP "\(haX\(haV or E"
360 Same as :e.
361 Warning: some systems use \(haV as a special literalization character.
362 On such systems, you may not be able to use \(haV.
363 .IP ":n"
364 Examine the next file (from the list of files given in the command line).
365 If a number N is specified, the N-th next file is examined.
366 .IP ":p"
367 Examine the previous file in the command line list.
368 If a number N is specified, the N-th previous file is examined.
369 .IP ":x"
370 Examine the first file in the command line list.
371 If a number N is specified, the N-th file in the list is examined.
372 .IP ":d"
373 Remove the current file from the list of files.
374 .IP "t"
375 Go to the next tag, if there were more than one matches for the current tag.
376 See the \-t option for more details about tags.
377 .IP "T"
378 Go to the previous tag, if there were more than one matches for the current tag.
379 .IP "= or \(haG or :f"
380 Prints some information about the file being viewed,
381 including its name
382 and the line number and byte offset of the bottom line being displayed.
383 If possible, it also prints the length of the file,
384 the number of lines in the file
385 and the percent of the file above the last displayed line.
386 .IP \-
387 Followed by one of the command line option letters (see OPTIONS below),
388 this will change the setting of that option
389 and print a message describing the new setting.
390 If a \(haP (CONTROL-P) is entered immediately after the dash,
391 the setting of the option is changed but no message is printed.
392 If the option letter has a numeric value (such as \-b or \-h),
393 or a string value (such as \-P or \-t),
394 a new value may be entered after the option letter.
395 If no new value is entered, a message describing
396 the current setting is printed and nothing is changed.
397 .IP \-\-
398 Like the \- command, but takes a long option name (see OPTIONS below)
399 rather than a single option letter.
400 You must press ENTER or RETURN after typing the option name.
401 A \(haP immediately after the second dash suppresses printing of a
402 message describing the new setting, as in the \- command.
403 .IP \-+
404 Followed by one of the command line option letters
405 this will reset the option to its default setting
406 and print a message describing the new setting.
407 (The "\-+\fIX\fP" command does the same thing
408 as "\-+\fIX\fP" on the command line.)
409 This does not work for string-valued options.
410 .IP \-\-+
411 Like the \-+ command, but takes a long option name
412 rather than a single option letter.
413 .IP \-!
414 Followed by one of the command line option letters,
415 this will reset the option to the "opposite" of its default setting
416 and print a message describing the new setting.
417 This does not work for numeric or string-valued options.
418 .IP \-\-!
419 Like the \-!\& command, but takes a long option name
420 rather than a single option letter.
421 .IP _
422 (Underscore.)
423 Followed by one of the command line option letters,
424 this will print a message describing the current setting of that option.
425 The setting of the option is not changed.
426 .IP __
427 (Double underscore.)
428 Like the _ (underscore) command, but takes a long option name
429 rather than a single option letter.
430 You must press ENTER or RETURN after typing the option name.
431 .IP +cmd
432 Causes the specified cmd to be executed each time a new file is examined.
433 For example, +G causes
434 .B less
435 to initially display each file starting at the end
436 rather than the beginning.
437 .IP V
438 Prints the version number of
439 .B less
440 being run.
441 .IP "q or Q or :q or :Q or ZZ"
442 Exits
443 .BR less .
444 .PP
445 The following
446 six
447 commands may or may not be valid, depending on your particular installation.
448 .
449 .IP v
450 Invokes an editor to edit the current file being viewed.
451 The editor is taken from the environment variable VISUAL if defined,
452 or EDITOR if VISUAL is not defined,
453 or defaults to "vi" if neither VISUAL nor EDITOR is defined.
454 See also the discussion of LESSEDIT under the section on PROMPTS below.
455 .IP "! shell-command"
456 Invokes a shell to run the shell-command given.
457 A percent sign (%) in the command is replaced by the name of the
458 current file.
459 A pound sign (#) is replaced by the name of the previously examined file.
460 "!!" repeats the last shell command.
461 "!" with no shell command simply invokes a shell.
462 On Unix systems, the shell is taken from the environment variable SHELL,
463 or defaults to "sh".
464 On MS-DOS and OS/2 systems, the shell is the normal command processor.
465 .IP "# shell-command"
466 Similar to the "!" command, 
467 except that the command is expanded in the same way as prompt strings.
468 For example, the name of the current file would be given as "%f".
469 .IP "| <m> shell-command"
470 <m> represents any mark letter.
471 Pipes a section of the input file to the given shell command.
472 The section of the file to be piped is between the position marked by
473 the letter and the current screen.
474 The entire current screen is included, regardless of whether the
475 marked position is before or after the current screen.
476 <m> may also be \(ha or $ to indicate beginning or end of file respectively.
477 If <m> is \&.\& or newline, the current screen is piped.
478 .IP "s filename"
479 Save the input to a file.
480 This works only if the input is a pipe, not an ordinary file.
481 .IP "\(haX"
482 When the "Waiting for data" message is displayed,
483 such as while in the F command, pressing \(haX
484 will stop
485 .B less
486 from waiting and return to a prompt.
487 This may cause
488 .B less
489 to think that the file ends at the current position,
490 so it may be necessary to use the R or F command to see more data.
491 The \-\-intr option can be used to specify a different character
492 to use instead of \(haX.
493 This command works only on systems that support the
494 .BR poll (2)
495 function.
496 On systems without
497 .BR poll (2),
498 the interrupt character (usually \(haC) can be used instead.
499 .
500 .SH OPTIONS
501 Command line options are described below.
502 Most options may be changed while
503 .B less
504 is running, via the "\-" command.
505 .PP
506 Some options may be given in one of two forms:
507 either a dash followed by a single letter,
508 or two dashes followed by a long option name.
509 A long option name may be abbreviated as long as
510 the abbreviation is unambiguous.
511 For example, \-\-quit-at-eof may be abbreviated \-\-quit, but not
512 \-\-qui, since both \-\-quit-at-eof and \-\-quiet begin with \-\-qui.
513 Some long option names are in uppercase, such as \-\-QUIT-AT-EOF, as
514 distinct from \-\-quit-at-eof.
515 Such option names need only have their first letter capitalized;
516 the remainder of the name may be in either case.
517 For example, \-\-Quit-at-eof is equivalent to \-\-QUIT-AT-EOF.
518 .PP
519 Options are also taken from the environment variable "LESS".
520 For example,
521 to avoid typing "less \-options \&...\&" each time
522 .B less
523 is invoked, you might tell
524 .BR csh :
525 .sp
526 setenv LESS "\-options"
527 .sp
528 or if you use
529 .BR sh :
530 .sp
531 LESS="\-options"; export LESS
532 .sp
533 On MS-DOS, you don't need the quotes, but you should replace any
534 percent signs in the options string by double percent signs.
535 .sp
536 The environment variable is parsed before the command line,
537 so command line options override the LESS environment variable.
538 If an option appears in the LESS variable, it can be reset
539 to its default value on the command line by beginning the command
540 line option with "\-+".
541 .sp
542 Some options like \-k or \-D require a string to follow the option letter.
543 The string for that option is considered to end when a dollar sign ($) is found.
544 For example, you can set two \-D options like this:
545 .sp
546 LESS="Dn9.1$Ds4.1"
547 .sp
548 If the \-\-use-backslash option appears earlier in the options, then
549 a dollar sign or backslash may be included literally in an option string
550 by preceding it with a backslash.
551 If the \-\-use-backslash option is not in effect, then backslashes are
552 not treated specially, and there is no way to include a dollar sign
553 in the option string.
554 .IP "\-? or \-\-help"
555 This option displays a summary of the commands accepted by
556 .B less
557 (the same as the h command).
558 (Depending on how your shell interprets the question mark,
559 it may be necessary to quote the question mark, thus: "\-\e?".)
560 .IP "\-a or \-\-search-skip-screen"
561 By default, forward searches start at the top of the displayed screen
562 and backwards searches start at the bottom of the displayed screen
563 (except for repeated searches invoked by the n or N commands,
564 which start after or before the "target" line respectively;
565 see the \-j option for more about the target line).
566 The \-a option causes forward searches to instead start at
567 the bottom of the screen
568 and backward searches to start at the top of the screen,
569 thus skipping all lines displayed on the screen.
570 .IP "\-A or \-\-SEARCH-SKIP-SCREEN"
571 Causes all forward searches (not just non-repeated searches)
572 to start just after the target line, and all backward searches
573 to start just before the target line.
574 Thus, forward searches will skip part of the displayed screen
575 (from the first line up to and including the target line).
576 Similarly backwards searches will skip the displayed screen
577 from the last line up to and including the target line.
578 This was the default behavior in less versions prior to 441.
579 .IP "\-b\fIn\fP or \-\-buffers=\fIn\fP"
580 Specifies the amount of buffer space
581 .B less
582 will use for each file, in units of kilobytes (1024 bytes).
583 By default 64\ KB of buffer space is used for each file
584 (unless the file is a pipe; see the \-B option).
585 The \-b option specifies instead that \fIn\fP kilobytes of
586 buffer space should be used for each file.
587 If \fIn\fP is \-1, buffer space is unlimited; that is,
588 the entire file can be read into memory.
589 .IP "\-B or \-\-auto-buffers"
590 By default, when data is read from a pipe,
591 buffers are allocated automatically as needed.
592 If a large amount of data is read from the pipe, this can cause
593 a large amount of memory to be allocated.
594 The \-B option disables this automatic allocation of buffers for pipes,
595 so that only 64\ KB
596 (or the amount of space specified by the \-b option)
597 is used for the pipe.
598 Warning: use of \-B can result in erroneous display, since only the
599 most recently viewed part of the piped data is kept in memory;
600 any earlier data is lost.
601 Lost characters are displayed as question marks.
602 .IP "\-c or \-\-clear-screen"
603 Causes full screen repaints to be painted from the top line down.
604 By default,
605 full screen repaints are done by scrolling from the bottom of the screen.
606 .IP "\-C or \-\-CLEAR-SCREEN"
607 Same as \-c, for compatibility with older versions of
608 .BR less .
609 .IP "\-d or \-\-dumb"
610 The \-d option suppresses the error message
611 normally displayed if the terminal is dumb;
612 that is, lacks some important capability,
613 such as the ability to clear the screen or scroll backward.
614 The \-d option does not otherwise change the behavior of
615 .B less
616 on a dumb terminal.
617 .IP "\-D\fBx\fP\fIcolor\fP or \-\-color=\fBx\fP\fIcolor\fP"
618 Changes the color of different parts of the displayed text.
619 \fBx\fP is a single character which selects the type of text 
620 whose color is being set:
621 .RS
622 .IP "B"
623 Binary characters.
624 .IP "C"
625 Control characters.
626 .IP "E"
627 Errors and informational messages.
628 .IP "H"
629 Header lines and columns, set via the \-\-header option.
630 .IP "M"
631 Mark letters in the status column.
632 .IP "N"
633 Line numbers enabled via the \-N option.
634 .IP "P"
635 Prompts.
636 .IP "R"
637 The rscroll character.
638 .IP "S"
639 Search results.
640 .IP "1-5"
641 The text in a search result which matches
642 the first through fifth parenthesized sub-pattern.
643 Sub-pattern coloring works only if
644 .B less 
645 is built with one of the regular expression libraries
646 .BR posix ", " pcre ", or " pcre2 .
647 .IP "W"
648 The highlight enabled via the \-w option.
649 .IP "d"
650 Bold text.
651 .IP "k"
652 Blinking text.
653 .IP "s"
654 Standout text.
655 .IP "u"
656 Underlined text.
657 .RE
658  
659 .RS
660 The uppercase letters and digits can be used only when the \-\-use-color option is enabled.
661 When text color is specified by both an uppercase letter and a lowercase letter,
662 the uppercase letter takes precedence. 
663 For example, error messages are normally displayed as standout text.
664 So if both "s" and "E" are given a color, the "E" color applies
665 to error messages, and the "s" color applies to other standout text.
666 The "d" and "u" letters refer to bold and underline text formed by 
667 overstriking with backspaces (see the \-U option), 
668 not to text using ANSI escape sequences with the \-R option.
669 .PP
670 A lowercase letter may be followed by a + to indicate that
671 the normal format change and the specified color should both be used.
672 For example, \-Dug displays underlined text as green without underlining;
673 the green color has replaced the usual underline formatting.
674 But \-Du+g displays underlined text as both green and in underlined format.
675 .PP
676 \fIcolor\fP is either a 4-bit color string or an 8-bit color string:
677 .PP
678 A 4-bit color string is zero, one or two characters, where 
679 the first character specifies the foreground color and 
680 the second specifies the background color as follows:
681 .IP "b"
682 Blue
683 .IP "c"
684 Cyan
685 .IP "g"
686 Green
687 .IP "k"
688 Black
689 .IP "m"
690 Magenta
691 .IP "r"
692 Red
693 .IP "w"
694 White
695 .IP "y"
696 Yellow
697 .PP
698 The corresponding uppercase letter denotes a brighter shade of the color.
699 For example, \-DNGk displays line numbers as bright green text on a black 
700 background, and \-DEbR displays error messages as blue text on a 
701 bright red background.
702 If either character is a "-" or is omitted, the corresponding color 
703 is set to that of normal text.
704 .PP
705 An 8-bit color string is one or two decimal integers separated by a dot,
706 where the first integer specifies the foreground color and 
707 the second specifies the background color.
708 Each integer is a value between 0 and 255 inclusive which selects
709 a "CSI 38;5" color value (see
710 .br
711 .nh
712 https://en.wikipedia.org/wiki/ANSI_escape_code#SGR)
713 .hy
714 If either integer is a "-" or is omitted,
715 the corresponding color is set to that of normal text.
716 On MS-DOS versions of 
717 .BR less ,
718 8-bit color is not supported; instead, decimal values are interpreted as 4-bit
719 CHAR_INFO.Attributes values
720 (see 
721 .br
722 .nh
723 https://docs.microsoft.com/en-us/windows/console/char-info-str).
724 .hy
725 .PP
726 On MS-DOS only, the \-Da option may be used to specify strict parsing of 
727 ANSI color (SGR) sequences when the \-R option is used.
728 Without this option, sequences that change text attributes 
729 (bold, underline, etc.) may clear the text color.
730 .RE
731 .IP "\-e or \-\-quit-at-eof"
732 Causes
733 .B less
734 to automatically exit
735 the second time it reaches end-of-file.
736 By default, the only way to exit
737 .B less
738 is via the "q" command.
739 .IP "\-E or \-\-QUIT-AT-EOF"
740 Causes
741 .B less
742 to automatically exit the first time it reaches end-of-file.
743 .IP "\-f or \-\-force"
744 Forces non-regular files to be opened.
745 (A non-regular file is a directory or a device special file.)
746 Also suppresses the warning message when a binary file is opened.
747 By default,
748 .B less
749 will refuse to open non-regular files.
750 Note that some operating systems will not allow directories
751 to be read, even if \-f is set.
752 .IP "\-F or \-\-quit-if-one-screen"
753 Causes
754 .B less
755 to automatically exit
756 if the entire file can be displayed on the first screen.
757 .IP "\-g or \-\-hilite-search"
758 Normally,
759 .B less
760 will highlight ALL strings which match the last search command.
761 The \-g option changes this behavior to highlight only the particular string
762 which was found by the last search command.
763 This can cause
764 .B less
765 to run somewhat faster than the default.
766 .IP "\-G or \-\-HILITE-SEARCH"
767 The \-G option suppresses all highlighting of strings found by search commands.
768 .IP "\-h\fIn\fP or \-\-max-back-scroll=\fIn\fP"
769 Specifies a maximum number of lines to scroll backward.
770 If it is necessary to scroll backward more than \fIn\fP lines,
771 the screen is repainted in a forward direction instead.
772 (If the terminal does not have the ability to scroll
773 backward, \-h0 is implied.)
774 .IP "\-i or \-\-ignore-case"
775 Causes searches to ignore case; that is,
776 uppercase and lowercase are considered identical.
777 This option is ignored if any uppercase letters
778 appear in the search pattern;
779 in other words,
780 if a pattern contains uppercase letters, then that search does not ignore case.
781 .IP "\-I or \-\-IGNORE-CASE"
782 Like \-i, but searches ignore case even if
783 the pattern contains uppercase letters.
784 .IP "\-j\fIn\fP or \-\-jump-target=\fIn\fP"
785 Specifies a line on the screen where the "target" line
786 is to be positioned.
787 The target line is the line specified by any command to
788 search for a pattern, jump to a line number,
789 jump to a file percentage or jump to a tag.
790 The screen line may be specified by a number: the top line on the screen
791 is 1, the next is 2, and so on.
792 The number may be negative to specify a line relative to the bottom
793 of the screen: the bottom line on the screen is \-1, the second
794 to the bottom is \-2, and so on.
795 Alternately, the screen line may be specified as a fraction of the height
796 of the screen, starting with a decimal point: \&.5 is in the middle of the
797 screen, \&.3 is three tenths down from the first line, and so on.
798 If the line is specified as a fraction, the actual line number
799 is recalculated if the terminal window is resized.
800 If any form of the \-j option is used,
801 repeated forward searches (invoked with "n" or "N")
802 begin at the line immediately after the target line,
803 and repeated backward searches begin at the target line,
804 unless changed by \-a or \-A.
805 For example, if "\-j4" is used, the target line is the
806 fourth line on the screen, so forward searches begin at the fifth line
807 on the screen.
808 However nonrepeated searches (invoked with "/" or "?")
809 always begin at the start or end of the current screen respectively.
810 .IP "\-J or \-\-status-column"
811 Displays a status column at the left edge of the screen.
812 The character displayed in the status column may be one of:
813 .RS
814 .IP ">"
815 The line is chopped with the \-S option, and 
816 the text that is chopped off beyond the right edge of the screen
817 contains a match for the current search.
818 .IP "<"
819 The line is horizontally shifted, and
820 the text that is shifted beyond the left side of the screen
821 contains a match for the current search.
822 .IP "="
823 The line is both chopped and shifted,
824 and there are matches beyond both sides of the screen.
825 .IP "*"
826 There are matches in the visible part of the line
827 but none to the right or left of it.
828 .IP "a-z, A-Z"
829 The line has been marked with the corresponding letter via the m command.
830 .RE
831 .IP "\-k\fIfilename\fP or \-\-lesskey-file=\fIfilename\fP"
832 Causes
833 .B less
834 to open and interpret the named file as a
835 .BR lesskey (1)
836 binary file.
837 Multiple \-k options may be specified.
838 If the LESSKEY or LESSKEY_SYSTEM environment variable is set, or
839 if a lesskey file is found in a standard place (see KEY BINDINGS),
840 it is also used as a
841 .B lesskey
842 file.
843 .IP "\-\-lesskey-src=\fIfilename\fP"
844 Causes
845 .B less
846 to open and interpret the named file as a 
847 .BR lesskey (1)
848 source file. 
849 If the LESSKEYIN or LESSKEYIN_SYSTEM environment variable is set, or
850 if a lesskey source file is found in a standard place (see KEY BINDINGS),
851 it is also used as a
852 .I "lesskey source"
853 file.
854 Prior to version 582, the
855 .B lesskey
856 program needed to be run to convert a 
857 .I "lesskey source"
858 file to a 
859 .I "lesskey binary"
860 file for
861 .B less
862 to use.
863 Newer versions of
864 .B less
865 read the
866 .I "lesskey source"
867 file directly and ignore the binary file if the source file exists.
868 .IP "\-K or \-\-quit-on-intr"
869 Causes
870 .B less
871 to exit immediately (with status 2)
872 when an interrupt character (usually \(haC) is typed.
873 Normally, an interrupt character causes
874 .B less
875 to stop whatever it is doing and return to its command prompt.
876 Note that use of this option makes it impossible to return to the
877 command prompt from the "F" command.
878 .IP "\-L or \-\-no-lessopen"
879 Ignore the LESSOPEN environment variable
880 (see the INPUT PREPROCESSOR section below).
881 This option can be set from within
882 .BR less ,
883 but it will apply only to files opened subsequently, not to the
884 file which is currently open.
885 .IP "\-m or \-\-long-prompt"
886 Causes
887 .B less
888 to prompt verbosely (like 
889 .BR more (1)),
890 with the percent into the file.
891 By default,
892 .B less
893 prompts with a colon.
894 .IP "\-M or \-\-LONG-PROMPT"
895 Causes
896 .B less
897 to prompt even more verbosely than
898 .BR more (1).
899 .IP "\-n or \-\-line-numbers"
900 Suppresses line numbers.
901 The default (to use line numbers) may cause
902 .B less
903 to run more slowly in some cases, especially with a very large input file.
904 Suppressing line numbers with the \-n option will avoid this problem.
905 Using line numbers means: the line number will be displayed in the verbose
906 prompt and in the = command,
907 and the v command will pass the current line number to the editor
908 (see also the discussion of LESSEDIT in PROMPTS below).
909 .IP "\-N or \-\-LINE-NUMBERS"
910 Causes a line number to be displayed at the beginning of
911 each line in the display.
912 .IP "\-o\fIfilename\fP or \-\-log-file=\fIfilename\fP"
913 Causes
914 .B less
915 to copy its input to the named file as it is being viewed.
916 This applies only when the input file is a pipe,
917 not an ordinary file.
918 If the file already exists,
919 .B less
920 will ask for confirmation before overwriting it.
921 .IP "\-O\fIfilename\fP or \-\-LOG-FILE=\fIfilename\fP"
922 The \-O option is like \-o, but it will overwrite an existing
923 file without asking for confirmation.
924 .sp
925 If no log file has been specified,
926 the \-o and \-O options can be used from within
927 .B less
928 to specify a log file.
929 Without a file name, they will simply report the name of the log file.
930 The "s" command is equivalent to specifying \-o from within
931 .BR less .
932 .IP "\-p\fIpattern\fP or \-\-pattern=\fIpattern\fP"
933 The \-p option on the command line is equivalent to
934 specifying +/\fIpattern\fP;
935 that is, it tells
936 .B less
937 to start at the first occurrence of \fIpattern\fP in the file.
938 .IP "\-P\fIprompt\fP or \-\-prompt=\fIprompt\fP"
939 Provides a way to tailor the three prompt
940 styles to your own preference.
941 This option would normally be put in the LESS environment
942 variable, rather than being typed in with each
943 .B less
944 command.
945 Such an option must either be the last option in the LESS variable,
946 or be terminated by a dollar sign.
947  \-Ps followed by a string changes the default (short) prompt
948 to that string.
949  \-Pm changes the medium (\-m) prompt.
950  \-PM changes the long (\-M) prompt.
951  \-Ph changes the prompt for the help screen.
952  \-P= changes the message printed by the = command.
953  \-Pw changes the message printed while waiting for data (in the "F" command).
954 .sp 1
955 All prompt strings consist of a sequence of
956 letters and special escape sequences.
957 See the section on PROMPTS for more details.
958 .IP "\-q or \-\-quiet or \-\-silent"
959 Causes moderately "quiet" operation:
960 the terminal bell is not rung
961 if an attempt is made to scroll past the end of the file
962 or before the beginning of the file.
963 If the terminal has a "visual bell", it is used instead.
964 The bell will be rung on certain other errors,
965 such as typing an invalid character.
966 The default is to ring the terminal bell in all such cases.
967 .IP "\-Q or \-\-QUIET or \-\-SILENT"
968 Causes totally "quiet" operation:
969 the terminal bell is never rung.
970 If the terminal has a "visual bell", it is used in all cases
971 where the terminal bell would have been rung.
972 .IP "\-r or \-\-raw-control-chars"
973 Causes "raw" control characters to be displayed.
974 The default is to display control characters using the caret notation;
975 for example, a control-A (octal 001) is displayed as "\(haA"
976 (with some exceptions as described under the \-U option).
977 Warning: when the \-r option is used,
978 .B less
979 cannot keep track of the actual appearance of the screen
980 (since this depends on how the screen responds to
981 each type of control character).
982 Thus, various display problems may result,
983 such as long lines being split in the wrong place.
984 .sp
985 USE OF THE \-r OPTION IS NOT RECOMMENDED.
986 .IP "\-R or \-\-RAW-CONTROL-CHARS"
987 Like \-r, but only ANSI "color" escape sequences and OSC 8 hyperlink
988 sequences are output in "raw" form.
989 Unlike \-r, the screen appearance is maintained correctly,
990 provided that there are no escape sequences in the file 
991 other than these types of escape sequences.
992 Color escape sequences are only supported when the color
993 is changed within one line, not across lines. 
994 In other words, the beginning of each line is assumed to be
995 normal (non-colored), regardless of any escape sequences in previous lines.
996 For the purpose of keeping track of screen appearance,
997 these escape sequences are assumed to not move the cursor.
998 .sp
999 OSC 8 hyperlinks are sequences of the form:
1000 .sp
1001         ESC ] 8 ; \&...\& \\7
1002 .sp
1003 The terminating sequence may be either a BEL character (\\7) 
1004 or the two-character sequence "ESC \\".
1005 .sp
1006 ANSI color escape sequences are sequences of the form:
1007 .sp
1008         ESC [ \&...\& m
1009 .sp
1010 where the "...\&" is zero or more color specification characters.
1011 You can make
1012 .B less
1013 think that characters other than "m" can end ANSI color escape sequences
1014 by setting the environment variable LESSANSIENDCHARS to the list of
1015 characters which can end a color escape sequence.
1016 And you can make
1017 .B less
1018 think that characters other than the standard ones may appear between
1019 the ESC and the m by setting the environment variable LESSANSIMIDCHARS
1020 to the list of characters which can appear.
1021 .IP "\-s or \-\-squeeze-blank-lines"
1022 Causes consecutive blank lines to be squeezed into a single blank line.
1023 This is useful when viewing
1024 .B nroff
1025 output.
1026 .IP "\-S or \-\-chop-long-lines"
1027 Causes lines longer than the screen width to be
1028 chopped (truncated) rather than wrapped.
1029 That is, the portion of a long line that does not fit in
1030 the screen width is not displayed until you press RIGHT-ARROW.
1031 The default is to wrap long lines; that is, display the remainder
1032 on the next line.
1033 See also the \-\-wordwrap option.
1034 .IP "\-t\fItag\fP or \-\-tag=\fItag\fP"
1035 The \-t option, followed immediately by a TAG,
1036 will edit the file containing that tag.
1037 For this to work, tag information must be available;
1038 for example, there may be a file in the current directory called "tags",
1039 which was previously built by
1040 .BR ctags (1)
1041 or an equivalent command.
1042 If the environment variable LESSGLOBALTAGS is set, it is taken to be
1043 the name of a command compatible with
1044 .BR global (1),
1045 and that command is executed to find the tag.
1046 (See 
1047 .nh
1048 http://www.gnu.org/software/global/global.html).
1049 .hy
1050 The \-t option may also be specified from within
1051 .B less
1052 (using the \- command) as a way of examining a new file.
1053 The command ":t" is equivalent to specifying \-t from within
1054 .BR less .
1055 .IP "\-T\fItagsfile\fP or \-\-tag-file=\fItagsfile\fP"
1056 Specifies a tags file to be used instead of "tags".
1057 .IP "\-u or \-\-underline-special"
1058 Causes backspaces and carriage returns to be treated as printable characters;
1059 that is, they are sent to the terminal when they appear in the input.
1060 .IP "\-U or \-\-UNDERLINE-SPECIAL"
1061 Causes backspaces, tabs, carriage returns and "formatting characters"
1062 (as defined by Unicode) to be treated as control characters;
1063 that is, they are handled as specified by the \-r option.
1064 .sp
1065 By default, if neither \-u nor \-U is given,
1066 backspaces which appear adjacent to an underscore character
1067 are treated specially:
1068 the underlined text is displayed
1069 using the terminal's hardware underlining capability.
1070 Also, backspaces which appear between two identical characters
1071 are treated specially:
1072 the overstruck text is printed
1073 using the terminal's hardware boldface capability.
1074 Other backspaces are deleted, along with the preceding character.
1075 Carriage returns immediately followed by a newline are deleted.
1076 Other carriage returns are handled as specified by the \-r option.
1077 Unicode formatting characters, such as the Byte Order Mark,
1078 are sent to the terminal.
1079 Text which is overstruck or underlined can be searched for
1080 if neither \-u nor \-U is in effect.
1081 .sp
1082 See also the \-\-proc-backspace, \-\-proc-tab,
1083 and \-\-proc-return options.
1084 .IP "\-V or \-\-version"
1085 Displays the version number of
1086 .BR less .
1087 .IP "\-w or \-\-hilite-unread"
1088 Temporarily highlights the first "new" line after a forward movement
1089 of a full page.
1090 The first "new" line is the line immediately following the line previously
1091 at the bottom of the screen.
1092 Also highlights the target line after a g or p command.
1093 The highlight is removed at the next command which causes movement.
1094 If the \-\-status-line option is in effect, the entire line
1095 (the width of the screen) is highlighted.
1096 Otherwise, only the text in the line is highlighted,
1097 unless the \-J option is in effect,
1098 in which case only the status column is highlighted.
1099 .IP "\-W or \-\-HILITE-UNREAD"
1100 Like \-w, but temporarily highlights the first new line after any
1101 forward movement command larger than one line.
1102 .IP "\-x\fIn\fP,...\& or \-\-tabs=\fIn\fP,..."
1103 Sets tab stops.
1104 If only one \fIn\fP is specified, tab stops are set at multiples of \fIn\fP.
1105 If multiple values separated by commas are specified, tab stops
1106 are set at those positions, and then continue with the same spacing as the
1107 last two.
1108 For example, "-x9,17" will set tabs at positions 9, 17, 25, 33, etc.
1109 The default for \fIn\fP is 8.
1110 .IP "\-X or \-\-no-init"
1111 Disables sending the termcap initialization and deinitialization strings
1112 to the terminal.
1113 This is sometimes desirable if the deinitialization string does
1114 something unnecessary, like clearing the screen.
1115 .IP "\-y\fIn\fP or \-\-max-forw-scroll=\fIn\fP"
1116 Specifies a maximum number of lines to scroll forward.
1117 If it is necessary to scroll forward more than \fIn\fP lines,
1118 the screen is repainted instead.
1119 The \-c or \-C option may be used to repaint from the top of
1120 the screen if desired.
1121 By default, any forward movement causes scrolling.
1122 .IP "\-z\fIn\fP or \-\-window=\fIn\fP or \-\fIn\fP"
1123 Changes the default scrolling window size to \fIn\fP lines.
1124 The default is one screenful.
1125 The z and w commands can also be used to change the window size.
1126 The "z" may be omitted for compatibility with some versions of
1127 .BR more (1).
1128 If the number
1129 .I n
1130 is negative, it indicates
1131 .I n
1132 lines less than the current screen size.
1133 For example, if the screen is 24 lines, \fI\-z\-4\fP sets the
1134 scrolling window to 20 lines.  If the screen is resized to 40 lines,
1135 the scrolling window automatically changes to 36 lines.
1136 .IP "\-\(dq\fIcc\fP\ or\ \-\-quotes=\fIcc\fP"
1137 Changes the filename quoting character.
1138 This may be necessary if you are trying to name a file
1139 which contains both spaces and quote characters.
1140 Followed by a single character, this changes the quote character to that
1141 character.
1142 Filenames containing a space should then be surrounded by that character
1143 rather than by double quotes.
1144 Followed by two characters, changes the open quote to the first character,
1145 and the close quote to the second character.
1146 Filenames containing a space should then be preceded by the open quote
1147 character and followed by the close quote character.
1148 Note that even after the quote characters are changed, this option
1149 remains \-" (a dash followed by a double quote).
1150 .IP "\-\(ti or \-\-tilde"
1151 Normally lines after end of file are displayed as a single tilde (\(ti).
1152 This option causes lines after end of file to be displayed as blank lines.
1153 .IP "\-# or \-\-shift"
1154 Specifies the default number of positions to scroll horizontally
1155 in the RIGHTARROW and LEFTARROW commands.
1156 If the number specified is zero, it sets the default number of
1157 positions to one half of the screen width.
1158 Alternately, the number may be specified as a fraction of the width
1159 of the screen, starting with a decimal point: \&.5 is half of the
1160 screen width, \&.3 is three tenths of the screen width, and so on.
1161 If the number is specified as a fraction, the actual number of
1162 scroll positions is recalculated if the terminal window is resized.
1163 .IP "\-\-exit-follow-on-close"
1164 When using the "F" command on a pipe,
1165 .B less
1166 will automatically stop waiting for more data when the input side of the 
1167 pipe is closed.
1168 .IP "\-\-file-size"
1169 If \-\-file-size is specified,
1170 .B less
1171 will determine the size of the file 
1172 immediately after opening the file.
1173 Then the "=" command will display the number of lines in the file.
1174 Normally this is not done, because it can be slow if the input file 
1175 is non-seekable (such as a pipe) and is large.
1176 .IP "\-\-follow-name"
1177 Normally, if the input file is renamed while an F command is executing,
1178 .B less
1179 will continue to display the contents of the original file despite
1180 its name change.
1181 If \-\-follow-name is specified, during an F command
1182 .B less
1183 will periodically attempt to reopen the file by name.
1184 If the reopen succeeds and the file is a different file from the original
1185 (which means that a new file has been created
1186 with the same name as the original (now renamed) file),
1187 .B less
1188 will display the contents of that new file.
1189 .IP "\-\-header=\fIN[,M]\fP"
1190 Sets the number of header lines and columns displayed on the screen.
1191 The value may be of the form "N,M" where N and M are integers,
1192 to set the header lines to N and the header columns to M,
1193 or it may be a single integer "N" which sets the header lines to N 
1194 and the header columns to zero,
1195 or it may be ",M" which sets the header columns to M and the 
1196 header lines to zero.
1197 When N is nonzero, the first N lines at the top
1198 of the screen are replaced with the first N lines of the file,
1199 regardless of what part of the file are being viewed.
1200 When M is nonzero, the characters displayed at the 
1201 beginning of each line are replaced with the first M characters of the line,
1202 even if the rest of the line is scrolled horizontally.
1203 If either N or M is zero, 
1204 .B less
1205 stops displaying header lines or columns, respectively.
1206 (Note that it may be necessary to change the setting of the \-j option
1207 to ensure that the target line is not obscured by the header line(s).)
1208 .IP "\-\-incsearch"
1209 Subsequent search commands will be "incremental"; that is,
1210 .B less
1211 will advance to the next line containing the search pattern 
1212 as each character of the pattern is typed in.
1213 .IP "\-\-intr=\fIc\fP"
1214 Use the character \fIc\fP instead of \(haX to interrupt a read
1215 when the "Waiting for data" message is displayed.
1216 \fIc\fP must be an ASCII character; that is, one with a value 
1217 between 1 and 127 inclusive.
1218 A caret followed by a single character can be used 
1219 to specify a control character.
1220 .IP "\-\-line-num-width=\fIn\fP"
1221 Sets the minimum width of the line number field when the \-N option is in effect 
1222 to \fIn\fP characters.
1223 The default is 7.
1224 .IP "\-\-modelines=\fIn\fP"
1225 .RS
1226 Before displaying a file,
1227 .B less 
1228 will read the first \fIn\fP lines to try to find a vim-compatible 
1229 .IR modeline . 
1230 If \fIn\fP is zero,
1231 .B less
1232 does not try to find modelines.
1233 By using a modeline, the file itself can specify the tab stops 
1234 that should be used when viewing it.
1235 .PP
1236 A modeline contains, anywhere in the line, 
1237 a program name ("vi", "vim", "ex", or "less"),
1238 followed by a colon,
1239 possibly followed by the word "set",
1240 and finally followed by zero or more option settings.
1241 If the word "set" is used,
1242 option settings are separated by spaces, and end at the first colon.
1243 If the word "set" is not used, 
1244 option settings may be separated by either spaces or colons.
1245 The word "set" is required if the program name is "less"
1246 but optional if any of the other three names are used.
1247 If any option setting is of the form "tabstop=\fIn\fP" or "ts=\fIn\fP",
1248 then tab stops are automatically set as if \-\-tabs=\fIn\fP had been given.
1249 See the \-\-tabs description for acceptable values of \fIn\fP.
1250 .RE
1251 .IP "\-\-mouse"
1252 Enables mouse input:
1253 scrolling the mouse wheel down moves forward in the file,
1254 scrolling the mouse wheel up moves backwards in the file,
1255 and clicking the mouse sets the "#" mark to the line
1256 where the mouse is clicked.
1257 The number of lines to scroll when the wheel is moved
1258 can be set by the \-\-wheel-lines option.
1259 Mouse input works only on terminals which support X11 mouse reporting,
1260 and on the Windows version of
1261 .BR less .
1262 .IP "\-\-MOUSE"
1263 Like \-\-mouse, except the direction scrolled
1264 on mouse wheel movement is reversed.
1265 .IP "\-\-no-keypad"
1266 Disables sending the keypad initialization and deinitialization strings
1267 to the terminal.
1268 This is sometimes useful if the keypad strings make the numeric
1269 keypad behave in an undesirable manner.
1270 .IP "\-\-no-histdups"
1271 This option changes the behavior so that if a search string or
1272 file name is typed in, and the same string is already in the history list,
1273 the existing copy is removed from the history list before the new one is added.
1274 Thus, a given string will appear only once in the history list.
1275 Normally, a string may appear multiple times.
1276 .IP "\-\-no-number-headers"
1277 Header lines (defined via the \-\-header option) are not assigned line numbers.
1278 Line number 1 is assigned to the first line after any header lines.
1279 .IP "\-\-no-search-headers"
1280 Searches do not include header lines or header columns.
1281 .IP "\-\-no-vbell"
1282 Disables the terminal's visual bell.
1283 .IP "\-\-proc-backspace"
1284 If set, backspaces are handled as if neither the \-u option 
1285 nor the \-U option were set.
1286 That is, a backspace adjacent to an underscore causes text to be
1287 displayed in underline mode, and a backspace between identical
1288 characters cause text to be displayed in boldface mode.
1289 This option overrides the \-u and \-U options, so that display of
1290 backspaces can be controlled separate from tabs and carriage returns.
1291 If not set, backspace display is controlled by the \-u and \-U options.
1292 .IP "\-\-PROC-BACKSPACE"
1293 If set, backspaces are handled as if the \-U option were set;
1294 that is backspaces are treated as control characters.
1295 .IP "\-\-proc-return"
1296 If set, carriage returns are handled as if neither the \-u option 
1297 nor the \-U option were set.
1298 That is, a carriage return immediately before a newline is deleted.
1299 This option overrides the \-u and \-U options, so that display of
1300 carriage returns can be controlled separate from that of backspaces and tabs.
1301 If not set, carriage return display is controlled by the \-u and \-U options.
1302 .IP "\-\-PROC-RETURN"
1303 If set, carriage returns are handled as if the \-U option were set;
1304 that is carriage returns are treated as control characters.
1305 .IP "\-\-proc-tab"
1306 If set, tabs are handled as if the \-U option were not set.
1307 That is, tabs are expanded to spaces.
1308 This option overrides the \-U option, so that display of
1309 tabs can be controlled separate from that of backspaces and carriage returns.
1310 If not set, tab display is controlled by the \-U options.
1311 .IP "\-\-PROC-TAB"
1312 If set, tabs are handled as if the \-U option were set;
1313 that is tabs are treated as control characters.
1314 .IP "\-\-redraw-on-quit"
1315 When quitting, after sending the terminal deinitialization string,
1316 redraws the entire last screen.
1317 On terminals whose terminal deinitialization string causes the
1318 terminal to switch from an alternate screen, 
1319 this makes the last screenful of the current file remain visible after
1320 .B less
1321 has quit.
1322 .IP "\-\-rscroll=\fIc\fP"
1323 This option changes the character used to mark truncated lines.
1324 It may begin with a two-character attribute indicator like LESSBINFMT does.
1325 If there is no attribute indicator, standout is used.
1326 If set to "\-", truncated lines are not marked.
1327 .IP "\-\-save-marks"
1328 Save marks in the history file, so marks are retained
1329 across different invocations of
1330 .BR less .
1331 .IP "\-\-search-options=\fI...\fP"
1332 Sets default search modifiers. 
1333 The value is a string of one or more of the characters
1334 E, F, K, N, R or W.
1335 Setting any of these has the same effect as typing that
1336 control character at the beginning of every search pattern.
1337 For example, setting \-\-search-options=W is the same as
1338 typing \(haW at the beginning of every pattern.
1339 The value may also contain a digit between 1 and 5,
1340 which has the same effect as typing \(haS followed by that digit
1341 at the beginning of every search pattern.
1342 The value "-" disables all default search modifiers.
1343 .IP "\-\-show-preproc-errors"
1344 If a preprocessor produces data, 
1345 then exits with a non-zero exit code,
1346 .B less
1347 will display a warning.
1348 .IP "\-\-status-col-width=\fIn\fP"
1349 Sets the width of the status column when the \-J option is in effect.
1350 The default is 2 characters.
1351 .IP "\-\-status-line"
1352 If a line is marked, the entire line (rather than just the status column)
1353 is highlighted.
1354 Also lines highlighted due to the \-w option will have
1355 the entire line highlighted.
1356 If \-\-use-color is set, the line is colored rather than highlighted.
1357 .IP "\-\-use-backslash"
1358 This option changes the interpretations of options which follow this one.
1359 After the \-\-use-backslash option, any backslash in an option string is
1360 removed and the following character is taken literally.
1361 This allows a dollar sign to be included in option strings.
1362 .IP "\-\-use-color"
1363 Enables colored text in various places.
1364 The \-D option can be used to change the colors.
1365 Colored text works only if the terminal supports 
1366 ANSI color escape sequences (as defined in ECMA-48 SGR;
1367 see 
1368 .br
1369 .nh
1370 https://www.ecma-international.org/publications-and-standards/standards/ecma-48).
1371 .hy
1372 .IP "\-\-wheel-lines=\fIn\fP"
1373 Set the number of lines to scroll when the mouse wheel is scrolled
1374 and the \-\-mouse or \-\-MOUSE option is in effect.
1375 The default is 1 line.
1376 .IP "\-\-wordwrap"
1377 When the \-S option is not in use,
1378 wrap each line at a space or tab if possible,
1379 so that a word is not split between two lines.
1380 The default is to wrap at any character.
1381 .IP \-\-
1382 A command line argument of "\-\-" marks the end of option arguments.
1383 Any arguments following this are interpreted as filenames.
1384 This can be useful when viewing a file whose name begins with a "\-" or "+".
1385 .IP +
1386 If a command line option begins with \fB+\fP,
1387 the remainder of that option is taken to be an initial command to
1388 .BR less .
1389 For example, +G tells
1390 .B less
1391 to start at the end of the file rather than the beginning,
1392 and +/xyz tells it to start at the first occurrence of "xyz" in the file.
1393 As a special case, +<number> acts like +<number>g;
1394 that is, it starts the display at the specified line number
1395 (however, see the caveat under the "g" command above).
1396 If the option starts with ++, the initial command applies to
1397 every file being viewed, not just the first one.
1398 The + command described previously
1399 may also be used to set (or change) an initial command for every file.
1400 .
1401 .SH "LINE EDITING"
1402 When entering a command line at the bottom of the screen
1403 (for example, a filename for the :e command,
1404 or the pattern for a search command),
1405 certain keys can be used to manipulate the command line.
1406 Most commands have an alternate form in [ brackets ] which can be used if
1407 a key does not exist on a particular keyboard.
1408 (Note that the forms beginning with ESC do not work
1409 in some MS-DOS and Windows systems because ESC is the line erase character.)
1410 Any of these special keys may be entered literally by preceding
1411 it with the "literal" character, either \(haV or \(haA.
1412 A backslash itself may also be entered literally by entering two backslashes.
1413 .IP "LEFTARROW [ ESC-h ]"
1414 Move the cursor one space to the left.
1415 .IP "RIGHTARROW [ ESC-l ]"
1416 Move the cursor one space to the right.
1417 .IP "\(haLEFTARROW [ ESC-b or ESC-LEFTARROW ]"
1418 (That is, CONTROL and LEFTARROW simultaneously.)
1419 Move the cursor one word to the left.
1420 .IP "\(haRIGHTARROW [ ESC-w or ESC-RIGHTARROW ]"
1421 (That is, CONTROL and RIGHTARROW simultaneously.)
1422 Move the cursor one word to the right.
1423 .IP "HOME [ ESC-0 ]"
1424 Move the cursor to the beginning of the line.
1425 .IP "END [ ESC-$ ]"
1426 Move the cursor to the end of the line.
1427 .IP "BACKSPACE"
1428 Delete the character to the left of the cursor,
1429 or cancel the command if the command line is empty.
1430 .IP "DELETE or [ ESC-x ]"
1431 Delete the character under the cursor.
1432 .IP "\(haBACKSPACE [ ESC-BACKSPACE ]"
1433 (That is, CONTROL and BACKSPACE simultaneously.)
1434 Delete the word to the left of the cursor.
1435 .IP "\(haDELETE [ ESC-X or ESC-DELETE ]"
1436 (That is, CONTROL and DELETE simultaneously.)
1437 Delete the word under the cursor.
1438 .IP "UPARROW [ ESC-k ]"
1439 Retrieve the previous command line.
1440 If you first enter some text and then press UPARROW,
1441 it will retrieve the previous command which begins with that text.
1442 .IP "DOWNARROW [ ESC-j ]"
1443 Retrieve the next command line.
1444 If you first enter some text and then press DOWNARROW,
1445 it will retrieve the next command which begins with that text.
1446 .IP "TAB"
1447 Complete the partial filename to the left of the cursor.
1448 If it matches more than one filename, the first match
1449 is entered into the command line.
1450 Repeated TABs will cycle thru the other matching filenames.
1451 If the completed filename is a directory, a "/" is appended to the filename.
1452 (On MS-DOS systems, a "\e" is appended.)
1453 The environment variable LESSSEPARATOR can be used to specify a
1454 different character to append to a directory name.
1455 .IP "BACKTAB [ ESC-TAB ]"
1456 Like, TAB, but cycles in the reverse direction thru the matching filenames.
1457 .IP "\(haL"
1458 Complete the partial filename to the left of the cursor.
1459 If it matches more than one filename, all matches are entered into
1460 the command line (if they fit).
1461 .IP "\(haU (Unix and OS/2) or ESC (MS-DOS)"
1462 Delete the entire command line,
1463 or cancel the command if the command line is empty.
1464 If you have changed your line-kill character in Unix to something
1465 other than \(haU, that character is used instead of \(haU.
1466 .IP "\(haG"
1467 Delete the entire command line and return to the main prompt.
1468 .
1469 .SH "KEY BINDINGS"
1470 You may define your own
1471 .B less
1472 commands by creating a lesskey source file.
1473 This file specifies a set of command keys and an action
1474 associated with each key.
1475 You may also change the line-editing keys (see LINE EDITING),
1476 and set environment variables used by
1477 .BR less .
1478 See the
1479 .BR lesskey (1)
1480 manual page for details about the file format.
1481 .PP
1482 If the environment variable LESSKEYIN is set,
1483 .B less
1484 uses that as the name of the lesskey source file.
1485 Otherwise,
1486 .B less
1487 looks in a standard place for the lesskey source file:
1488 On Unix systems,
1489 .B less
1490 looks for a lesskey file called "$XDG_CONFIG_HOME/lesskey" or "$HOME/.config/lesskey" or "$HOME/.lesskey".
1491 On MS-DOS and Windows systems,
1492 .B less
1493 looks for a lesskey file called "$HOME/_lesskey", and if it is not found there,
1494 then looks for a lesskey file called "_lesskey" in any directory specified
1495 in the PATH environment variable.
1496 On OS/2 systems,
1497 .B less
1498 looks for a lesskey file called "$HOME/lesskey.ini", and if it is not found,
1499 then looks for a lesskey file called "lesskey.ini" in any directory specified
1500 in the INIT environment variable, and if it not found there,
1501 then looks for a lesskey file called "lesskey.ini" in any directory specified
1502 in the PATH environment variable.
1503 .PP
1504 A system-wide lesskey source file may also be set up to provide key bindings.
1505 If a key is defined in both a local lesskey file and in the
1506 system-wide file, key bindings in the local file take precedence over
1507 those in the system-wide file.
1508 If the environment variable LESSKEYIN_SYSTEM is set,
1509 .B less
1510 uses that as the name of the system-wide lesskey file.
1511 Otherwise,
1512 .B less
1513 looks in a standard place for the system-wide lesskey file:
1514 On Unix systems, the system-wide lesskey file is /usr/local/etc/syslesskey.
1515 (However, if
1516 .B less
1517 was built with a different sysconf directory than /usr/local/etc,
1518 that directory is where the sysless file is found.)
1519 On MS-DOS and Windows systems, the system-wide lesskey file is c:\e_syslesskey.
1520 On OS/2 systems, the system-wide lesskey file is c:\esyslesskey.ini.
1521 .PP
1522 Previous versions of
1523 .B less
1524 (before v582) used lesskey files with a binary format, produced by the
1525 .B lesskey
1526 program. It is no longer necessary to use the
1527 .B lesskey
1528 program.
1529 .
1530 .SH "INPUT PREPROCESSOR"
1531 You may define an "input preprocessor" for
1532 .BR less .
1533 Before
1534 .B less
1535 opens a file, it first gives your input preprocessor a chance to modify the
1536 way the contents of the file are displayed.
1537 An input preprocessor is simply an executable program (or shell script),
1538 which writes the contents of the file to a different file,
1539 called the replacement file.
1540 The contents of the replacement file are then displayed
1541 in place of the contents of the original file.
1542 However, it will appear to the user as if the original file is opened;
1543 that is,
1544 .B less
1545 will display the original filename as the name of the current file.
1546 .PP
1547 An input preprocessor receives one command line argument, the original filename,
1548 as entered by the user.
1549 It should create the replacement file, and when finished,
1550 print the name of the replacement file to its standard output.
1551 If the input preprocessor does not output a replacement filename,
1552 .B less
1553 uses the original file, as normal.
1554 The input preprocessor is not called when viewing standard input.
1555 To set up an input preprocessor, set the LESSOPEN environment variable
1556 to a command line which will invoke your input preprocessor.
1557 This command line should include one occurrence of the string "%s",
1558 which will be replaced by the filename
1559 when the input preprocessor command is invoked.
1560 .PP
1561 When
1562 .B less
1563 closes a file opened in such a way, it will call another program,
1564 called the input postprocessor,
1565 which may perform any desired clean-up action (such as deleting the
1566 replacement file created by LESSOPEN).
1567 This program receives two command line arguments, the original filename
1568 as entered by the user, and the name of the replacement file.
1569 To set up an input postprocessor, set the LESSCLOSE environment variable
1570 to a command line which will invoke your input postprocessor.
1571 It may include two occurrences of the string "%s";
1572 the first is replaced with the original name of the file and
1573 the second with the name of the replacement file,
1574 which was output by LESSOPEN.
1575 .PP
1576 For example, on many Unix systems, these two scripts will allow you
1577 to keep files in compressed format, but still let
1578 .B less
1579 view them directly:
1580 .PP
1581 lessopen.sh:
1582 .br
1583         #! /bin/sh
1584 .br
1585         case "$1" in
1586 .br
1587         *.Z)    TEMPFILE=$(mktemp)
1588 .br
1589                 uncompress \-c $1  >$TEMPFILE  2>/dev/null
1590 .br
1591                 if [ \-s $TEMPFILE ]; then
1592 .br
1593                         echo $TEMPFILE
1594 .br
1595                 else
1596 .br
1597                         rm \-f $TEMPFILE
1598 .br
1599                 fi
1600 .br
1601                 ;;
1602 .br
1603         esac
1604 .PP
1605 lessclose.sh:
1606 .br
1607         #! /bin/sh
1608 .br
1609         rm $2
1610 .PP
1611 To use these scripts, put them both where they can be executed and
1612 set LESSOPEN="lessopen.sh\ %s", and
1613 LESSCLOSE="lessclose.sh\ %s\ %s".
1614 More complex LESSOPEN and LESSCLOSE scripts may be written
1615 to accept other types of compressed files, and so on.
1616 .PP
1617 It is also possible to set up an input preprocessor to
1618 pipe the file data directly to
1619 .BR less ,
1620 rather than putting the data into a replacement file.
1621 This avoids the need to decompress the entire file before
1622 starting to view it.
1623 An input preprocessor that works this way is called an input pipe.
1624 An input pipe, instead of writing the name of a replacement file on
1625 its standard output,
1626 writes the entire contents of the replacement file on its standard output.
1627 If the input pipe does not write any characters on its standard output,
1628 then there is no replacement file and
1629 .B less
1630 uses the original file, as normal.
1631 To use an input pipe,
1632 make the first character in the LESSOPEN environment variable a
1633 vertical bar (|) to signify that the input preprocessor is an input pipe.
1634 As with non-pipe input preprocessors, the command string must contain one
1635 occurrence of %s, which is replaced with the filename of the input file.
1636 .PP
1637 For example, on many Unix systems, this script will work like the
1638 previous example scripts:
1639 .PP
1640 lesspipe.sh:
1641 .br
1642         #! /bin/sh
1643 .br
1644         case "$1" in
1645 .br
1646         *.Z)    uncompress \-c $1  2>/dev/null
1647 .br
1648                 ;;
1649 .br
1650         *)      exit 1
1651 .br
1652                 ;;
1653 .br
1654         esac
1655 .br
1656         exit $?
1657 .br
1658 .PP
1659 To use this script, put it where it can be executed and set
1660 LESSOPEN="|lesspipe.sh %s".
1661 .PP
1662 Note that a preprocessor cannot output an empty file, since that
1663 is interpreted as meaning there is no replacement, and
1664 the original file is used.
1665 To avoid this, if LESSOPEN starts with two vertical bars,
1666 the exit status of the script determines the behavior when the output is empty.
1667 If the output is empty and the exit status is zero, 
1668 the empty output is considered to be replacement text.
1669 If the output is empty and the exit status is nonzero, 
1670 the original file is used.
1671 For compatibility with previous versions of
1672 .BR less ,
1673 if LESSOPEN starts with only one vertical bar, the exit status
1674 of the preprocessor is ignored.
1675 .PP
1676 When an input pipe is used, a LESSCLOSE postprocessor can be used,
1677 but it is usually not necessary since there is no replacement file
1678 to clean up.
1679 In this case, the replacement file name passed to the LESSCLOSE
1680 postprocessor is "\-".
1681 .PP
1682 For compatibility with previous versions of
1683 .BR less ,
1684 the input preprocessor or pipe is not used if
1685 .B less
1686 is viewing standard input.
1687 However, if the first character of LESSOPEN is a dash (\-),
1688 the input preprocessor is used on standard input as well as other files.
1689 In this case, the dash is not considered to be part of
1690 the preprocessor command.
1691 If standard input is being viewed, the input preprocessor is passed
1692 a file name consisting of a single dash.
1693 Similarly, if the first two characters of LESSOPEN are vertical bar and dash
1694 (|\-) or two vertical bars and a dash (||\-),
1695 the input pipe is used on standard input as well as other files.
1696 Again, in this case the dash is not considered to be part of
1697 the input pipe command.
1698 .
1699 .SH "NATIONAL CHARACTER SETS"
1700 There are three types of characters in the input file:
1701 .IP "normal characters"
1702 can be displayed directly to the screen.
1703 .IP "control characters"
1704 should not be displayed directly, but are expected to be found
1705 in ordinary text files (such as backspace and tab).
1706 .IP "binary characters"
1707 should not be displayed directly and are not expected to be found
1708 in text files.
1709 .PP
1710 A "character set" is simply a description of which characters are to
1711 be considered normal, control, and binary.
1712 The LESSCHARSET environment variable may be used to select a character set.
1713 Possible values for LESSCHARSET are:
1714 .IP ascii
1715 BS, TAB, NL, CR, and formfeed are control characters,
1716 all chars with values between 32 and 126 are normal,
1717 and all others are binary.
1718 .IP iso8859
1719 Selects an ISO 8859 character set.
1720 This is the same as ASCII, except characters between 160 and 255 are
1721 treated as normal characters.
1722 .IP latin1
1723 Same as iso8859.
1724 .IP latin9
1725 Same as iso8859.
1726 .IP dos
1727 Selects a character set appropriate for MS-DOS.
1728 .IP ebcdic
1729 Selects an EBCDIC character set.
1730 .IP IBM-1047
1731 Selects an EBCDIC character set used by OS/390 Unix Services.
1732 This is the EBCDIC analogue of latin1.  You get similar results
1733 by setting either LESSCHARSET=IBM-1047 or LC_CTYPE=en_US
1734 in your environment.
1735 .IP koi8-r
1736 Selects a Russian character set.
1737 .IP next
1738 Selects a character set appropriate for NeXT computers.
1739 .IP utf-8
1740 Selects the UTF-8 encoding of the ISO 10646 character set.
1741 UTF-8 is special in that it supports multi-byte characters in the input file.
1742 It is the only character set that supports multi-byte characters.
1743 .IP windows
1744 Selects a character set appropriate for Microsoft Windows (cp 1251).
1745 .PP
1746 In rare cases, it may be desired to tailor
1747 .B less
1748 to use a character set other than the ones definable by LESSCHARSET.
1749 In this case, the environment variable LESSCHARDEF can be used
1750 to define a character set.
1751 It should be set to a string where each character in the string represents
1752 one character in the character set.
1753 The character ".\&" is used for a normal character, "c" for control,
1754 and "b" for binary.
1755 A decimal number may be used for repetition.
1756 For example, "bccc4b.\&" would mean character 0 is binary,
1757 1, 2 and 3 are control, 4, 5, 6 and 7 are binary, and 8 is normal.
1758 All characters after the last are taken to be the same as the last,
1759 so characters 9 through 255 would be normal.
1760 (This is an example, and does not necessarily
1761 represent any real character set.)
1762 .PP
1763 This table shows the value of LESSCHARDEF which is equivalent
1764 to each of the possible values for LESSCHARSET:
1765 .
1766 .RS 5m
1767 .TS
1768 l l.
1769 ascii   8bcccbcc18b95.b
1770 dos     8bcccbcc12bc5b95.b.
1771 ebcdic  5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b
1772         9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b.
1773 IBM-1047        4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc
1774         191.b
1775 iso8859 8bcccbcc18b95.33b.
1776 koi8-r  8bcccbcc18b95.b128.
1777 latin1  8bcccbcc18b95.33b.
1778 next    8bcccbcc18b95.bb125.bb
1779 .TE
1780 .RE
1781 .PP
1782 If neither LESSCHARSET nor LESSCHARDEF is set,
1783 but any of the strings "UTF-8", "UTF8", "utf-8" or "utf8"
1784 is found in the LC_ALL, LC_CTYPE or LANG
1785 environment variables, then the default character set is utf-8.
1786 .PP
1787 If that string is not found, but your system supports the
1788 .B setlocale
1789 interface,
1790 .B less
1791 will use setlocale to determine the character set.
1792 setlocale is controlled by setting the LANG or LC_CTYPE environment
1793 variables.
1794 .PP
1795 Finally, if the
1796 .I setlocale
1797 interface is also not available, the default character set is latin1.
1798 .PP
1799 Control and binary characters are displayed in standout (reverse video).
1800 Each such character is displayed in caret notation if possible
1801 (e.g.\& \(haA for control-A).  Caret notation is used only if
1802 inverting the 0100 bit results in a normal printable character.
1803 Otherwise, the character is displayed as a hex number in angle brackets.
1804 This format can be changed by
1805 setting the LESSBINFMT environment variable.
1806 LESSBINFMT may begin with a "*" and one character to select
1807 the display attribute:
1808 "*k" is blinking, "*d" is bold, "*u" is underlined, "*s" is standout,
1809 and "*n" is normal.
1810 If LESSBINFMT does not begin with a "*", normal attribute is assumed.
1811 The remainder of LESSBINFMT is a string which may include one
1812 printf-style escape sequence (a % followed by x, X, o, d, etc.).
1813 For example, if LESSBINFMT is "*u[%x]", binary characters
1814 are displayed in underlined hexadecimal surrounded by brackets.
1815 The default if no LESSBINFMT is specified is "*s<%02X>".
1816 Warning: the result of expanding the character via LESSBINFMT must
1817 be less than 31 characters.
1818 .PP
1819 When the character set is utf-8, the LESSUTFBINFMT environment variable
1820 acts similarly to LESSBINFMT but it applies to Unicode code points
1821 that were successfully decoded but are unsuitable for display (e.g.,
1822 unassigned code points).
1823 Its default value is "<U+%04lX>".
1824 Note that LESSUTFBINFMT and LESSBINFMT share their display attribute
1825 setting ("*x") so specifying one will affect both;
1826 LESSUTFBINFMT is read after LESSBINFMT so its setting, if any,
1827 will have priority.
1828 Problematic octets in a UTF-8 file (octets of a truncated sequence,
1829 octets of a complete but non-shortest form sequence, invalid octets,
1830 and stray trailing octets)
1831 are displayed individually using LESSBINFMT so as to facilitate diagnostic
1832 of how the UTF-8 file is ill-formed.
1833 .PP
1834 When the character set is utf-8, in rare cases it may be desirable to
1835 override the Unicode definition of the type of certain characters.
1836 For example, characters in a Private Use Area are normally treated as control
1837 characters, but if you are using a custom font with printable characters
1838 in that range, it may be desirable to tell
1839 .B less
1840 to treat such characters as printable.
1841 This can be done by setting the LESSUTFCHARDEF environment variable
1842 to a comma-separated list of 
1843 .I "character type"
1844 definitions.
1845 Each character type definition consists of either one hexadecimal codepoint
1846 or a pair of codepoints separated by a dash,
1847 followed by a colon and a type character.
1848 Each hexadecimal codepoint may optionally be preceded by a "U" or "U+".
1849 If a pair of codepoints is given, the type is set for
1850 all characters inclusively between the two values.
1851 If there are multiple comma-separated codepoint values,
1852 they must be in ascending numerical order.
1853 The type character may be one of:
1854 .RS
1855 .IP "p"
1856 A normal printable character.
1857 .IP "w"
1858 A wide (2-space) printable character.
1859 .IP "b"
1860 A binary (non-printable) character.
1861 .IP "c"
1862 A composing (zero width) character.
1863 .RE
1864 .PP
1865 For example, setting LESSUTFCHARDEF to
1866 .nf
1867 .sp
1868         E000-F8FF:p,F0000-FFFFD:p,100000-10FFFD:p
1869 .sp
1870 .fi
1871 would make all Private Use Area characters be treated as printable.
1872 .SH "PROMPTS"
1873 The \-P option allows you to tailor the prompt to your preference.
1874 The string given to the \-P option replaces the specified prompt string.
1875 Certain characters in the string are interpreted specially.
1876 The prompt mechanism is rather complicated to provide flexibility,
1877 but the ordinary user need not understand the details of constructing
1878 personalized prompt strings.
1879 .sp
1880 A percent sign followed by a single character is expanded
1881 according to what the following character is.
1882 (References to the input file size below refer to the preprocessed size,
1883 if an input preprocessor is being used.)
1884 .IP "%b\fIX\fP"
1885 Replaced by the byte offset into the current input file.
1886 The b is followed by a single character (shown as \fIX\fP above)
1887 which specifies the line whose byte offset is to be used.
1888 If the character is a "t", the byte offset of the top line in the
1889 display is used,
1890 an "m" means use the middle line,
1891 a "b" means use the bottom line,
1892 a "B" means use the line just after the bottom line,
1893 and a "j" means use the "target" line, as specified by the \-j option.
1894 .IP "%B"
1895 Replaced by the size of the current input file.
1896 .IP "%c"
1897 Replaced by the column number of the text appearing in the first
1898 column of the screen.
1899 .IP "%d\fIX\fP"
1900 Replaced by the page number of a line in the input file.
1901 The line to be used is determined by the \fIX\fP, as with the %b option.
1902 .IP "%D"
1903 Replaced by the number of pages in the input file,
1904 or equivalently, the page number of the last line in the input file.
1905 .IP "%E"
1906 Replaced by the name of the editor (from the VISUAL environment variable,
1907 or the EDITOR environment variable if VISUAL is not defined).
1908 See the discussion of the LESSEDIT feature below.
1909 .IP "%f"
1910 Replaced by the name of the current input file.
1911 .IP "%F"
1912 Replaced by the last component of the name of the current input file.
1913 .IP "%g"
1914 Replaced by the shell-escaped name of the current input file.
1915 This is useful when the expanded string will be used in a shell command,
1916 such as in LESSEDIT.
1917 .IP "%i"
1918 Replaced by the index of the current file in the list of
1919 input files.
1920 .IP "%l\fIX\fP"
1921 Replaced by the line number of a line in the input file.
1922 The line to be used is determined by the \fIX\fP, as with the %b option.
1923 .IP "%L"
1924 Replaced by the line number of the last line in the input file.
1925 .IP "%m"
1926 Replaced by the total number of input files.
1927 .IP "%p\fIX\fP"
1928 Replaced by the percent into the current input file, based on byte offsets.
1929 The line used is determined by the \fIX\fP as with the %b option.
1930 .IP "%P\fIX\fP"
1931 Replaced by the percent into the current input file, based on line numbers.
1932 The line used is determined by the \fIX\fP as with the %b option.
1933 .IP "%s"
1934 Same as %B.
1935 .IP "%t"
1936 Causes any trailing spaces to be removed.
1937 Usually used at the end of the string, but may appear anywhere.
1938 .IP "%T"
1939 Normally expands to the word "file".
1940 However if viewing files via a tags list using the \-t option,
1941 it expands to the word "tag".
1942 .IP "%x"
1943 Replaced by the name of the next input file in the list.
1944 .PP
1945 If any item is unknown (for example, the file size if input
1946 is a pipe), a question mark is printed instead.
1947 .PP
1948 The format of the prompt string can be changed
1949 depending on certain conditions.
1950 A question mark followed by a single character acts like an "IF":
1951 depending on the following character, a condition is evaluated.
1952 If the condition is true, any characters following the question mark
1953 and condition character, up to a period, are included in the prompt.
1954 If the condition is false, such characters are not included.
1955 A colon appearing between the question mark and the
1956 period can be used to establish an "ELSE": any characters between
1957 the colon and the period are included in the string if and only if
1958 the IF condition is false.
1959 Condition characters (which follow a question mark) may be:
1960 .IP "?a"
1961 True if any characters have been included in the prompt so far.
1962 .IP "?b\fIX\fP"
1963 True if the byte offset of the specified line is known.
1964 .IP "?B"
1965 True if the size of current input file is known.
1966 .IP "?c"
1967 True if the text is horizontally shifted (%c is not zero).
1968 .IP "?d\fIX\fP"
1969 True if the page number of the specified line is known.
1970 .IP "?e"
1971 True if at end-of-file.
1972 .IP "?f"
1973 True if there is an input filename
1974 (that is, if input is not a pipe).
1975 .IP "?l\fIX\fP"
1976 True if the line number of the specified line is known.
1977 .IP "?L"
1978 True if the line number of the last line in the file is known.
1979 .IP "?m"
1980 True if there is more than one input file.
1981 .IP "?n"
1982 True if this is the first prompt in a new input file.
1983 .IP "?p\fIX\fP"
1984 True if the percent into the current input file, based on byte offsets,
1985 of the specified line is known.
1986 .IP "?P\fIX\fP"
1987 True if the percent into the current input file, based on line numbers,
1988 of the specified line is known.
1989 .IP "?s"
1990 Same as "?B".
1991 .IP "?x"
1992 True if there is a next input file
1993 (that is, if the current input file is not the last one).
1994 .PP
1995 Any characters other than the special ones
1996 (question mark, colon, period, percent, and backslash)
1997 become literally part of the prompt.
1998 Any of the special characters may be included in the prompt literally
1999 by preceding it with a backslash.
2000 .PP
2001 Some examples:
2002 .sp
2003 ?f%f:Standard input.
2004 .sp
2005 This prompt prints the filename, if known;
2006 otherwise the string "Standard input".
2007 .sp
2008 ?f%f \&.?ltLine %lt:?pt%pt\e%:?btByte %bt:-...
2009 .sp
2010 This prompt would print the filename, if known.
2011 The filename is followed by the line number, if known,
2012 otherwise the percent if known, otherwise the byte offset if known.
2013 Otherwise, a dash is printed.
2014 Notice how each question mark has a matching period,
2015 and how the % after the %pt
2016 is included literally by escaping it with a backslash.
2017 .sp
2018 ?n?f%f\ .?m(%T %i of %m)\ ..?e(END)\ ?x-\ Next\e:\ %x..%t";
2019 .sp
2020 This prints the filename if this is the first prompt in a file,
2021 followed by the "file N of N" message if there is more
2022 than one input file.
2023 Then, if we are at end-of-file, the string "(END)" is printed
2024 followed by the name of the next file, if there is one.
2025 Finally, any trailing spaces are truncated.
2026 This is the default prompt.
2027 For reference, here are the defaults for
2028 the other two prompts (\-m and \-M respectively).
2029 Each is broken into two lines here for readability only.
2030 .nf
2031 .sp
2032 ?n?f%f\ .?m(%T\ %i\ of\ %m)\ ..?e(END)\ ?x-\ Next\e:\ %x.:
2033         ?pB%pB\e%:byte\ %bB?s/%s...%t
2034 .sp
2035 ?f%f\ .?n?m(%T\ %i\ of\ %m)\ ..?ltlines\ %lt-%lb?L/%L.\ :
2036         byte\ %bB?s/%s.\ .?e(END)\ ?x-\ Next\e:\ %x.:?pB%pB\e%..%t
2037 .sp
2038 .fi
2039 And here is the default message produced by the = command:
2040 .nf
2041 .sp
2042 ?f%f\ .?m(%T\ %i\ of\ %m)\ .?ltlines\ %lt-%lb?L/%L.\ .
2043         byte\ %bB?s/%s.\ ?e(END)\ :?pB%pB\e%..%t
2044 .fi
2045 .PP
2046 The prompt expansion features are also used for another purpose:
2047 if an environment variable LESSEDIT is defined, it is used
2048 as the command to be executed when the v command is invoked.
2049 The LESSEDIT string is expanded in the same way as the prompt strings.
2050 The default value for LESSEDIT is:
2051 .nf
2052 .sp
2053         %E\ ?lm+%lm.\ %g
2054 .sp
2055 .fi
2056 Note that this expands to the editor name, followed by a + and the
2057 line number, followed by the shell-escaped file name.
2058 If your editor does not accept the "+linenumber" syntax, or has other
2059 differences in invocation syntax, the LESSEDIT variable can be
2060 changed to modify this default.
2061 .
2062 .SH SECURITY
2063 When the environment variable LESSSECURE is set to 1,
2064 .B less
2065 runs in a "secure" mode.
2066 This means these features are disabled:
2067 .RS
2068 .IP "!"
2069 the shell command
2070 .IP "#"
2071 the pshell command
2072 .IP "|"
2073 the pipe command
2074 .IP ":e"
2075 the examine command.
2076 .IP "v"
2077 the editing command
2078 .IP "s  \-o"
2079 log files
2080 .IP "\-k"
2081 use of lesskey files
2082 .IP "\-t"
2083 use of tags files
2084 .IP
2085 metacharacters in filenames, such as *
2086 .IP
2087 filename completion (TAB, \(haL)
2088 .IP
2089 history file
2090 .RE
2091 .PP
2092 Less can also be compiled to be permanently in "secure" mode.
2093 .
2094 .SH "COMPATIBILITY WITH MORE"
2095 If the environment variable LESS_IS_MORE is set to 1,
2096 or if the program is invoked via a file link named "more",
2097 .B less
2098 behaves (mostly) in conformance with the POSIX 
2099 .BR more (1)
2100 command specification.
2101 In this mode, less behaves differently in these ways:
2102 .PP
2103 The \-e option works differently.
2104 If the \-e option is not set,
2105 .B less
2106 behaves as if the \-e option were set.
2107 If the \-e option is set,
2108 .B less
2109 behaves as if the \-E option were set.
2110 .PP
2111 The \-m option works differently.
2112 If the \-m option is not set, the medium prompt is used,
2113 and it is prefixed with the string "\-\-More\-\-".
2114 If the \-m option is set, the short prompt is used.
2115 .PP
2116 The \-n option acts like the \-z option.
2117 The normal behavior of the \-n option is unavailable in this mode.
2118 .PP
2119 The parameter to the \-p option is taken to be a
2120 .B less
2121 command rather than a search pattern.
2122 .PP
2123 The LESS environment variable is ignored,
2124 and the MORE environment variable is used in its place.
2125 .
2126 .SH "ENVIRONMENT VARIABLES"
2127 Environment variables may be specified either in the system environment
2128 as usual, or in a
2129 .BR lesskey (1)
2130 file.
2131 If environment variables are defined in more than one place,
2132 variables defined in a local lesskey file take precedence over
2133 variables defined in the system environment, which take precedence
2134 over variables defined in the system-wide lesskey file.
2135 .IP COLUMNS
2136 Sets the number of columns on the screen.
2137 Takes precedence over the number of columns specified by the TERM variable.
2138 (But if you have a windowing system which supports TIOCGWINSZ or WIOCGETD,
2139 the window system's idea of the screen size takes precedence over the
2140 LINES and COLUMNS environment variables.)
2141 .IP EDITOR
2142 The name of the editor (used for the v command).
2143 .IP HOME
2144 Name of the user's home directory
2145 (used to find a lesskey file on Unix and OS/2 systems).
2146 .IP "HOMEDRIVE, HOMEPATH"
2147 Concatenation of the HOMEDRIVE and HOMEPATH environment variables is
2148 the name of the user's home directory if the HOME variable is not set
2149 (only in the Windows version).
2150 .IP INIT
2151 Name of the user's init directory (used to find a lesskey file on OS/2 systems).
2152 .IP LANG
2153 Language for determining the character set.
2154 .IP LC_CTYPE
2155 Language for determining the character set.
2156 .IP LESS
2157 Options which are passed to
2158 .B less
2159 automatically.
2160 .IP LESSANSIENDCHARS
2161 Characters which may end an ANSI color escape sequence
2162 (default "m").
2163 .IP LESSANSIMIDCHARS
2164 Characters which may appear between the ESC character and the
2165 end character in an ANSI color escape sequence
2166 (default "0123456789:;[?!"\(aq#%()*+\ ".
2167 .IP LESSBINFMT
2168 Format for displaying non-printable, non-control characters.
2169 .IP LESSCHARDEF
2170 Defines a character set.
2171 .IP LESSCHARSET
2172 Selects a predefined character set.
2173 .IP LESSCLOSE
2174 Command line to invoke the (optional) input-postprocessor.
2175 .IP LESSECHO
2176 Name of the lessecho program (default "lessecho").
2177 The lessecho program is needed to expand metacharacters, such as * and ?,
2178 in filenames on Unix systems.
2179 .IP LESSEDIT
2180 Editor prototype string (used for the v command).
2181 See discussion under PROMPTS.
2182 .IP LESSGLOBALTAGS
2183 Name of the command used by the \-t option to find global tags.
2184 Normally should be set to "global" if your system has the
2185 .BR global (1)
2186 command.  If not set, global tags are not used.
2187 .IP LESSHISTFILE
2188 Name of the history file used to remember search commands and
2189 shell commands between invocations of
2190 .BR less .
2191 If set to "\-" or "/dev/null", a history file is not used.
2192 The default depends on the operating system, but is usually:
2193 .RS
2194 .IP "Linux and Unix"
2195 "$XDG_STATE_HOME/lesshst" or "$HOME/.local/state/lesshst" or
2196 "$XDG_DATA_HOME/lesshst" or "$HOME/.lesshst".
2197 .IP "Windows and MS-DOS"
2198 "$HOME/_lesshst".
2199 .IP "OS/2"
2200 "$HOME/lesshst.ini" or "$INIT/lesshst.ini".
2201 .RE
2202 .IP LESSHISTSIZE
2203 The maximum number of commands to save in the history file.
2204 The default is 100.
2205 .IP LESSKEYIN
2206 Name of the default
2207 .I "lesskey source"
2208 file.
2209 .IP LESSKEY
2210 Name of the default
2211 .I "lesskey binary"
2212 file. (Not used if "$LESSKEYIN" exists.)
2213 .IP LESSKEYIN_SYSTEM
2214 Name of the default system-wide
2215 .I "lesskey source"
2216 file.
2217 .IP LESSKEY_SYSTEM
2218 Name of the default system-wide
2219 .I "lesskey binary"
2220 file. (Not used if "$LESSKEYIN_SYSTEM" exists.)
2221 .IP LESSMETACHARS
2222 List of characters which are considered "metacharacters" by the shell.
2223 .IP LESSMETAESCAPE
2224 Prefix which less will add before each metacharacter in a
2225 command sent to the shell.
2226 If LESSMETAESCAPE is an empty string, commands containing
2227 metacharacters will not be passed to the shell.
2228 .IP LESSOPEN
2229 Command line to invoke the (optional) input-preprocessor.
2230 .IP LESSSECURE
2231 Runs less in "secure" mode.
2232 See discussion under SECURITY.
2233 .IP LESSSEPARATOR
2234 String to be appended to a directory name in filename completion.
2235 .IP LESSUTFBINFMT
2236 Format for displaying non-printable Unicode code points.
2237 .IP LESSUTFCHARDEF 
2238 Overrides the type of specified Unicode characters.
2239 .IP LESS_COLUMNS
2240 Sets the number of columns on the screen.
2241 Unlike COLUMNS, takes precedence over the system's idea of the screen size,
2242 so it can be used to make
2243 .B less
2244 use less than the full screen width.
2245 If set to a negative number, sets the number of columns used to
2246 this much less than the actual screen width.
2247 .IP LESS_LINES
2248 Sets the number of lines on the screen.
2249 Unlike LINES, takes precedence over the system's idea of the screen size,
2250 so it can be used to make
2251 .B less
2252 use less than the full screen height.
2253 If set to a negative number, sets the number of lines used to
2254 this much less than the actual screen height.
2255 When set,
2256 .B less
2257 repaints the entire screen on every movement command,
2258 so scrolling may be slower.
2259 .IP LESS_DATA_DELAY
2260 Duration (in milliseconds) after starting to read data from the input,
2261 after which the "Waiting for data" message will be displayed.
2262 The default is 4000 (4 seconds).
2263 .IP LESS_IS_MORE
2264 Emulate the
2265 .BR more (1)
2266 command.
2267 .IP LESS_TERMCAP_xx
2268 Where "xx" is any two characters, overrides the definition 
2269 of the termcap "xx" capability for the terminal.
2270 .IP LINES
2271 Sets the number of lines on the screen.
2272 Takes precedence over the number of lines specified by the TERM variable.
2273 (But if you have a windowing system which supports TIOCGWINSZ or WIOCGETD,
2274 the window system's idea of the screen size takes precedence over the
2275 LINES and COLUMNS environment variables.)
2276 .IP MORE
2277 Options which are passed to
2278 .B less
2279 automatically when running in
2280 .BR more "-compatible mode."
2281 .IP PATH
2282 User's search path (used to find a lesskey file
2283 on MS-DOS and OS/2 systems).
2284 .IP SHELL
2285 The shell used to execute the !\& command, as well as to expand filenames.
2286 .IP TERM
2287 The type of terminal on which
2288 .B less
2289 is being run.
2290 .IP VISUAL
2291 The name of the editor (used for the v command).
2292 .IP XDG_CONFIG_HOME
2293 Possible location of the 
2294 .B lesskey
2295 file; see the KEY BINDINGS section.
2296 .IP XDG_DATA_HOME
2297 Possible location of the history file; see the description of the LESSHISTFILE environment variable.
2298 .IP XDG_STATE_HOME
2299 Possible location of the history file; see the description of the LESSHISTFILE environment variable.
2300 .
2301 .SH "SEE ALSO"
2302 .BR lesskey (1),
2303 .BR lessecho (1)
2304 .
2305 .SH COPYRIGHT
2306 Copyright (C) 1984-2023  Mark Nudelman
2307 .PP
2308 less is part of the GNU project and is free software.
2309 You can redistribute it and/or modify it
2310 under the terms of either
2311 (1) the GNU General Public License as published by
2312 the Free Software Foundation; or (2) the Less License.
2313 See the file README in the less distribution for more details
2314 regarding redistribution.
2315 You should have received a copy of the GNU General Public License
2316 along with the source for less; see the file COPYING.
2317 If not, write to the Free Software Foundation, 59 Temple Place,
2318 Suite 330, Boston, MA  02111-1307, USA.
2319 You should also have received a copy of the Less License;
2320 see the file LICENSE.
2321 .PP
2322 less is distributed in the hope that it will be useful, but
2323 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
2324 or FITNESS FOR A PARTICULAR PURPOSE.
2325 See the GNU General Public License for more details.
2326 .
2327 .SH AUTHOR
2328 .
2329 Mark Nudelman
2330 .br
2331 Report bugs at https://github.com/gwsw/less/issues.
2332 .br
2333 For more information, see the less homepage at
2334 .br
2335 https://greenwoodsoftware.com/less