Debian Codegraph @

upstream/mageia-cauldron/man1/less.1

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