Debian Codegraph @

upstream/fedora-rawhide/man1/less.1

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