Debian Codegraph @

upstream/opensuse-tumbleweed/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 "\fB\-h\fP\fIn\fP or \fB\-\-max\-back\-scroll=\fP\fIn\fP"
1117 Specifies a maximum number of lines to scroll backward.
1118 If it is necessary to scroll backward more than \fIn\fP lines,
1119 the screen is repainted in a forward direction instead.
1120 (If the terminal does not have the ability to scroll
1121 backward,
1122 .B "\-h0"
1123 is implied.)
1124 .IP "\fB\-i\fP or \fB\-\-ignore\-case\fP"
1125 Causes searches to ignore case; that is,
1126 uppercase and lowercase are considered identical.
1127 This option is ignored if any uppercase letters
1128 appear in the search pattern;
1129 in other words,
1130 if a pattern contains uppercase letters, then that search does not ignore case.
1131 .IP "\fB\-I\fP or \fB\-\-IGNORE\-CASE\fP"
1132 Like
1133 .BR "\-i" ","
1134 but searches ignore case even if
1135 the pattern contains uppercase letters.
1136 .IP "\fB\-j\fP\fIn\fP or \fB\-\-jump\-target=\fP\fIn\fP"
1137 Specifies a line on the screen where the "target" line
1138 is to be positioned.
1139 The target line is the line specified by any command to
1140 search for a pattern, jump to a line number,
1141 jump to a file percentage or jump to a tag.
1142 The screen line may be specified by a number: the top line on the screen
1143 is 1, the next is 2, and so on.
1144 The number may be negative to specify a line relative to the bottom
1145 of the screen: the bottom line on the screen is \-1, the second
1146 to the bottom is \-2, and so on.
1147 Alternately, the screen line may be specified as a fraction of the height
1148 of the screen, starting with a decimal point: \&.5 is in the middle of the
1149 screen, \&.3 is three tenths down from the first line, and so on.
1150 If the line is specified as a fraction, the actual line number
1151 is recalculated if the terminal window is resized.
1152 If the
1153 .B "\-\-header"
1154 option is used and the target line specified by
1155 .B "\-j"
1156 would be obscured by the header, the target line is moved to the first
1157 line after the header.
1158 .RS
1159 .PP
1160 If any form of the
1161 .B "\-j"
1162 option is used,
1163 repeated forward searches (invoked with "n" or "N")
1164 begin at the line immediately after the target line,
1165 and repeated backward searches begin at the target line,
1166 unless changed by
1167 .B "\-a"
1168 or
1169 .BR "\-A" "."
1170 For example, if
1171 .RB "\[dq]" "\-j4" "\[dq]"
1172 is used, the target line is the
1173 fourth line on the screen, so forward searches begin at the fifth line
1174 on the screen.
1175 However nonrepeated searches (invoked with "/" or "?")
1176 always begin at the first or last line on the screen respectively.
1177 .RE
1178 .IP "\fB\-J\fP or \fB\-\-status\-column\fP"
1179 Displays a status column at the left edge of the screen.
1180 The character displayed in the status column may be one of:
1181 .RS
1182 .IP ">"
1183 The line is chopped with the
1184 .B "\-S"
1185 option, and
1186 the text that is chopped off beyond the right edge of the screen
1187 contains a match for the current search.
1188 .IP "<"
1189 The line is horizontally shifted, and
1190 the text that is shifted beyond the left side of the screen
1191 contains a match for the current search.
1192 .IP "="
1193 The line is both chopped and shifted,
1194 and there are matches beyond both sides of the screen.
1195 .IP "*"
1196 There are matches in the visible part of the line
1197 but none to the right or left of it.
1198 .IP "a-z, A-Z"
1199 The line has been marked with the corresponding letter via the m or M command.
1200 .IP "#"
1201 The line has been marked by left-clicking it with the mouse
1202 when the
1203 .B "\-\-mouse"
1204 option is in effect.
1205 .RE
1206 .IP "\fB\-k\fP\fIfilename\fP or \fB\-\-lesskey\-file=\fP\fIfilename\fP"
1207 Causes
1208 .B less
1209 to open and interpret the named file as a
1210 .BR lesskey (1)
1211 binary file.
1212 Multiple
1213 .B "\-k"
1214 options may be specified.
1215 If the LESSKEY or LESSKEY_SYSTEM environment variable is set, or
1216 if a lesskey file is found in a standard place (see KEY BINDINGS),
1217 it is also used as a
1218 .B lesskey
1219 file.
1220 Note the warning under
1221 .B "\-\-lesskey\-content"
1222 below.
1223 .IP "\fB\-\-lesskey\-src=\fP\fIfilename\fP"
1224 Causes
1225 .B less
1226 to open and interpret the named file as a
1227 .BR lesskey (1)
1228 source file.
1229 If the LESSKEYIN or LESSKEYIN_SYSTEM environment variable is set, or
1230 if a lesskey source file is found in a standard place (see KEY BINDINGS),
1231 it is also used as a lesskey source file.
1232 Prior to version 582, the
1233 .B lesskey
1234 program needed to be run to convert a lesskey
1235 .I source
1236 file to a lesskey
1237 .I binary
1238 file for
1239 .B less
1240 to use.
1241 Newer versions of
1242 .B less
1243 read the lesskey source
1244 file directly and ignore the binary file if the source file exists.
1245 Note the warning under
1246 .B "\-\-lesskey\-content"
1247 below.
1248 .IP "\fB\-\-lesskey\-content=\fP\fItext\fP"
1249 Causes
1250 .B less
1251 to interpret the specified text as the contents of a
1252 .BR lesskey (1)
1253 source file.
1254 In the text,
1255 .B lesskey
1256 lines may be separated by either newlines as usual, or by semicolons.
1257 A literal semicolon may be represented by a backslash followed by a semicolon.
1258 .IP
1259 Warning: certain environment variables such as
1260 LESS, LESSSECURE, LESSCHARSET and others,
1261 which are used early in startup,
1262 cannot be set in a file specified by a command line option
1263 .RB "(" "\-\-lesskey" ", " "\-\-lesskey\-src" " or " "\-\-lesskey\-content" ")."
1264 When using a
1265 .B lesskey
1266 file to set environment variables, it is safer to use the
1267 default lesskey file, or to specify the file using the
1268 LESSKEYIN or LESSKEY_CONTENT environment variables rather than using
1269 a command line option.
1270 .IP "\fB\-K\fP or \fB\-\-quit\-on\-intr\fP"
1271 Causes
1272 .B less
1273 to exit immediately (with status 2)
1274 when an interrupt character (usually \*^C) is typed.
1275 Normally, an interrupt character causes
1276 .B less
1277 to stop whatever it is doing and return to its command prompt.
1278 .IP "\fB\-L\fP or \fB\-\-no\-lessopen\fP"
1279 Ignore the LESSOPEN environment variable
1280 (see the INPUT PREPROCESSOR section below).
1281 This option can be set from within
1282 .BR less ,
1283 but it will apply only to files opened subsequently, not to the
1284 file which is currently open.
1285 .IP "\fB\-m\fP or \fB\-\-long\-prompt\fP"
1286 Causes
1287 .B less
1288 to prompt verbosely (like
1289 .BR more (1)),
1290 with the percent into the file.
1291 By default,
1292 .B less
1293 prompts with a colon.
1294 .IP "\fB\-M\fP or \fB\-\-LONG\-PROMPT\fP"
1295 Causes
1296 .B less
1297 to prompt even more verbosely than
1298 .BR more (1).
1299 .IP "\fB\-n\fP or \fB\-\-line\-numbers\fP"
1300 Suppresses line numbers.
1301 The default (to use line numbers) may cause
1302 .B less
1303 to run more slowly in some cases, especially with a very large input file.
1304 Using line numbers means: the line number will be displayed in the verbose
1305 prompt and in the = command,
1306 and the v command will pass the current line number to the editor
1307 (see also the discussion of LESSEDIT in PROMPTS below).
1308 .IP "\fB\-N\fP or \fB\-\-LINE\-NUMBERS\fP"
1309 Causes a line number to be displayed at the beginning of
1310 each line in the display.
1311 .IP "\fB\-o\fP\fIfilename\fP or \fB\-\-log\-file=\fP\fIfilename\fP"
1312 Causes
1313 .B less
1314 to copy its input to the named file as it is being viewed.
1315 This applies only when the input file is a pipe,
1316 not an ordinary file.
1317 If the file already exists,
1318 .B less
1319 will ask for confirmation before overwriting it.
1320 .IP "\fB\-O\fP\fIfilename\fP or \fB\-\-LOG\-FILE=\fP\fIfilename\fP"
1321 The
1322 .B "\-O"
1323 option is like
1324 .B "\-o,"
1325 but it will overwrite an existing
1326 file without asking for confirmation.
1327 .IP
1328 If no log file has been specified,
1329 the
1330 .B "\-o"
1331 and
1332 .B "\-O"
1333 options can be used from within
1334 .B less
1335 to specify a log file.
1336 Without a file name, they will simply report the name of the log file.
1337 The "s" command is equivalent to specifying
1338 .B "\-o"
1339 from within
1340 .BR less .
1341 .IP "\fB\-p\fP\fIpattern\fP or \fB\-\-pattern=\fP\fIpattern\fP"
1342 The \-p option on the command line is equivalent to
1343 specifying +/\fIpattern\fP;
1344 that is, it tells
1345 .B less
1346 to start at the first occurrence of \fIpattern\fP in the file.
1347 .IP "\fB\-P\fP\fIprompt\fP or \fB\-\-prompt=\fP\fIprompt\fP"
1348 Provides a way to tailor the three prompt
1349 styles to your own preference.
1350 This option would normally be put in the LESS environment
1351 variable, rather than being typed in with each
1352 .B less
1353 command.
1354 Such an option must either be the last option in the LESS variable,
1355 or be terminated by a dollar sign.
1356 .PP
1357 .RS
1358 .TP
1359 \fB\-Ps\fP
1360 followed by a string changes the default (short) prompt
1361 to that string.
1362 .TP
1363 \fB\-Pm\fP
1364 changes the medium
1365 .RB "(" "\-m" ")"
1366 prompt.
1367 .TP
1368 \fB\-PM\fP
1369 changes the long
1370 .RB "(" "\-M" ")"
1371 prompt.
1372 .TP
1373 \fB\-Ph\fP
1374 changes the prompt for the help screen.
1375 .TP
1376 \fB\-P=\fP
1377 changes the message printed by the = command.
1378 .TP
1379 \fB\-Pw\fP
1380 changes the message printed while waiting for data (in the "F" command).
1381 .RE
1382 .IP
1383 All prompt strings consist of a sequence of
1384 letters and special escape sequences.
1385 See the section on PROMPTS for more details.
1386 .IP "\fB\-q\fP or \fB\-\-quiet\fP or \fB\-\-silent\fP"
1387 Causes moderately "quiet" operation:
1388 the terminal bell is not rung
1389 if an attempt is made to scroll past the end of the file
1390 or before the beginning of the file.
1391 If the terminal has a "visual bell", it is used instead.
1392 The bell will be rung on certain other errors,
1393 such as typing an invalid character.
1394 The default is to ring the terminal bell in all such cases.
1395 .IP "\fB\-Q\fP or \fB\-\-QUIET\fP or \fB\-\-SILENT\fP"
1396 Causes totally "quiet" operation:
1397 the terminal bell is never rung.
1398 If the terminal has a "visual bell", it is used in all cases
1399 where the terminal bell would have been rung.
1400 .IP "\fB\-r\fP or \fB\-\-raw\-control\-chars\fP"
1401 Causes "raw" control characters to be displayed.
1402 The default is to display control characters using the caret notation;
1403 for example, a control-A (octal 001) is displayed as "\*^A"
1404 (with some exceptions as described under the
1405 .B "\-U"
1406 option).
1407 Warning: when the
1408 .B "\-r"
1409 option is used,
1410 .B less
1411 cannot keep track of the actual appearance of the screen
1412 (since this depends on how the screen responds to
1413 each type of control character).
1414 Thus, various display problems may result,
1415 such as long lines being split in the wrong place.
1416 .IP
1417 USE OF THE
1418 .B "\-r"
1419 OPTION IS DANGEROUS AND IS NOT RECOMMENDED.
1420 .br
1421 The
1422 .B "\-r"
1423 option can be set on the command line or via the \- command,
1424 but to avoid unintentional use, it cannot be set in a LESS environment variable.
1425 If
1426 .B "\-r"
1427 appears in a LESS environment variable, it is treated as if it were
1428 .BR "\-R" "."
1429 .IP "\fB\-R\fP or \fB\-\-RAW\-CONTROL\-CHARS\fP"
1430 Like
1431 .BR "\-r" ","
1432 but only a limited set of escape
1433 sequences are output in "raw" form.
1434 Unlike
1435 .BR "\-r" ","
1436 the screen appearance is maintained correctly.
1437 The sequences which are output raw are:
1438 .IP
1439 1. ANSI SGR ("color") sequences
1440 .IP
1441 2. OSC 8 hyperlinks
1442 .IP
1443 3. Other OSC sequences, if the OSC type number is listed in
1444 the LESSANSIOSCALLOW environment variable
1445 .IP
1446 4. OSC sequences starting with a non-standard introductory character
1447 (that is, something other than "]"), if the character is listed in
1448 the LESSANSIOSCCHARS environment variable followed by an asterisk
1449 .IP
1450 ANSI color escape sequences are sequences of the form:
1451 .IP
1452 .EX
1453 ESC [ \&...\& m
1454 .EE
1455 .IP
1456 where the "...\&" is zero or more color specification characters.
1457 Color escape sequences are only supported when the color
1458 is changed within one line, not across lines.
1459 In other words, the beginning of each line is assumed to be
1460 normal (non-colored), regardless of any escape sequences in previous lines.
1461 .IP
1462 You can make
1463 .B less
1464 think that characters other than "m" can end ANSI color escape sequences
1465 by setting the environment variable LESSANSIENDCHARS to the list of
1466 characters which can end a color escape sequence.
1467 And you can make
1468 .B less
1469 think that characters other than the standard ones may appear between
1470 the ESC and the m by setting the environment variable LESSANSIMIDCHARS
1471 to the list of characters which can appear.
1472 .IP
1473 OSC sequences are of the form:
1474 .IP
1475 .EX
1476 ESC ] N ; \&...\& \e7
1477 .EE
1478 .IP
1479 where the OSC type number N is a decimal integer.
1480 The terminating sequence may be either a BEL character (\e7)
1481 as above, or the two-character sequence "ESC \e".
1482 .IP "\fB\-s\fP or \fB\-\-squeeze\-blank\-lines\fP"
1483 Causes consecutive blank lines to be squeezed into a single blank line.
1484 This is useful when viewing
1485 .BR nroff (1)
1486 output.
1487 .IP "\fB\-S\fP or \fB\-\-chop\-long\-lines\fP"
1488 Causes lines longer than the screen width to be
1489 chopped (truncated) rather than wrapped.
1490 That is, the portion of a long line that does not fit in
1491 the screen width is not displayed until you press RIGHT-ARROW.
1492 The default is to wrap long lines; that is, display the remainder
1493 on the next line.
1494 See also the
1495 .B "\-\-wordwrap"
1496 option.
1497 While the
1498 .B "\-\-header"
1499 option is active, the
1500 .B "\-S"
1501 option is ignored,
1502 and lines longer than the screen width are truncated.
1503 .IP "\fB\-t\fP\fItag\fP or \fB\-\-tag=\fP\fItag\fP"
1504 The
1505 .B "\-t"
1506 option, followed immediately by a TAG,
1507 will edit the file containing that tag.
1508 For this to work, tag information must be available;
1509 for example, there may be a file in the current directory called "tags",
1510 which was previously built by
1511 .BR ctags (1)
1512 or an equivalent command.
1513 If the environment variable LESSGLOBALTAGS is set, it is taken to be
1514 the name of a command compatible with
1515 .BR global (1),
1516 and that command is executed to find the tag.
1517 (See
1518 .nh
1519 http://\*:www\*:.gnu\*:.org/\*:software/\*:global/\*:global\*:.html).
1520 .hy
1521 The
1522 .B "\-t"
1523 option may also be specified from within
1524 .B less
1525 (using the \- command) as a way of examining a new file.
1526 The command ":t" is equivalent to specifying
1527 .B "\-t"
1528 from within
1529 .BR less .
1530 .IP "\fB\-T\fP\fItagsfile\fP or \fB\-\-tag\-file=\fP\fItagsfile\fP"
1531 Specifies a tags file to be used instead of "tags".
1532 .IP "\fB\-u\fP or \fB\-\-underline\-special\fP"
1533 Causes backspaces and carriage returns to be treated as printable characters;
1534 that is, they are sent to the terminal when they appear in the input.
1535 .IP "\fB\-U\fP or \fB\-\-UNDERLINE\-SPECIAL\fP"
1536 Causes backspaces, tabs, carriage returns and "formatting characters"
1537 (as defined by Unicode) to be treated as control characters;
1538 that is, they are handled as specified by the
1539 .B "\-r"
1540 option.
1541 .IP
1542 By default, if neither
1543 .B "\-u"
1544 nor
1545 .B "\-U"
1546 is given,
1547 backspaces which appear adjacent to an underscore character
1548 are treated specially:
1549 the underlined text is displayed
1550 using the terminal's hardware underlining capability.
1551 Also, backspaces which appear between two identical characters
1552 are treated specially:
1553 the overstruck text is printed
1554 using the terminal's hardware boldface capability.
1555 Other backspaces are deleted, along with the preceding character.
1556 Carriage returns immediately followed by a newline are deleted.
1557 Other carriage returns are handled as specified by the
1558 .B "\-r"
1559 option.
1560 Unicode formatting characters, such as the Byte Order Mark,
1561 are sent to the terminal.
1562 Text which is overstruck or underlined can be searched for
1563 if neither
1564 .B "\-u"
1565 nor
1566 .B "\-U"
1567 is in effect.
1568 .IP
1569 See also the
1570 .BR "\-\-proc\-backspace" "," "\-\-proc\-tab" ", and " "\-\-proc\-return"
1571 options.
1572 .IP "\fB\-V\fP or \fB\-\-version\fP"
1573 Displays the version number of
1574 .BR less .
1575 .IP "\fB\-w\fP or \fB\-\-hilite\-unread\fP"
1576 Temporarily highlights the first "new" line after a movement
1577 of a full page.
1578 The first "new" line is the line immediately following the line previously
1579 at the bottom of the screen.
1580 Also highlights the target line after a g or p command.
1581 The highlight is removed at the next command which causes movement.
1582 If the
1583 .B "\-\-status\-line"
1584 option is in effect, the entire line
1585 (the width of the screen) is highlighted.
1586 Otherwise, only the text in the line is highlighted,
1587 unless the
1588 .B "\-J"
1589 option is in effect,
1590 in which case only the status column is highlighted.
1591 .IP "\fB\-W\fP or \fB\-\-HILITE\-UNREAD\fP"
1592 Like
1593 .BR "\-w" ","
1594 but temporarily highlights the first new line after any
1595 movement command larger than one line.
1596 .IP "\fB\-x\fP\fIn\fP,...\& or \fB\-\-tabs=\fP\fIn\fP,..."
1597 Sets tab stops.
1598 If only one \fIn\fP is specified, tab stops are set at multiples of \fIn\fP.
1599 If multiple values separated by commas are specified, tab stops
1600 are set at those positions, and then continue with the same spacing as the
1601 last two.
1602 Position numbers are zero-based: the leftmost position is 0,
1603 the next is 1, etc.
1604 For example,
1605 .RB "\[dq]" "\-x8,16" "\[dq]"
1606 is the same as
1607 .RB "\[dq]" "\-x8" "\[dq]"
1608 and sets tabs at position 8, 16, 24, 32, etc.
1609 .RB "\[dq]" "\-x10,14,20" "\[dq]"
1610 will set tabs at position 10, 14, 20, 26, 32, etc.
1611 The default for \fIn\fP is 8.
1612 .IP "\fB\-X\fP or \fB\-\-no\-init\fP"
1613 Disables sending the termcap initialization and deinitialization strings
1614 to the terminal.
1615 This is sometimes desirable if initialization or deinitialization does
1616 something unnecessary, like clearing the screen.
1617 Note that some terminals require the initialization string for proper
1618 operation, so they may not behave completely correctly when
1619 .B "\-X"
1620 is used.
1621 .IP "\fB\-y\fP\fIn\fP or \fB\-\-max\-forw\-scroll=\fP\fIn\fP"
1622 Specifies a maximum number of lines to scroll forward.
1623 If it is necessary to scroll forward more than \fIn\fP lines,
1624 the screen is repainted instead.
1625 The
1626 .B "\-c"
1627 or
1628 .B "\-C"
1629 option may be used to repaint from the top of
1630 the screen if desired.
1631 By default, any forward movement causes scrolling.
1632 .IP "\fB\-z\fP\fIn\fP or \fB\-\-window=\fP\fIn\fP or \-\fIn\fP"
1633 Changes the default scrolling window size to \fIn\fP lines.
1634 The default is one screenful.
1635 The z and w commands can also be used to change the window size.
1636 The "z" may be omitted for compatibility with some versions of
1637 .BR more (1).
1638 If the number
1639 .I n
1640 is negative, it indicates
1641 .I n
1642 lines less than the current screen size.
1643 For example, if the screen is 24 lines,
1644 .B "\-z\-4"
1645 sets the
1646 scrolling window to 20 lines. If the screen is later resized to 40 lines,
1647 the scrolling window automatically changes to 36 lines.
1648 .IP "\fB\-""\fP\fIcc\fP\ or\ \fB\-\-quotes=\fP\fIcc\fP"
1649 Changes the filename quoting character.
1650 This may be necessary if you are trying to name a file
1651 which contains both spaces and quote characters.
1652 Followed by a single character, this changes the quote character to that
1653 character.
1654 Filenames containing a space should then be surrounded by that character
1655 rather than by double quotes.
1656 Followed by two characters, changes the open quote to the first character,
1657 and the close quote to the second character.
1658 Filenames containing a space should then be preceded by the open quote
1659 character and followed by the close quote character.
1660 Note that even after the quote characters are changed, this option
1661 remains \-" (a dash followed by a double quote).
1662 .IP "\fB\-\*~\fP or \fB\-\-tilde\fP"
1663 Normally lines after end of file are displayed as a single tilde (\*~).
1664 This option causes lines after end of file to be displayed as blank lines.
1665 .IP "\fB\-#\fP or \fB\-\-shift\fP"
1666 Specifies the default number of positions to scroll horizontally
1667 in the RIGHTARROW and LEFTARROW commands.
1668 If the number specified is zero, it sets the default number of
1669 positions to one half of the screen width.
1670 Alternately, the number may be specified as a fraction of the width
1671 of the screen, starting with a decimal point: \&.5 is half of the
1672 screen width, \&.3 is three tenths of the screen width, and so on.
1673 If the number is specified as a fraction, the actual number of
1674 scroll positions is recalculated if the terminal window is resized.
1675 .IP "\fB\-\-autosave=\fP\fIactions\fP
1676 Normally the history file is saved only when
1677 .B less
1678 exits.
1679 This option specifies other actions which will cause the history file to be saved.
1680 Each action is defined by a single character in the \fIactions\fP string:
1681 .RS
1682 .IP "m"
1683 Setting or clearing a mark while
1684 .B "\-\-save-marks"
1685 is in effect.
1686 .IP "/"
1687 Searching.
1688 .IP "!"
1689 Running a shell command.
1690 .IP "*"
1691 Any action; same as "m/!".
1692 .RE
1693 .IP
1694 Can be set to "-" to specify the default, that only exiting
1695 .B less
1696 will cause the history file to be saved.
1697 Note that, depending on your shell, if you specify this option on the
1698 command line, the "!" and "*" characters may need to be escaped or quoted.
1699 .IP "\fB\-\-cmd=\fP\fIcommands\fP
1700 The specified string is taken to be an initial command to
1701 .BR less .
1702 This is similar to specifying "+\fIcommands\fP", except that
1703 commands specified by
1704 .B "\-\-cmd"
1705 are not executed if
1706 .B less
1707 exits immediately due to the use of the
1708 .B "\-E"
1709 or
1710 .B "\-F"
1711 option, while
1712 commands specified by the \fB+\fP option are executed even if
1713 .B less
1714 exits immediately.
1715 .IP "\fB\-\-emouse=\fP\fIfeatures\fP
1716 \fIfeatures\fP is a comma-separated list of mouse features to be enabled,
1717 selected from this list:
1718 .RS
1719 .IP "vscroll"
1720 Scrolling the mouse wheel down or up moves forward or backward in
1721 the file.
1722 The number of lines to scroll when the wheel is moved can be set by the
1723 .B "\-\-wheel\-lines"
1724 option.
1725 The
1726 .B "\-\-rmouse"
1727 option reverses the direction of movement.
1728 .IP "vdrag"
1729 Holding down the left button and dragging up or down moves
1730 forward or backward in the file.
1731 .IP "hscroll"
1732 Scrolling the side scroll wheel left or right moves left or right
1733 in the file.
1734 The number of columns to scroll when the wheel is moved can be set by the
1735 .B "\-\-wheel\-lines"
1736 option.
1737 The
1738 .B "\-\-rmouse"
1739 option reverses the direction of movement.
1740 .IP "hdrag"
1741 Holding down the left button and dragging left or right moves
1742 left or right in the file.
1743 .IP "lclick"
1744 Left-clicking sets the "#" mark to the line where the mouse is clicked.
1745 If a left-click is performed with the mouse cursor on an OSC 8 hyperlink,
1746 the hyperlink is selected as if by the \*^O\*^N command.
1747 If a left-click is performed with the mouse cursor on an OSC 8 hyperlink
1748 which is already selected, the hyperlink is opened as if by the \*^O\*^O command.
1749 .IP "rclick"
1750 Right-clicking (or clicking any button other than the left one)
1751 returns to the "#" mark position.
1752 .IP "scroll"
1753 Same as "vscroll,hscroll".
1754 .IP "drag"
1755 Same as "vdrag,hdrag".
1756 .IP "hmove"
1757 Same as "hscroll,hdrag".
1758 .IP "vmove"
1759 Same as "vscroll,vdrag".
1760 .IP "move"
1761 Same as "vmove,hmove".
1762 .IP "click"
1763 Same as "lclick,rclick".
1764 .IP "all"
1765 Same as "move,click".
1766 .RE
1767 .IP
1768 Each feature name may be abbreviated as long as the abbreviation
1769 is unambiguous.
1770 If \fIfeatures\fP is set to "-", all mouse features are disabled.
1771 Mouse input works only on terminals which support X11 mouse reporting,
1772 and on Windows.
1773 .IP "\fB\-\-end\-prompt=\fP\fIstring\fP"
1774 Specifies a string which is printed immediately after the prompt is erased.
1775 As with the \fB\-\-prompt\fP option, the first character of the string
1776 determines which prompt the string will be printed after
1777 ("\fBs\fP" for the short prompt, "\fBm\fP" for the medium prompt,
1778 or "\fBM\fP" for the long prompt).
1779 Special characters in the string are processed as described in the PROMPTS
1780 section, in the same way as prompts specified by the \fB\-\-prompt\fP option.
1781 If set to a dash (\fB\-\fP), nothing is printed after the prompt is erased.
1782 This option can be useful if the prompt string has been modified to contain
1783 an escape sequence that puts the terminal in a mode which should be cleared
1784 when the prompt is erased.
1785 .IP "\fB\-\-exit\-follow\-on\-close\fP"
1786 When using the "F" command on a pipe,
1787 .B less
1788 will automatically stop waiting for more data when the input side of the
1789 pipe is closed.
1790 .IP "\fB\-\-file\-size\fP"
1791 If
1792 .B "\-\-file\-size"
1793 is specified,
1794 .B less
1795 will determine the size of the file
1796 immediately after opening the file.
1797 With this option enabled, the = command and the long prompt will display
1798 the number of lines in the file.
1799 Normally this is not done, because it can be slow if the input file
1800 is non-seekable (such as a pipe) and is large.
1801 .IP "\fB\-\-follow\-name\fP"
1802 Normally, if the input file is renamed while an F command is executing,
1803 .B less
1804 will continue to display the contents of the original file despite
1805 its name change.
1806 If
1807 .B "\-\-follow\-name"
1808 is specified, during an F command
1809 .B less
1810 will periodically attempt to reopen the file by name.
1811 If the reopen succeeds and the file is a different file from the original
1812 (which means that a new file has been created
1813 with the same name as the original (now renamed) file),
1814 .B less
1815 will display the contents of that new file.
1816 .IP "\fB\-\-form\-feed\fP"
1817 When scrolling forward or backward in the file,
1818 stop if a line beginning with a form feed character (\*^L) is reached.
1819 This can be useful when viewing a file which uses form feeds between pages.
1820 .IP "\fB\-\-header=\fP\fIL\fP,\fIC\fP,\fIN\fP"
1821 .RS
1822 Sets the number of header lines and columns displayed on the screen.
1823 The number of header lines is set to \fIL\fP.
1824 If \fIL\fP is 0, header lines are disabled.
1825 If \fIL\fP is empty or missing, the number of header lines is unchanged.
1826 The number of header columns is set to \fIC\fP.
1827 If \fIC\fP is 0, header columns are disabled.
1828 If \fIC\fP is empty or missing, the number of header columns is unchanged.
1829 The first header line is set to line number \fIN\fP in the file.
1830 If \fIN\fP is empty or missing, it is taken to be
1831 the number of the line currently displayed in the first line of the screen
1832 (if the
1833 .B "\-\-header"
1834 command has been issued from within
1835 .BR less "),"
1836 or 1 (if the
1837 .B "\-\-header"
1838 option has been given on the command line).
1839 The special form
1840 .RB "\[dq]" "\-\-header=\-" "\[dq]"
1841 disables header lines and header columns,
1842 and is equivalent to
1843 .RB "\[dq]" "\-\-header=0,0" "\[dq]."
1844 .PP
1845 When \fIL\fP is nonzero, the first \fIL\fP lines at the top
1846 of the screen are replaced with the \fIL\fP lines of the file beginning at line \fIN\fP,
1847 regardless of what part of the file is being viewed.
1848 When header lines are displayed, any file contents before the header line cannot be viewed.
1849 When \fIC\fP is nonzero, the first \fIC\fP characters displayed at the
1850 beginning of each line are replaced with the first \fIC\fP characters of the line,
1851 even if the rest of the line is scrolled horizontally.
1852 .PP
1853 While the
1854 .B "\-\-header"
1855 option is active,
1856 lines longer than the screen width are truncated,
1857 and the
1858 .B "\-S"
1859 option is ignored.
1860 .RE
1861 .IP "\fB\-\-hilite\-target\fP"
1862 Highlights the "target" line, as specified by the \-j option.
1863 If the
1864 .B "\-\-status\-line"
1865 option is in effect, the entire line
1866 (the width of the screen) is highlighted.
1867 Otherwise, only the text in the line is highlighted,
1868 unless the
1869 .B "\-J"
1870 option is in effect,
1871 in which case only the status column is highlighted.
1872 .IP "\fB\-\-incsearch\fP"
1873 Subsequent search commands will be "incremental"; that is,
1874 .B less
1875 will advance to the next line containing the search pattern
1876 as each character of the pattern is typed in.
1877 .IP "\fB\-\-intr=\fP\fIc\fP"
1878 Use the character \fIc\fP instead of \*^X to interrupt a read
1879 when the "Waiting for data" message is displayed.
1880 \fIc\fP must be an ASCII character; that is, one with a value
1881 between 1 and 127 inclusive.
1882 A caret followed by a single character can be used
1883 to specify a control character.
1884 .IP "\fB\-\-line\-num\-width=\fP\fIn\fP"
1885 Sets the minimum width of the line number field when the \-N option is in effect
1886 to \fIn\fP characters.
1887 The default is 7.
1888 .IP "\fB\-\-match\-shift=\fP\fIn\fP"
1889 When
1890 .B "\-S"
1891 is in effect, if a search match is not visible
1892 because it is shifted to the left or right of the currently
1893 visible screen, the text will horizontally shift
1894 to ensure that the search match is visible.
1895 This option selects the column in which the first character
1896 of the search match will be placed after the shift.
1897 In other words, there will be \fIn\fP characters visible
1898 to the left of the search match.
1899 .IP
1900 Alternately, the number may be specified as a fraction of the width
1901 of the screen, starting with a decimal point: \&.5 is half of the
1902 screen width, \&.3 is three tenths of the screen width, and so on.
1903 If the number is specified as a fraction, the actual number of
1904 scroll positions is recalculated if the terminal window is resized.
1905 .IP "\fB\-\-modelines=\fP\fIn\fP"
1906 .RS
1907 Before displaying a file,
1908 .B less
1909 will read the first \fIn\fP lines to try to find a vim-compatible
1910 .IR modeline .
1911 If \fIn\fP is zero,
1912 .B less
1913 does not try to find modelines.
1914 By using a modeline, the file itself can specify the tab stops
1915 that should be used when viewing it.
1916 .PP
1917 A modeline contains, anywhere in the line,
1918 a program name ("vi", "vim", "ex", or "less"),
1919 followed by a colon,
1920 possibly followed by the word "set",
1921 and finally followed by zero or more option settings.
1922 If the word "set" is used,
1923 option settings are separated by spaces, and end at the first colon.
1924 If the word "set" is not used,
1925 option settings may be separated by either spaces or colons.
1926 The word "set" is required if the program name is "less"
1927 but optional if any of the other three names are used.
1928 If any option setting is of the form "tabstop=\fIn\fP" or "ts=\fIn\fP",
1929 then tab stops are automatically set as if
1930 .BI "\-\-tabs=" "n"
1931 had been given.
1932 See the
1933 .B "\-\-tabs"
1934 description for acceptable values of \fIn\fP.
1935 .RE
1936 .IP "\fB\-\-mouse\fP"
1937 Enabling \fB\-\-mouse\fP is the same as \fB\-\-emouse=vmove,click\fP.
1938 Disabling \fB\-\-mouse\fP is the same as \fB\-\-emouse=-\fP.
1939 .IP "\fB\-\-MOUSE\fP"
1940 Like
1941 .B "\-\-mouse"
1942 with
1943 .BR "\-\-rmouse" "."
1944 .IP "\fB\-\-no\-edit\-warn\fP"
1945 Don't print a warning message when using the v command
1946 on a file which was opened using a LESSOPEN preprocessor
1947 (see the INPUT PREPROCESSOR section below).
1948 .IP "\fB\-\-no\-keypad\fP"
1949 Disables sending the keypad initialization and deinitialization strings
1950 to the terminal.
1951 This is sometimes useful if the keypad strings make the numeric
1952 keypad behave in an undesirable manner.
1953 .IP "\fB\-\-no\-histdups\fP"
1954 This option changes the behavior so that if a search string or
1955 file name is typed in, and the same string is already in the history list,
1956 the existing copy is removed from the history list before the new one is added.
1957 Thus, a given string will appear only once in the history list.
1958 Normally, a string may appear multiple times.
1959 .IP "\fB\-\-no\-number\-headers\fP"
1960 Header lines (defined via the
1961 .B "\-\-header"
1962 option) are not assigned line numbers.
1963 Line number 1 is assigned to the first line after any header lines.
1964 .IP "\fB\-\-no\-paste\fP"
1965 If the terminal supports
1966 .BR xterm -compatible
1967 "bracketed paste", any text pasted into
1968 .B less
1969 is ignored, except that one line of text may be pasted into the command line
1970 at the bottom of the screen (search strings, file names, etc).
1971 That is, the first newline of text pasted into the command line
1972 and any text that follows it is ignored.
1973 .IP "\fB\-\-no\-search\-header\-lines\fP"
1974 Searches do not include header lines, but still include header columns.
1975 .IP "\fB\-\-no\-search\-header\-columns\fP"
1976 Searches do not include header columns, but still include header lines.
1977 .IP "\fB\-\-no\-search\-headers\fP"
1978 Searches do not include header lines or header columns.
1979 .IP "\fB\-\-no\-vbell\fP"
1980 Disables the terminal's visual bell.
1981 .IP "\fB\-\-past\-eof\fP"
1982 Normally scrolling commands (other than J, K, ESC-SPACE and ESC-b)
1983 stop scrolling when end-of-file is reached scrolling forward, or
1984 beginning-of-file is reached scrolling backward.
1985 This option makes all scrolling commands continue past end-of-file
1986 or beginning-of-file.
1987 .IP "\fB\-\-proc\-backspace\fP"
1988 If set, backspaces are handled as if neither the
1989 .B "\-u"
1990 option
1991 nor the
1992 .B "\-U"
1993 option were set.
1994 That is, a backspace adjacent to an underscore causes text to be
1995 displayed in underline mode, and a backspace between identical
1996 characters cause text to be displayed in boldface mode.
1997 This option overrides the
1998 .B "\-u"
1999 and
2000 .B "\-U"
2001 options, so that display of
2002 backspaces can be controlled separate from tabs and carriage returns.
2003 If not set, backspace display is controlled by the
2004 .B "\-u"
2005 and
2006 .B "\-U"
2007 options.
2008 .IP "\fB\-\-PROC\-BACKSPACE\fP"
2009 If set, backspaces are handled as if the
2010 .B "\-U"
2011 option were set;
2012 that is backspaces are treated as control characters.
2013 .IP "\fB\-\-proc\-return\fP"
2014 If set, carriage returns are handled as if neither the
2015 .B "\-u"
2016 option
2017 nor the
2018 .B "\-U"
2019 option were set.
2020 That is, a carriage return immediately before a newline is deleted.
2021 This option overrides the
2022 .B "\-u"
2023 and
2024 .B "\-U"
2025 options, so that display of
2026 carriage returns can be controlled separate from that of backspaces and tabs.
2027 If not set, carriage return display is controlled by the
2028 .B "\-u"
2029 and
2030 .B "\-U"
2031 options.
2032 .IP "\fB\-\-PROC\-RETURN\fP"
2033 If set, carriage returns are handled as if the
2034 .B "\-U"
2035 option were set;
2036 that is carriage returns are treated as control characters.
2037 .IP "\fB\-\-proc\-tab\fP"
2038 If set, tabs are handled as if the
2039 .B "\-U"
2040 option were not set.
2041 That is, tabs are expanded to spaces.
2042 This option overrides the
2043 .B "\-U"
2044 option, so that display of
2045 tabs can be controlled separate from that of backspaces and carriage returns.
2046 If not set, tab display is controlled by the
2047 .B "\-U"
2048 option.
2049 .IP "\fB\-\-PROC\-TAB\fP"
2050 If set, tabs are handled as if the
2051 .B "\-U"
2052 option were set;
2053 that is tabs are treated as control characters.
2054 .IP "\fB\-\-redraw\-on\-quit\fP"
2055 When quitting, after sending the terminal deinitialization string,
2056 redraws the entire last screen.
2057 On terminals whose terminal deinitialization string causes the
2058 terminal to switch from an alternate screen,
2059 this makes the last screenful of the current file remain visible after
2060 .B less
2061 has quit.
2062 .IP "\fB\-\-rmouse\fP"
2063 Reverses the normal direction of scrolling when mouse scrolling is
2064 enabled via \fB\-\-emouse=vscroll\fP or \fB\-\-emouse=hscroll\fP.
2065 .IP "\fB\-\-rscroll=\fP\fIc\fP"
2066 This option changes the character used to mark truncated lines.
2067 It may begin with a two-character attribute indicator like LESSBINFMT does.
2068 If there is no attribute indicator, standout is used.
2069 If set to "\-", truncated lines are not marked.
2070 .IP "\fB\-\-save\-marks\fP"
2071 Save marks in the history file, so marks are retained
2072 across different invocations of
2073 .BR less .
2074 .IP "\fB\-\-search\-options=\fP\fI...\fP"
2075 Sets default search modifiers.
2076 The value is a string of one or more of the characters
2077 E, F, K, N, R or W.
2078 Setting any of these has the same effect as typing that
2079 control character at the beginning of every search pattern.
2080 For example, setting
2081 .B "\-\-search\-options=\fIW\fP"
2082 is the same as
2083 typing \*^W at the beginning of every pattern.
2084 The value may also contain a digit between 1 and 5,
2085 which has the same effect as typing \*^S followed by that digit
2086 at the beginning of every search pattern.
2087 The value "\-" disables all default search modifiers.
2088 .IP "\fB\-\-show\-preproc\-errors\fP"
2089 If a LESSOPEN preprocessor produces data,
2090 then exits with a non-zero exit code,
2091 .B less
2092 will display a warning.
2093 .IP "\fB\-\-status\-col\-width=\fP\fIn\fP"
2094 Sets the width of the status column when the
2095 .B "\-J"
2096 option is in effect.
2097 The default is 2 characters.
2098 .IP "\fB\-\-status\-line\fP"
2099 If a line is marked, the entire line (rather than just the status column)
2100 is highlighted.
2101 Also lines highlighted due to the
2102 .B "\-w"
2103 or
2104 .B "\-\-hilite\-target"
2105 option will have
2106 the entire line highlighted.
2107 If
2108 .B "\-\-use\-color"
2109 is set, the line is colored rather than highlighted.
2110 .IP "\fB\-\-use\-backslash\fP"
2111 This option changes the interpretations of options which follow this one.
2112 After the
2113 .B "\-\-use\-backslash"
2114 option, any backslash in an option string is
2115 removed and the following character is taken literally.
2116 This allows a dollar sign to be included in option strings.
2117 .IP "\fB\-\-use\-color\fP"
2118 Enables colored text in various places.
2119 The
2120 .B "\-D"
2121 option can be used to change the colors.
2122 Colored text works only if the terminal supports
2123 ANSI color escape sequences (as defined in
2124 .nh
2125 https://\*:www\*:.ecma\-international\*:.org/\*:publications\-and\-standards/\*:standards/\*:ecma\-48).
2126 .hy
2127 .IP "\fB\-\-wheel\-lines=\fP\fIn\fP"
2128 Set the number of lines or columns to scroll when the mouse wheel is scrolled
2129 and the
2130 .B "\-\-mouse"
2131 or
2132 .B "\-\-MOUSE"
2133 option is in effect.
2134 The default is 1 line or column.
2135 .IP "\fB\-\-wordwrap\fP"
2136 When the
2137 .B "\-S"
2138 option is not in use,
2139 wrap each line at a space or tab if possible,
2140 so that a word is not split between two lines.
2141 The default is to wrap at any character.
2142 .IP \fB\-\-\fP
2143 A command line argument of
2144 .RB "\[dq]" "\-\-" "\[dq]"
2145 marks the end of option arguments.
2146 Any arguments following this are interpreted as filenames.
2147 This can be useful when viewing a file whose name begins with a "\-" or "+".
2148 Otherwise, option arguments and filename arguments can be intermixed;
2149 that is, option arguments do not need to appear before filename arguments,
2150 unless the environment variable POSIXLY_CORRECT is set.
2151 .IP +
2152 If a command line option begins with \fB+\fP,
2153 the remainder of that option is taken to be an initial command to
2154 .BR less .
2155 For example, +G tells
2156 .B less
2157 to start at the end of the file rather than the beginning,
2158 and +/xyz tells it to start at the first occurrence of "xyz" in the file.
2159 As a special case, +<number> acts like +<number>g;
2160 that is, it starts the display at the specified line number
2161 (however, see the caveat under the "g" command above).
2162 If the option starts with ++, the initial command applies to
2163 every file being viewed, not just the first one.
2164 The + command described previously
2165 may also be used to set (or change) an initial command for every file.
2166 Also see the
2167 .B "\-\-cmd"
2168 option.
2169 .
2170 .SH "LINE EDITING"
2171 When entering a command line at the bottom of the screen
2172 (for example, a filename for the :e command,
2173 or the pattern for a search command),
2174 certain keys can be used to manipulate the command line.
2175 Most commands have an alternate form in [ brackets ] which can be used if
2176 a key does not exist on a particular keyboard.
2177 (Note that the forms beginning with ESC do not work
2178 on some MS-DOS and Windows systems because ESC is the line erase character.)
2179 Any of these special keys may be entered literally by preceding
2180 it with the "literal" character, either \*^V or \*^A.
2181 A backslash itself may also be entered literally by entering two backslashes.
2182 .IP "LEFTARROW [ ESC-h ]"
2183 Move the cursor one space to the left.
2184 .IP "RIGHTARROW [ ESC-l ]"
2185 Move the cursor one space to the right.
2186 .IP "\*^LEFTARROW [ ESC-b or ESC-LEFTARROW ]"
2187 (That is, CONTROL and LEFTARROW simultaneously.)
2188 Move the cursor one word to the left.
2189 .IP "\*^RIGHTARROW [ ESC-w or ESC-RIGHTARROW ]"
2190 (That is, CONTROL and RIGHTARROW simultaneously.)
2191 Move the cursor one word to the right.
2192 .IP "HOME [ ESC-0 ]"
2193 Move the cursor to the beginning of the line.
2194 .IP "END [ ESC-$ ]"
2195 Move the cursor to the end of the line.
2196 .IP "BACKSPACE"
2197 Delete the character to the left of the cursor,
2198 or cancel the command if the command line is empty.
2199 .IP "DELETE [ ESC-x ]"
2200 Delete the character under the cursor.
2201 .IP "\*^BACKSPACE [ ESC-BACKSPACE ]"
2202 (That is, CONTROL and BACKSPACE simultaneously.)
2203 Delete the word to the left of the cursor.
2204 .IP "\*^DELETE [ ESC-X or ESC-DELETE ]"
2205 (That is, CONTROL and DELETE simultaneously.)
2206 Delete the word under the cursor.
2207 .IP "UPARROW [ ESC-k ]"
2208 Retrieve the previous command line.
2209 If you first enter some text and then press UPARROW,
2210 it will retrieve the previous command which begins with that text.
2211 .IP "DOWNARROW [ ESC-j ]"
2212 Retrieve the next command line.
2213 If you first enter some text and then press DOWNARROW,
2214 it will retrieve the next command which begins with that text.
2215 .IP "TAB"
2216 Complete the partial filename to the left of the cursor.
2217 If it matches more than one filename, the first match
2218 is entered into the command line.
2219 Repeated TABs will cycle through the other matching filenames.
2220 If the completed filename is a directory, a "/" is appended to the filename.
2221 (On MS-DOS and Windows systems, a "\e" is appended.)
2222 The environment variable LESSSEPARATOR can be used to specify a
2223 different character to append to a directory name.
2224 .IP "BACKTAB (SHIFT-TAB) [ ESC-TAB ]"
2225 Like TAB, but cycles in the reverse direction through the matching filenames.
2226 .IP "\*^L"
2227 Complete the partial filename to the left of the cursor.
2228 If it matches more than one filename, all matches are entered into
2229 the command line (if they fit).
2230 .IP "\*^U (Unix and OS/2) or ESC (MS-DOS and Windows)"
2231 Delete the entire command line,
2232 or cancel the command if the cursor is at the beginning of the command line.
2233 If you have changed your line-kill character in Unix to something
2234 other than \*^U, that character is used instead of \*^U.
2235 .IP "\*^G"
2236 Delete the entire command line and return to the main prompt.
2237 .
2238 .SH "KEY BINDINGS"
2239 You may define your own
2240 .B less
2241 commands by creating a lesskey source file.
2242 This file specifies a set of command keys and an action
2243 associated with each key.
2244 You may also change the line-editing keys (see LINE EDITING),
2245 and set environment variables used by
2246 .BR less .
2247 See the
2248 .BR lesskey (1)
2249 manual page for details about the file format.
2250 .PP
2251 If the environment variable LESSKEYIN is set,
2252 .B less
2253 uses that as the name of the lesskey source file.
2254 Otherwise,
2255 .B less
2256 looks in a standard place for the lesskey source file:
2257 On Unix systems,
2258 .B less
2259 looks for a lesskey file called "$XDG_CONFIG_HOME/lesskey" or "$HOME/.config/lesskey" or "$HOME/.lesskey".
2260 On MS-DOS and Windows systems,
2261 .B less
2262 looks for a lesskey file called "$HOME/_lesskey", and if it is not found there,
2263 then looks for a lesskey file called "_lesskey" in any directory specified
2264 in the PATH environment variable.
2265 On OS/2 systems,
2266 .B less
2267 looks for a lesskey file called "$HOME/lesskey.ini", and if it is not found,
2268 then looks for a lesskey file called "lesskey.ini" in any directory specified
2269 in the INIT environment variable, and if it not found there,
2270 then looks for a lesskey file called "lesskey.ini" in any directory specified
2271 in the PATH environment variable.
2272 .PP
2273 A system-wide lesskey source file may also be set up to provide key bindings.
2274 If a key is defined in both a local lesskey file and in the
2275 system-wide file, key bindings in the local file take precedence over
2276 those in the system-wide file.
2277 If the environment variable LESSKEYIN_SYSTEM is set,
2278 .B less
2279 uses that as the name of the system-wide lesskey file.
2280 Otherwise,
2281 .B less
2282 looks in a standard place for the system-wide lesskey file:
2283 On Unix systems, the system-wide lesskey file is /usr/local/etc/syslesskey.
2284 (However, if
2285 .B less
2286 was built with a different sysconf directory than /usr/local/etc,
2287 that directory is where the sysless file is found.)
2288 On MS-DOS and Windows systems, the system-wide lesskey file is c:\e_syslesskey.
2289 On OS/2 systems, the system-wide lesskey file is c:\esyslesskey.ini.
2290 .PP
2291 Older versions of
2292 .B less
2293 (before v582) used lesskey files with a binary format, produced by the
2294 .B lesskey
2295 program. It is no longer necessary to use the
2296 .B lesskey
2297 program.
2298 .
2299 .SH "INPUT PREPROCESSOR"
2300 You may define an "input preprocessor" for
2301 .BR less .
2302 Before
2303 .B less
2304 opens a file, it first gives the input preprocessor a chance to modify the
2305 way the contents of the file are displayed.
2306 An input preprocessor is simply an executable program (or shell script),
2307 which writes the contents of the file to a different file,
2308 called the replacement file.
2309 The contents of the replacement file are then displayed
2310 in place of the contents of the original file.
2311 However, it will appear to the user as if the original file is opened;
2312 that is,
2313 .B less
2314 will display the original filename as the name of the current file.
2315 .PP
2316 An input preprocessor receives one command line argument, the original filename,
2317 as entered by the user.
2318 It should create the replacement file, and when finished,
2319 print the name of the replacement file to its standard output.
2320 If the input preprocessor does not output a replacement filename,
2321 .B less
2322 uses the original file, as normal.
2323 The input preprocessor is not called when viewing standard input.
2324 To set up an input preprocessor, set the LESSOPEN environment variable
2325 to a command line which will invoke your input preprocessor.
2326 This command line should include one occurrence of the string "%s",
2327 which will be replaced by the filename
2328 when the input preprocessor command is invoked.
2329 .PP
2330 When
2331 .B less
2332 closes a file opened in such a way, it will call another program,
2333 called the input postprocessor,
2334 which may perform any desired clean-up action (such as deleting the
2335 replacement file created by LESSOPEN).
2336 This program receives two command line arguments, the original filename
2337 as entered by the user, and the name of the replacement file.
2338 To set up an input postprocessor, set the LESSCLOSE environment variable
2339 to a command line which will invoke your input postprocessor.
2340 It may include two occurrences of the string "%s";
2341 the first is replaced with the original name of the file and
2342 the second with the name of the replacement file,
2343 which was output by LESSOPEN.
2344 .PP
2345 For example, on many Unix systems, these two scripts will allow you
2346 to keep files in compressed format, but still let
2347 .B less
2348 view them directly:
2349 .PP
2350 lessopen.sh:
2351 .br
2352 #! /bin/sh
2353 .br
2354 case "$1" in
2355 .br
2356 *.Z) TEMPFILE=$(mktemp)
2357 .br
2358 uncompress \-c $1 >$TEMPFILE 2>/dev/null
2359 .br
2360 if [ \-s $TEMPFILE ]; then
2361 .br
2362 echo $TEMPFILE
2363 .br
2364 else
2365 .br
2366 rm \-f $TEMPFILE
2367 .br
2368 fi
2369 .br
2370 ;;
2371 .br
2372 esac
2373 .PP
2374 lessclose.sh:
2375 .br
2376 #! /bin/sh
2377 .br
2378 rm $2
2379 .PP
2380 To use these scripts, put them both where they can be executed and
2381 set LESSOPEN="lessopen.sh\ %s", and
2382 LESSCLOSE="lessclose.sh\ %s\ %s".
2383 More complex LESSOPEN and LESSCLOSE scripts may be written
2384 to accept other types of compressed files, and so on.
2385 .PP
2386 It is also possible to set up an input preprocessor to
2387 pipe the file data directly to
2388 .BR less ,
2389 rather than putting the data into a replacement file.
2390 This avoids the need to decompress the entire file before
2391 starting to view it.
2392 An input preprocessor that works this way is called an input pipe.
2393 An input pipe, instead of writing the name of a replacement file on
2394 its standard output,
2395 writes the entire contents of the replacement file on its standard output.
2396 If the input pipe does not write any characters on its standard output,
2397 then there is no replacement file and
2398 .B less
2399 uses the original file, as normal.
2400 To use an input pipe,
2401 make the first character in the LESSOPEN environment variable a
2402 vertical bar (|) to signify that the input preprocessor is an input pipe.
2403 As with non-pipe input preprocessors, the command string must contain one
2404 occurrence of %s, which is replaced with the filename of the input file.
2405 .PP
2406 For example, on many Unix systems, this script will work like the
2407 previous example scripts:
2408 .PP
2409 lesspipe.sh:
2410 .br
2411 #! /bin/sh
2412 .br
2413 case "$1" in
2414 .br
2415 *.Z) uncompress \-c $1 2>/dev/null
2416 .br
2417 ;;
2418 .br
2419 *) exit 1
2420 .br
2421 ;;
2422 .br
2423 esac
2424 .br
2425 exit $?
2426 .br
2427 .PP
2428 To use this script, put it where it can be executed and set
2429 LESSOPEN="|lesspipe.sh %s".
2430 .PP
2431 Note that a preprocessor cannot output an empty file, since that
2432 is interpreted as meaning there is no replacement, and
2433 the original file is used.
2434 To avoid this, if LESSOPEN starts with two vertical bars,
2435 the exit status of the script determines the behavior when the output is empty.
2436 If the output is empty and the exit status is zero,
2437 the empty output is considered to be replacement text.
2438 If the output is empty and the exit status is nonzero,
2439 the original file is used.
2440 For compatibility with previous versions of
2441 .BR less ,
2442 if LESSOPEN starts with only one vertical bar, the exit status
2443 of the preprocessor is ignored.
2444 .PP
2445 When an input pipe is used, a LESSCLOSE postprocessor can be used,
2446 but it is usually not necessary since there is no replacement file
2447 to clean up.
2448 In this case, the replacement file name passed to the LESSCLOSE
2449 postprocessor is "\-".
2450 .PP
2451 For compatibility with previous versions of
2452 .BR less ,
2453 the input preprocessor or pipe is not used if
2454 .B less
2455 is viewing standard input.
2456 However, if the first character of LESSOPEN is a dash (\fB\-\fP),
2457 the input preprocessor is used on standard input as well as other files.
2458 In this case, the dash is not considered to be part of
2459 the preprocessor command.
2460 If standard input is being viewed, the input preprocessor is passed
2461 a file name consisting of a single dash.
2462 Similarly, if the first two characters of LESSOPEN are vertical bar and dash
2463 (\fB|\-\fP) or two vertical bars and a dash (\fB||\-\fP),
2464 the input pipe is used on standard input as well as other files.
2465 Again, in this case the dash is not considered to be part of
2466 the input pipe command.
2467 .
2468 .SH "NATIONAL CHARACTER SETS"
2469 There are five types of characters in the input file:
2470 .IP "normal characters"
2471 can be displayed directly to the screen.
2472 .IP "control characters"
2473 should not be displayed directly, but are expected to be found
2474 in ordinary text files (such as backspace and tab).
2475 .IP "binary characters"
2476 should not be displayed directly and are not expected to be found
2477 in text files.
2478 .IP "composing characters"
2479 are not displayed separately, but modify the display of the
2480 preceding character. (Only when LESSCHARSET is "utf8".)
2481 .IP "deleted characters"
2482 are simply deleted from the input and not displayed.
2483 (Only when LESSCHARSET is "utf8".)
2484 .PP
2485 A "character set" is a description of which of these categories
2486 each character belongs to.
2487 The LESSCHARSET environment variable may be used to select a character set.
2488 Possible values for LESSCHARSET are:
2489 .IP ascii
2490 BS, TAB, NL, CR, and formfeed are control characters,
2491 all chars with values between 32 and 126 are normal,
2492 and all others are binary.
2493 .IP iso8859
2494 Selects an ISO 8859 character set.
2495 This is the same as ASCII, except characters between 160 and 255 are
2496 treated as normal characters.
2497 .IP latin1
2498 Same as iso8859.
2499 .IP latin9
2500 Same as iso8859.
2501 .IP dos
2502 Selects a character set appropriate for MS-DOS.
2503 .IP ebcdic
2504 Selects an EBCDIC character set.
2505 .IP IBM\-1047
2506 Selects an EBCDIC character set used by OS/390 Unix Services.
2507 This is the EBCDIC analogue of latin1. You get similar results
2508 by setting either LESSCHARSET=IBM\-1047 or LC_CTYPE=en_US
2509 in your environment.
2510 .IP koi8\-r
2511 Selects a Russian character set.
2512 .IP next
2513 Selects a character set appropriate for NeXT computers.
2514 .IP utf\-8
2515 Selects the UTF-8 encoding of the ISO 10646 character set.
2516 UTF-8 is special in that it supports multi-byte characters in the input file.
2517 It is the only character set that supports multi-byte characters.
2518 .IP windows
2519 Selects a character set appropriate for Microsoft Windows (cp 1252).
2520 .PP
2521 In rare cases, it may be desired to tailor
2522 .B less
2523 to use a character set other than the ones definable by LESSCHARSET.
2524 In this case, the environment variable LESSCHARDEF can be used
2525 to define a character set.
2526 It should be set to a string where each character in the string represents
2527 one character in the character set.
2528 The character ".\&" is used for a normal character, "c" for control,
2529 and "b" for binary.
2530 A decimal number may be used for repetition.
2531 For example, "bccc4b.\&" would mean character 0 is binary,
2532 1, 2 and 3 are control, 4, 5, 6 and 7 are binary, and 8 is normal.
2533 All characters after the last are taken to be the same as the last,
2534 so characters 9 through 255 would be normal.
2535 (This is an example, and does not necessarily
2536 represent any real character set.)
2537 .PP
2538 This table shows the value of LESSCHARDEF which is equivalent
2539 to each of the possible values for LESSCHARSET:
2540 .
2541 .RS 5m
2542 .TS
2543 l l.
2544 ascii 8bcccbcc18b95.b
2545 dos 8bcccbcc12bc5b95.b.
2546 ebcdic 5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b
2547 9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b.
2548 IBM\-1047 4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc
2549 191.b
2550 iso8859 8bcccbcc18b95.33b.
2551 koi8\-r 8bcccbcc18b95.b128.
2552 latin1 8bcccbcc18b95.33b.
2553 next 8bcccbcc18b95.bb125.bb
2554 .TE
2555 .RE
2556 .PP
2557 If neither LESSCHARSET nor LESSCHARDEF is set,
2558 but any of the strings "UTF\-8", "UTF8", "utf\-8" or "utf8"
2559 is found in the LC_ALL, LC_CTYPE or LANG
2560 environment variables, then the default character set is utf\-8.
2561 .PP
2562 If that string is not found, but your system supports the
2563 .BR setlocale (3)
2564 interface,
2565 .B less
2566 will use setlocale to determine the character set.
2567 setlocale is controlled by setting the LANG or LC_CTYPE environment
2568 variables.
2569 .PP
2570 Finally, if the
2571 .B setlocale
2572 interface is also not available, the default character set is utf\-8.
2573 .PP
2574 Control and binary characters are displayed in standout (reverse video).
2575 Each such character is displayed in caret notation if possible
2576 (e.g.\& \*^A for control-A). Caret notation is used only if
2577 inverting the 0100 bit results in a normal printable character.
2578 Otherwise, the character is displayed as a hex number in angle brackets.
2579 This format can be changed by
2580 setting the LESSBINFMT environment variable.
2581 LESSBINFMT may begin with a "*" and one character to select
2582 the display attribute:
2583 "*k" is blinking, "*d" is bold, "*u" is underlined, "*s" is standout,
2584 and "*n" is normal.
2585 If LESSBINFMT does not begin with a "*", normal attribute is assumed.
2586 The remainder of LESSBINFMT is a string which may include one
2587 printf-style escape sequence (a % followed by x, X, o, d, etc.).
2588 For example, if LESSBINFMT is "*u[%x]", binary characters
2589 are displayed in underlined hexadecimal surrounded by brackets.
2590 The default if no LESSBINFMT is specified is "*s<%02X>".
2591 Warning: the result of expanding the character via LESSBINFMT must
2592 be less than 31 characters.
2593 .PP
2594 When the character set is utf\-8, the LESSUTFBINFMT environment variable
2595 acts similarly to LESSBINFMT but it applies to Unicode code points
2596 that were successfully decoded but are unsuitable for display (e.g.,
2597 unassigned code points).
2598 Its default value is "<U+%04lX>".
2599 Note that LESSUTFBINFMT and LESSBINFMT share their display attribute
2600 setting ("*x") so specifying one will affect both;
2601 LESSUTFBINFMT is read after LESSBINFMT so its setting, if any,
2602 will have priority.
2603 Problematic octets in a UTF-8 file (octets of a truncated sequence,
2604 octets of a complete but non-shortest form sequence, invalid octets,
2605 and stray trailing octets)
2606 are displayed individually using LESSBINFMT so as to facilitate diagnostic
2607 of how the UTF-8 file is ill-formed.
2608 .PP
2609 When the character set is utf\-8, in rare cases it may be desirable to
2610 override the Unicode definition of the type of certain characters.
2611 For example, characters in a Private Use Area are normally treated as binary
2612 characters, but if you are using a custom font with printable characters
2613 in that range, it may be desirable to tell
2614 .B less
2615 to treat such characters as printable.
2616 This can be done by setting the LESSUTFCHARDEF environment variable
2617 to a comma-separated list of
2618 .I "character type"
2619 definitions.
2620 Each character type definition consists of either one hexadecimal codepoint
2621 or a pair of codepoints separated by a dash,
2622 followed by a colon and a type character.
2623 Each hexadecimal codepoint may optionally be preceded by a "U" or "U+".
2624 If a pair of codepoints is given, the type is set for
2625 all characters inclusively between the two values.
2626 If there are multiple comma-separated codepoint values,
2627 they must be in ascending numerical order.
2628 The type character may be one of:
2629 .RS
2630 .IP "p"
2631 A normal printable character.
2632 .IP "w"
2633 A wide (2-space) printable character.
2634 .IP "b"
2635 A binary (non-printable) character.
2636 .IP "c"
2637 A composing (zero width) character.
2638 .IP "d"
2639 A deleted character (deleted from the input and not displayed).
2640 .RE
2641 .PP
2642 For example, setting LESSUTFCHARDEF to
2643 .PP
2644 .EX
2645 .nf
2646 E000\-F8FF:p,F0000\-FFFFD:p,100000\-10FFFD:p
2647 .fi
2648 .EE
2649 .PP
2650 would make all Private Use Area characters be treated as printable.
2651 .PP
2652 By default, emoji modifiers, components and variation selectors
2653 are deleted because many terminals do not display them correctly.
2654 If you use a terminal which does display some or all of them correctly,
2655 you can cause them to be displayed by setting LESSUTFCHARDEF
2656 to treat them as composing characters.
2657 For example, this sets them all to composing characters:
2658 .PP
2659 .EX
2660 .nf
2661 FE00\-FE0F:c,1F3FB\-1F3FF:c,1F9B0\-1F9B3:c,E0100\-E01EF:c
2662 .fi
2663 .EE
2664 .SH "PROMPTS"
2665 The
2666 .B "\-P"
2667 option allows you to tailor the prompt to your preference.
2668 The string given to the
2669 .B "\-P"
2670 option replaces the specified prompt string.
2671 Certain characters in the string are interpreted specially.
2672 The prompt mechanism is rather complicated to provide flexibility,
2673 but the ordinary user need not understand the details of constructing
2674 personalized prompt strings.
2675 .PP
2676 A percent sign followed by a single character is expanded
2677 according to what the following character is.
2678 (References to the input file size below refer to the preprocessed size,
2679 if an input preprocessor is being used.)
2680 .IP "%b\fIX\fP"
2681 Replaced by the byte offset into the current input file.
2682 The b is followed by a single character (shown as \fIX\fP above)
2683 which specifies the line whose byte offset is to be used.
2684 If the character is a "t", the byte offset of the top line in the
2685 display is used,
2686 an "m" means use the middle line,
2687 a "b" means use the bottom line,
2688 a "B" means use the line just after the bottom line,
2689 and a "j" means use the "target" line, as specified by the
2690 .B "\-j"
2691 option.
2692 .IP "%B"
2693 Replaced by the size of the current input file.
2694 .IP "%c"
2695 Replaced by the column number of the text which appears in the first
2696 column of the screen.
2697 .IP "%C"
2698 Replaced by the column number of the text which appears (or would appear) in the last
2699 column of the screen.
2700 .IP "%d\fIX\fP"
2701 Replaced by the page number of a line in the input file.
2702 The line to be used is determined by the \fIX\fP, as with the %b option.
2703 .IP "%D"
2704 Replaced by the number of pages in the input file,
2705 or equivalently, the page number of the last line in the input file.
2706 .IP "%E"
2707 Replaced by the name of the editor (from the VISUAL environment variable,
2708 or the EDITOR environment variable if VISUAL is not defined).
2709 See the discussion of the LESSEDIT feature below.
2710 .IP "%f"
2711 Replaced by the name of the current input file.
2712 .IP "%F"
2713 Replaced by the last component of the name of the current input file.
2714 .IP "%g"
2715 Replaced by the shell-escaped name of the current input file.
2716 This is useful when the expanded string will be used in a shell command,
2717 such as in LESSEDIT.
2718 .IP "%i"
2719 Replaced by the index of the current file in the list of
2720 input files.
2721 .IP "%l\fIX\fP"
2722 Replaced by the line number of a line in the input file.
2723 The line to be used is determined by the \fIX\fP, as with the %b option.
2724 .IP "%L"
2725 Replaced by the line number of the last line in the input file.
2726 .IP "%m"
2727 Replaced by the total number of input files.
2728 .IP "%p\fIX\fP"
2729 Replaced by the percent into the current input file, based on byte offsets.
2730 The line used is determined by the \fIX\fP as with the %b option.
2731 .IP "%P\fIX\fP"
2732 Replaced by the percent into the current input file, based on line numbers.
2733 The line used is determined by the \fIX\fP as with the %b option.
2734 .IP "%Q"
2735 Replaced by the percent of the last column of text displayed on the screen
2736 compared to the length of the longest line currently displayed
2737 (that is, %C divided by %W).
2738 Note that using this sequence can make displaying the prompt be slower than usual.
2739 .IP "%s"
2740 Same as %B.
2741 .IP "%t"
2742 Causes any trailing spaces to be removed.
2743 Usually used at the end of the string, but may appear anywhere.
2744 .IP "%T"
2745 Normally expands to the word "file".
2746 However if viewing files via a tags list using the
2747 .B "\-t"
2748 option,
2749 it expands to the word "tag".
2750 .IP "%W"
2751 Replaced by the width of the longest line currently displayed on the screen.
2752 Note that using this sequence can make displaying the prompt be slower than usual.
2753 .IP "%x"
2754 Replaced by the name of the next input file in the list.
2755 .PP
2756 If any item is unknown (for example, the file size if input
2757 is a pipe), a question mark is printed instead.
2758 .PP
2759 The format of the prompt string can be changed
2760 depending on certain conditions.
2761 A question mark followed by a single character acts like an "IF":
2762 depending on the following character, a condition is evaluated.
2763 If the condition is true, any characters following the question mark
2764 and condition character, up to a period, are included in the prompt.
2765 If the condition is false, such characters are not included.
2766 A colon appearing between the question mark and the
2767 period can be used to establish an "ELSE": any characters between
2768 the colon and the period are included in the string if and only if
2769 the IF condition is false.
2770 Condition characters (which follow a question mark) may be:
2771 .IP "?a"
2772 True if any characters have been included in the prompt so far.
2773 .IP "?b\fIX\fP"
2774 True if the byte offset of the specified line is known.
2775 .IP "?B"
2776 True if the size of current input file is known.
2777 .IP "?c"
2778 True if the text is horizontally shifted (%c is greater than 1).
2779 .IP "?d\fIX\fP"
2780 True if the page number of the specified line is known.
2781 .IP "?e"
2782 True if at end-of-file.
2783 .IP "?f"
2784 True if there is an input filename
2785 (that is, if input is not a pipe).
2786 .IP "?l\fIX\fP"
2787 True if the line number of the specified line is known.
2788 .IP "?L"
2789 True if the line number of the last line in the file is known.
2790 .IP "?m"
2791 True if there is more than one input file.
2792 .IP "?n"
2793 True if this is the first prompt in a new input file.
2794 .IP "?O"
2795 True if an OSC 8 hyperlink is selected.
2796 .IP "?p\fIX\fP"
2797 True if the percent into the current input file, based on byte offsets,
2798 of the specified line is known.
2799 .IP "?P\fIX\fP"
2800 True if the percent into the current input file, based on line numbers,
2801 of the specified line is known.
2802 .IP "?Q"
2803 True if %Q is less than 100.
2804 Note that using this sequence can make displaying the prompt be slower than usual.
2805 .IP "?s"
2806 Same as "?B".
2807 .IP "?x"
2808 True if there is a next input file
2809 (that is, if the current input file is not the last one).
2810 .PP
2811 Any characters other than the special ones
2812 (question mark, colon, period, percent, and backslash)
2813 become literally part of the prompt.
2814 Any of the special characters may be included in the prompt literally
2815 by preceding it with a backslash.
2816 .PP
2817 Some examples:
2818 .PP
2819 .EX
2820 ?f%f:Standard input.
2821 .EE
2822 .PP
2823 This prompt prints the filename, if known;
2824 otherwise the string "Standard input".
2825 .PP
2826 .EX
2827 ?f%f \&.?ltLine %lt:?pt%pt\e%:?btByte %bt:\-...
2828 .EE
2829 .PP
2830 This prompt would print the filename, if known.
2831 The filename is followed by the line number, if known,
2832 otherwise the percent if known, otherwise the byte offset if known.
2833 Otherwise, a dash is printed.
2834 Notice how each question mark has a matching period,
2835 and how the % after the %pt
2836 is included literally by escaping it with a backslash.
2837 .PP
2838 .EX
2839 ?n?f%f\ .?m(%T %i of %m)\ ..?e(END)\ ?x\-\ Next\e:\ %x..%t
2840 .EE
2841 .PP
2842 This prints the filename if this is the first prompt in a file,
2843 followed by the "file N of N" message if there is more
2844 than one input file.
2845 Then, if we are at end-of-file, the string "(END)" is printed
2846 followed by the name of the next file, if there is one.
2847 Finally, any trailing spaces are truncated.
2848 This is the default prompt.
2849 For reference, here are the defaults for
2850 the other two prompts
2851 .B "\-m"
2852 and
2853 .B "\-M"
2854 respectively).
2855 Each is broken into two lines here for readability only.
2856 .PP
2857 .EX
2858 .nf
2859 ?n?f%f\ .?m(%T\ %i\ of\ %m)\ ..?e(END)\ ?x\-\ Next\e:\ %x.:
2860 ?pB%pB\e%:byte\ %bB?s/%s...%t
2861 .PP
2862 ?f%f\ .?n?m(%T\ %i\ of\ %m)\ ..?ltlines\ %lt\-%lb?L/%L.\ :
2863 byte\ %bB?s/%s.\ .?e(END)\ ?x\-\ Next\e:\ %x.:?pB%pB\e%..?c\ (column\ %c).%t
2864 .fi
2865 .EE
2866 .PP
2867 And here is the default message produced by the = command:
2868 .PP
2869 .EX
2870 .nf
2871 ?f%f\ .?m(%T\ %i\ of\ %m)\ .?ltlines\ %lt\-%lb?L/%L.\ .
2872 byte\ %bB?s/%s.\ ?e(END)\ :?pB%pB\e%..?c\ (column\ %c).%t
2873 .fi
2874 .EE
2875 .PP
2876 The prompt expansion features are also used for another purpose:
2877 if an environment variable LESSEDIT is defined, it is used
2878 as the command to be executed when the v command is invoked.
2879 The LESSEDIT string is expanded in the same way as the prompt strings.
2880 The default value for LESSEDIT is:
2881 .PP
2882 .EX
2883 .nf
2884 %E\ ?lm+%lm.\ %g
2885 .fi
2886 .EE
2887 .PP
2888 Note that this expands to the editor name, followed by a + and the
2889 line number, followed by the shell-escaped file name.
2890 If your editor does not accept the "+linenumber" syntax, or has other
2891 differences in invocation syntax, the LESSEDIT variable can be
2892 changed to modify this default.
2893 .
2894 .SH SECURITY
2895 When the environment variable LESSSECURE is set to 1,
2896 .B less
2897 runs in a "secure" mode.
2898 In this mode, these features are disabled:
2899 .IP "edit" 10
2900 the edit command (v)
2901 .IP "examine"
2902 the examine command (:e)
2903 .IP "glob"
2904 metacharacters such as * in filenames,
2905 .br
2906 and filename completion (TAB, \*^L)
2907 .IP "history"
2908 history file
2909 .IP "lesskey"
2910 use of lesskey files
2911 .B "\-k"
2912 and
2913 .BR "\-\-lesskey\-src" ")"
2914 .IP "lessopen"
2915 input preprocessor (LESSOPEN environment variable)
2916 .IP "logfile"
2917 log files (s and
2918 .BR "\-o" ")"
2919 .IP "osc8"
2920 opening OSC 8 links (\*^O\*^O)
2921 .IP "pipe"
2922 the pipe command (|)
2923 .IP "shell"
2924 the shell and pshell commands (! and #)
2925 .IP "stop"
2926 stopping
2927 .B less
2928 via a SIGTSTP signal
2929 .IP "tags"
2930 use of tags files
2931 .RB "(" "\-t" ")"
2932 .PP
2933 The LESSSECURE_ALLOW environment variable can be set to a comma-separated list
2934 of names of features which are selectively enabled when LESSSECURE is set.
2935 Each feature name is the first word in each line in the above list.
2936 A feature name may be abbreviated as long as the abbreviation is unambiguous.
2937 For example, if
2938 .nh
2939 LESSSECURE=1
2940 .hy
2941 and
2942 .nh
2943 LESSSECURE_ALLOW=hist,edit
2944 .hy
2945 were set, all of the above features would be disabled
2946 except for history files and the edit command.
2947 .PP
2948 Less can also be compiled to be permanently in "secure" mode.
2949 In that case, the LESSSECURE and LESSSECURE_ALLOW variables are ignored.
2950 .
2951 .SH "COMPATIBILITY WITH MORE"
2952 If the environment variable LESS_IS_MORE is set to 1,
2953 or if the program is invoked via a file link named "more"
2954 and the environment variable LESS_IS_MORE is not set to 0,
2955 .B less
2956 behaves (mostly) in conformance with the POSIX
2957 .BR more (1)
2958 command specification.
2959 In this mode,
2960 .B less
2961 behaves differently in these ways:
2962 .PP
2963 The
2964 .B "\-e"
2965 option works differently.
2966 If the
2967 .B "\-e"
2968 option is not set,
2969 .B less
2970 behaves as if the
2971 .B "\-e"
2972 option were set.
2973 If the
2974 .B "\-e"
2975 option is set,
2976 .B less
2977 behaves as if the
2978 .B "\-E"
2979 option were set.
2980 .PP
2981 The
2982 .B "\-m"
2983 option works differently.
2984 If the
2985 .B "\-m"
2986 option is not set, the medium prompt is used,
2987 and it is prefixed with the string "\-\-More\-\-".
2988 If the
2989 .B "\-m"
2990 option is set, the short prompt is used.
2991 .PP
2992 The
2993 .B "\-n"
2994 option acts like the
2995 .B "\-z"
2996 option.
2997 The normal behavior of the
2998 .B "\-n"
2999 option is unavailable in this mode.
3000 .PP
3001 The parameter to the
3002 .B "\-p"
3003 option is taken to be a
3004 .B less
3005 command rather than a search pattern.
3006 .PP
3007 The LESS environment variable is ignored,
3008 and the MORE environment variable is used in its place.
3009 .
3010 .SH "ENVIRONMENT VARIABLES"
3011 Environment variables may be specified either in the system environment
3012 as usual, or in a
3013 .BR lesskey (1)
3014 file.
3015 If environment variables are defined in more than one place,
3016 variables defined in a local lesskey file take precedence over
3017 variables defined in the system environment, which take precedence
3018 over variables defined in the system-wide lesskey file.
3019 .IP COLUMNS
3020 Sets the number of columns on the screen.
3021 Takes precedence over the number of columns specified by the TERM variable.
3022 (But if you have a windowing system which supports TIOCGWINSZ or WIOCGETD,
3023 the window system's idea of the screen size takes precedence over the
3024 LINES and COLUMNS environment variables.)
3025 .IP EDITOR
3026 The name of the editor (used for the v command).
3027 .IP HOME
3028 Name of the user's home directory
3029 (used to find a lesskey file on Unix and OS/2 systems).
3030 .IP "HOMEDRIVE, HOMEPATH"
3031 Concatenation of the HOMEDRIVE and HOMEPATH environment variables is
3032 the name of the user's home directory if the HOME variable is not set
3033 (only in the Windows version).
3034 .IP INIT
3035 Name of the user's init directory (used to find a lesskey file on OS/2 systems).
3036 .IP LANG
3037 Language for determining the character set.
3038 .IP LC_CTYPE
3039 Language for determining the character set.
3040 .IP LESS
3041 Options which are passed to
3042 .B less
3043 automatically.
3044 .IP LESSANSIENDCHARS
3045 Characters which may end an ANSI color escape sequence
3046 (default "m").
3047 .IP LESSANSIMIDCHARS
3048 Characters which may appear between the ESC character and the
3049 end character in an ANSI color escape sequence
3050 (default "0123456789:;[?!"\*'#%()*+\ ").
3051 .IP LESSANSIOSCALLOW
3052 A comma-separated list of OSC types which are output directly to the
3053 terminal when
3054 .B "\-R"
3055 is in effect
3056 (default "8"; that is, only OSC 8 sequences are output directly).
3057 .IP LESSANSIOSCCHARS
3058 Characters which may follow an ESC character to mark the start
3059 of an "OS Command" sequence.
3060 All characters that follow this character up to a
3061 String Terminator (ESC-backslash or BEL)
3062 are considered to be part of the OSC sequence
3063 (default "]").
3064 If a character in LESSANSIOSCCHARS is followed by an asterisk,
3065 sequences that begin with that character in the file contents
3066 are passed through to the terminal;
3067 otherwise only sequences that appear in a prompt string are passed through.
3068 .IP LESSBINFMT
3069 Format for displaying non-printable, non-control characters.
3070 .IP LESSCHARDEF
3071 Defines a character set.
3072 .IP LESSCHARSET
3073 Selects a predefined character set.
3074 .IP LESSCLOSE
3075 Command line to invoke the (optional) input-postprocessor.
3076 .IP LESSECHO
3077 Name of the lessecho program (default "lessecho").
3078 The lessecho program is needed to expand metacharacters, such as * and ?,
3079 in filenames on Unix systems.
3080 .IP LESSEDIT
3081 Editor prototype string (used for the v command).
3082 See discussion under PROMPTS.
3083 .IP LESSGLOBALTAGS
3084 Name of the command used by the
3085 .B "\-t"
3086 option to find global tags.
3087 Normally should be set to "global" if your system has the
3088 .BR global (1)
3089 command. If not set, global tags are not used.
3090 .IP LESSHISTFILE
3091 Name of the history file used to remember search commands and
3092 shell commands between invocations of
3093 .BR less .
3094 If set to "\-" or "/dev/null", a history file is not used.
3095 The default depends on the operating system, but is usually:
3096 .RS
3097 .IP "Linux and Unix"
3098 "$XDG_STATE_HOME/lesshst" or "$HOME/.local/state/lesshst" or
3099 "$XDG_DATA_HOME/lesshst" or "$HOME/.lesshst".
3100 .IP "Windows and MS-DOS"
3101 "$HOME/_lesshst".
3102 .IP "OS/2"
3103 "$HOME/lesshst.ini" or "$INIT/lesshst.ini".
3104 .RE
3105 .IP LESSHISTSIZE
3106 The maximum number of commands to save in the history file.
3107 The default is 100.
3108 .IP LESSKEYIN
3109 Name of the default
3110 .I "lesskey source"
3111 file.
3112 .IP LESSKEY
3113 Name of the default
3114 .I "lesskey binary"
3115 file. (Not used if "$LESSKEYIN" exists.)
3116 .IP LESSKEY_CONTENT
3117 The value is parsed as if it were the parameter of a
3118 .B "\-\-lesskey\-content"
3119 option.
3120 .IP LESSKEYIN_SYSTEM
3121 Name of the default system-wide
3122 .I "lesskey source"
3123 file.
3124 .IP LESSKEY_SYSTEM
3125 Name of the default system-wide
3126 .I "lesskey binary"
3127 file. (Not used if "$LESSKEYIN_SYSTEM" exists.)
3128 .IP LESSMETACHARS
3129 List of characters which are considered "metacharacters" by the shell.
3130 .IP LESSMETAESCAPE
3131 Prefix which less will add before each metacharacter in a
3132 command sent to the shell (default "\e").
3133 .IP LESSNOCONFIG
3134 If set to "\-", all environment variables except TERM are ignored
3135 (treated as if they were not set).
3136 If set to a comma-separated list of environment variable names,
3137 all environment variables except TERM and those in the list are ignored.
3138 In either case (if set to any non-empty value), all
3139 .B lesskey
3140 files are also ignored.
3141 .IP LESSOPEN
3142 Command line to invoke the (optional) input-preprocessor.
3143 .IP LESSSECURE
3144 Runs less in "secure" mode.
3145 See discussion under SECURITY.
3146 .IP LESSSECURE_ALLOW
3147 Enables individual features which are normally disabled by LESSSECURE.
3148 See discussion under SECURITY.
3149 .IP LESSSEPARATOR
3150 String to be appended to a directory name in filename completion
3151 (default "\e" on MS-DOS, Windows, and OS/2; otherwise "/").
3152 .IP LESSUTFBINFMT
3153 Format for displaying non-printable Unicode code points.
3154 .IP LESSUTFCHARDEF
3155 Overrides the type of specified Unicode characters.
3156 .IP LESS_COLUMNS
3157 Sets the number of columns on the screen.
3158 Unlike COLUMNS, takes precedence over the system's idea of the screen size,
3159 so it can be used to make
3160 .B less
3161 use less than the full screen width.
3162 If set to a negative number, sets the number of columns used to
3163 this much less than the actual screen width.
3164 .IP LESS_LINES
3165 Sets the number of lines on the screen.
3166 Unlike LINES, takes precedence over the system's idea of the screen size,
3167 so it can be used to make
3168 .B less
3169 use less than the full screen height.
3170 If set to a negative number, sets the number of lines used to
3171 this much less than the actual screen height.
3172 When set,
3173 .B less
3174 repaints the entire screen on every movement command,
3175 so scrolling may be slower.
3176 .IP LESS_DATA_DELAY
3177 Duration (in milliseconds) after starting to read data from the input,
3178 after which the "Waiting for data" message will be displayed.
3179 The default is 4000 (4 seconds).
3180 .IP LESS_IS_MORE
3181 Emulate the
3182 .BR more (1)
3183 command.
3184 .IP LESS_OSC8_OPEN_xxx
3185 Where "xxx" is a URI scheme such as "http" or "file",
3186 sets an OSC 8 handler for opening OSC 8 links containing a URI with that scheme.
3187 .IP LESS_OSC8_OPEN_ANY
3188 Sets an OSC 8 handler for opening OSC 8 links for which there is
3189 no specific LESS_OSC8_OPEN_xxx handler set for the "xxx" scheme.
3190 .IP LESS_OSC8_OPEN_NONE
3191 Sets an OSC 8 handler for opening OSC 8 links which contain no scheme
3192 (that is, there is no colon in the URI).
3193 .IP LESS_SHELL_LINES
3194 When the
3195 .B "\-F"
3196 option is set,
3197 .B less
3198 exits automatically if the number of screen lines used to display the file
3199 is less than or equal to the screen height minus the value of
3200 the LESS_SHELL_LINES variable.
3201 Thus, if you use a shell prompt which occupies more than one screen line,
3202 this variable can be set to the number of lines used by your prompt,
3203 to ensure that the entire file can be seen when
3204 .B "\-F"
3205 is used.
3206 If not set, LESS_SHELL_LINES is assumed to be 1.
3207 .IP LESS_SIGUSR1
3208 If set to a string of one or more
3209 .B less
3210 command characters, those commands will be executed when
3211 .B less
3212 receives a SIGUSR1 signal.
3213 .IP LESS_TERMCAP_xx
3214 Where "xx" is any two characters, overrides the definition
3215 of the termcap "xx" capability for the terminal.
3216 No escape sequences in the string are processed, so any
3217 nonprintable characters such as ESC must be in the string literally.
3218 .IP LESS_TERMINFO_xxxx
3219 Where "xxxx" is any string of characters, overrides the definition
3220 of the terminfo "xxxx" capability for the terminal.
3221 You can use either LESS_TERMCAP_xx or LESS_TERMINFO_xxxx to override
3222 a terminal capability, regardless of whether
3223 .B less
3224 is built with the
3225 .B termcap
3226 or the
3227 .B terminfo
3228 library.
3229 .IP LESS_TERMCAP_BRACKETED_PASTE_START
3230 Overrides the standard ANSI escape sequence to enable bracketed paste.
3231 This is used when the
3232 .B "\-\-no\-paste"
3233 option is in effect.
3234 .IP LESS_TERMCAP_BRACKETED_PASTE_END
3235 Overrides the standard ANSI escape sequence to disable bracketed paste.
3236 .IP LESS_TERMCAP_MOUSE_START
3237 Overrides the standard ANSI escape sequence to enable mouse reporting.
3238 This is used when the
3239 .B "\-\-mouse"
3240 option is in effect.
3241 .IP LESS_TERMCAP_MOUSE_END
3242 Overrides the standard ANSI escape sequence to disable mouse reporting.
3243 .IP LESS_TERMCAP_SUSPEND
3244 Defines an escape sequence to temporarily suspend screen updates.
3245 This is sent to the terminal before clearing the screen.
3246 This can be used to avoid screen tearing when the screen is redrawn
3247 on certain terminals.
3248 .IP LESS_TERMCAP_RESUME
3249 Defines an escape sequence to resume screen updates.
3250 This is sent to the terminal after displaying the prompt.
3251 .IP LESS_UNSUPPORT
3252 A space-separated list of command line options.
3253 These options will be ignored (with no error message) if they appear
3254 on the command line or in the LESS environment variable.
3255 Options listed in LESS_UNSUPPORT can still be changed by the \- and \-\- commands.
3256 Each option in LESS_UNSUPPORT is a dash followed by a single character
3257 option letter, or two dashes followed by a long option name.
3258 .IP LINES
3259 Sets the number of lines on the screen.
3260 Takes precedence over the number of lines specified by the TERM variable.
3261 (But if you have a windowing system which supports TIOCGWINSZ or WIOCGETD,
3262 the window system's idea of the screen size takes precedence over the
3263 LINES and COLUMNS environment variables.)
3264 .IP MORE
3265 Options which are passed to
3266 .B less
3267 automatically when running in
3268 .BR more "-compatible mode."
3269 .IP PATH
3270 User's search path (used to find a lesskey file
3271 on MS-DOS, Windows, and OS/2 systems).
3272 .IP POSIXLY_CORRECT
3273 If set to any value, all option arguments on the command line
3274 are expected to appear before any filename arguments.
3275 This must be set as an actual environment variable, not in a
3276 .B lesskey
3277 file.
3278 .IP SHELL
3279 The shell used to execute the !\& command, as well as to expand filenames.
3280 .IP TERM
3281 The type of terminal on which
3282 .B less
3283 is being run.
3284 .IP VISUAL
3285 The name of the editor (used for the v command).
3286 .IP XDG_CONFIG_HOME
3287 Possible location of the
3288 .B lesskey
3289 file; see the KEY BINDINGS section.
3290 .IP XDG_DATA_HOME
3291 Possible location of the history file; see the description of the LESSHISTFILE environment variable.
3292 .IP XDG_STATE_HOME
3293 Possible location of the history file; see the description of the LESSHISTFILE environment variable.
3294 .
3295 .SH "SEE ALSO"
3296 .BR lesskey (1),
3297 .BR lessecho (1)
3298 .
3299 .SH COPYRIGHT
3300 Copyright (C) 1984-2026 Mark Nudelman
3301 .PP
3302 less is part of the GNU project and is free software.
3303 You can redistribute it and/or modify it
3304 under the terms of either
3305 (1) the GNU General Public License as published by
3306 the Free Software Foundation; or (2) the Less License.
3307 See the file README in the less distribution for more details
3308 regarding redistribution.
3309 You should have received a copy of the GNU General Public License
3310 along with the source for less; see the file COPYING.
3311 If not, write to the Free Software Foundation, 59 Temple Place,
3312 Suite 330, Boston, MA 02111-1307, USA.
3313 You should also have received a copy of the Less License;
3314 see the file LICENSE.
3315 .PP
3316 less is distributed in the hope that it will be useful, but
3317 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
3318 or FITNESS FOR A PARTICULAR PURPOSE.
3319 See the GNU General Public License for more details.
3320 .
3321 .SH AUTHOR
3322 .
3323 Mark Nudelman
3324 .br
3325 Report bugs at
3326 .nh
3327 https://\*:github\*:.com/\*:gwsw/\*:less/\*:issues.
3328 .hy
3329 .br
3330 For more information, see the less homepage at
3331 .br
3332 .nh
3333 https://\*:greenwoodsoftware\*:.com/\*:less.
3334 .hy