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