]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/less/less.nro
This commit was generated by cvs2svn to compensate for changes in r127804,
[FreeBSD/FreeBSD.git] / contrib / less / less.nro
1 .TH LESS 1 "Version 371: 26 Dec 2001"
2 .SH NAME
3 less \- opposite of more
4 .SH SYNOPSIS
5 .B "less -?"
6 .br
7 .B "less --help"
8 .br
9 .B "less -V"
10 .br
11 .B "less --version"
12 .br
13 .B "less [-[+]aBcCdeEfFgGiIJmMnNqQrRsSuUVwWX]"
14 .br
15 .B "     [-b \fIbufs\fP] [-h \fIlines\fP] [-j \fIline\fP] [-k \fIkeyfile\fP]"
16 .br
17 .B "     [-{oO} \fIlogfile\fP] [-p \fIpattern\fP] [-P \fIprompt\fP] [-t \fItag\fP]"
18 .br
19 .B "     [-T \fItagsfile\fP] [-x \fItab\fP,...] [-y \fIlines\fP] [-[z] \fIlines\fP]"
20 .br
21 .B "     [+[+]\fIcmd\fP] [--] [\fIfilename\fP]..."
22 .br
23 (See the OPTIONS section for alternate option syntax with long option names.)
24
25 .SH DESCRIPTION
26 .I Less
27 is a program similar to 
28 .I more
29 (1), but which allows backward movement
30 in the file as well as forward movement.
31 Also,
32 .I less
33 does not have to read the entire input file before starting,
34 so with large input files it starts up faster than text editors like
35 .I vi
36 (1).
37 .I Less
38 uses termcap (or terminfo on some systems),
39 so it can run on a variety of terminals.
40 There is even limited support for hardcopy terminals.
41 (On a hardcopy terminal, lines which should be printed at the top
42 of the screen are prefixed with a caret.)
43 .PP
44 Commands are based on both
45 .I more
46 and
47 .I vi.
48 Commands may be preceded by a decimal number, 
49 called N in the descriptions below.
50 The number is used by some commands, as indicated.
51
52 .SH COMMANDS
53 In the following descriptions, ^X means control-X.
54 ESC stands for the ESCAPE key; for example ESC-v means the
55 two character sequence "ESCAPE", then "v".
56 .IP "h or H"
57 Help: display a summary of these commands.
58 If you forget all the other commands, remember this one.
59 .IP "SPACE or ^V or f or ^F"
60 Scroll forward N lines, default one window (see option -z below).
61 If N is more than the screen size, only the final screenful is displayed.
62 Warning: some systems use ^V as a special literalization character.
63 .IP "z"
64 Like SPACE, but if N is specified, it becomes the new window size.
65 .IP "ESC-SPACE"
66 Like SPACE, but scrolls a full screenful, even if it reaches
67 end-of-file in the process.
68 .IP "RETURN or ^N or e or ^E or j or ^J"
69 Scroll forward N lines, default 1.
70 The entire N lines are displayed, even if N is more than the screen size.
71 .IP "d or ^D"
72 Scroll forward N lines, default one half of the screen size.
73 If N is specified, it becomes the new default for 
74 subsequent d and u commands.
75 .IP "b or ^B or ESC-v"
76 Scroll backward N lines, default one window (see option -z below).
77 If N is more than the screen size, only the final screenful is displayed.
78 .IP "w"
79 Like ESC-v, but if N is specified, it becomes the new window size.
80 .IP "y or ^Y or ^P or k or ^K"
81 Scroll backward N lines, default 1.
82 The entire N lines are displayed, even if N is more than the screen size.
83 Warning: some systems use ^Y as a special job control character.
84 .IP "u or ^U"
85 Scroll backward N lines, default one half of the screen size.
86 If N is specified, it becomes the new default for 
87 subsequent d and u commands.
88 .IP "ESC-) or RIGHTARROW"
89 Scroll horizontally right N characters, default half the screen width
90 (see the -# option).
91 If a number N is specified, it becomes the default for future RIGHTARROW
92 and LEFTARROW commands.
93 While the text is scrolled, it acts as though the -S option
94 (chop lines) were in effect.
95 .IP "ESC-( or LEFTARROW"
96 Scroll horizontally left N characters, default half the screen width
97 (see the -# option).
98 If a number N is specified, it becomes the default for future RIGHTARROW
99 and LEFTARROW commands.
100 .IP "r or ^R or ^L"
101 Repaint the screen.
102 .IP R
103 Repaint the screen, discarding any buffered input.
104 Useful if the file is changing while it is being viewed.
105 .IP "F"
106 Scroll forward, and keep trying to read when the
107 end of file is reached.
108 Normally this command would be used when already at the end of the file.
109 It is a way to monitor the tail of a file which is growing
110 while it is being viewed.
111 (The behavior is similar to the "tail -f" command.)
112 .IP "g or < or ESC-<"
113 Go to line N in the file, default 1 (beginning of file).
114 (Warning: this may be slow if N is large.)
115 .IP "G or > or ESC->"
116 Go to line N in the file, default the end of the file.
117 (Warning: this may be slow if N is large,
118 or if N is not specified and
119 standard input, rather than a file, is being read.)
120 .IP "p or %"
121 Go to a position N percent into the file.
122 N should be between 0 and 100.
123 .IP "{"
124 If a left curly bracket appears in the top line displayed
125 on the screen,
126 the { command will go to the matching right curly bracket.
127 The matching right curly bracket is positioned on the bottom
128 line of the screen.
129 If there is more than one left curly bracket on the top line,
130 a number N may be used to specify the N-th bracket on the line.
131 .IP "}"
132 If a right curly bracket appears in the bottom line displayed
133 on the screen,
134 the } command will go to the matching left curly bracket.
135 The matching left curly bracket is positioned on the top
136 line of the screen.
137 If there is more than one right curly bracket on the top line,
138 a number N may be used to specify the N-th bracket on the line.
139 .IP "("
140 Like {, but applies to parentheses rather than curly brackets.
141 .IP ")"
142 Like }, but applies to parentheses rather than curly brackets.
143 .IP "["
144 Like {, but applies to square brackets rather than curly brackets.
145 .IP "]"
146 Like }, but applies to square brackets rather than curly brackets.
147 .IP "ESC-^F"
148 Followed by two characters,
149 acts like {, but uses the two characters as open and close brackets,
150 respectively.
151 For example, "ESC ^F < >" could be used to 
152 go forward to the > which matches the < in the top displayed line.
153 .IP "ESC-^B"
154 Followed by two characters,
155 acts like }, but uses the two characters as open and close brackets,
156 respectively.
157 For example, "ESC ^B < >" could be used to 
158 go backward to the < which matches the > in the bottom displayed line.
159 .IP m
160 Followed by any lowercase letter, 
161 marks the current position with that letter.
162 .IP "'"
163 (Single quote.)
164 Followed by any lowercase letter, returns to the position which
165 was previously marked with that letter.
166 Followed by another single quote, returns to the position at
167 which the last "large" movement command was executed.
168 Followed by a ^ or $, jumps to the beginning or end of the
169 file respectively.
170 Marks are preserved when a new file is examined,
171 so the ' command can be used to switch between input files.
172 .IP "^X^X"
173 Same as single quote.
174 .IP /pattern
175 Search forward in the file for the N-th line containing the pattern.
176 N defaults to 1.
177 The pattern is a regular expression, as recognized by
178 .I ed.
179 The search starts at the second line displayed
180 (but see the -a and -j options, which change this).
181 .sp
182 Certain characters are special
183 if entered at the beginning of the pattern;
184 they modify the type of search rather than become part of the pattern:
185 .RS
186 .IP "^N or !"
187 Search for lines which do NOT match the pattern.
188 .IP "^E or *"
189 Search multiple files.
190 That is, if the search reaches the END of the current file 
191 without finding a match,
192 the search continues in the next file in the command line list.
193 .IP "^F or @"
194 Begin the search at the first line of the FIRST file
195 in the command line list,
196 regardless of what is currently displayed on the screen
197 or the settings of the -a or -j options.
198 .IP "^K"
199 Highlight any text which matches the pattern on the current screen, 
200 but don't move to the first match (KEEP current position).
201 .IP "^R"
202 Don't interpret regular expression metacharacters;
203 that is, do a simple textual comparison.
204 .RE
205 .IP ?pattern
206 Search backward in the file for the N-th line containing the pattern.
207 The search starts at the line immediately before the top line displayed.
208 .sp
209 Certain characters are special as in the / command:
210 .RS
211 .IP "^N or !"
212 Search for lines which do NOT match the pattern.
213 .IP "^E or *"
214 Search multiple files.
215 That is, if the search reaches the beginning of the current file 
216 without finding a match,
217 the search continues in the previous file in the command line list.
218 .IP "^F or @"
219 Begin the search at the last line of the last file
220 in the command line list,
221 regardless of what is currently displayed on the screen
222 or the settings of the -a or -j options.
223 .IP "^K"
224 As in forward searches.
225 .IP "^R"
226 As in forward searches.
227 .RE
228 .IP "ESC-/pattern"
229 Same as "/*".
230 .IP "ESC-?pattern"
231 Same as "?*".
232 .IP n
233 Repeat previous search, for N-th line containing the last pattern.
234 If the previous search was modified by ^N, the search is made for the
235 N-th line NOT containing the pattern.
236 If the previous search was modified by ^E, the search continues
237 in the next (or previous) file if not satisfied in the current file.
238 If the previous search was modified by ^R, the search is done
239 without using regular expressions.
240 There is no effect if the previous search was modified by ^F or ^K.
241 .IP N
242 Repeat previous search, but in the reverse direction.
243 .IP "ESC-n"
244 Repeat previous search, but crossing file boundaries.
245 The effect is as if the previous search were modified by *.
246 .IP "ESC-N"
247 Repeat previous search, but in the reverse direction
248 and crossing file boundaries.
249 .IP "ESC-u"
250 Undo search highlighting.
251 Turn off highlighting of strings matching the current search pattern. 
252 If highlighting is already off because of a previous ESC-u command,
253 turn highlighting back on.
254 Any search command will also turn highlighting back on.
255 (Highlighting can also be disabled by toggling the -G option;
256 in that case search commands do not turn highlighting back on.)
257 .IP ":e [filename]"
258 Examine a new file.
259 If the filename is missing, the "current" file (see the :n and :p commands
260 below) from the list of files in the command line is re-examined.
261 A percent sign (%) in the filename is replaced by the name of the
262 current file.  
263 A pound sign (#) is replaced by the name of the previously examined file.
264 However, two consecutive percent signs are simply 
265 replaced with a single percent sign.  
266 This allows you to enter a filename that contains a percent sign
267 in the name.
268 Similarly, two consecutive pound signs are replaced with a single pound sign.
269 The filename is inserted into the command line list of files
270 so that it can be seen by subsequent :n and :p commands.
271 If the filename consists of several files, they are all inserted into
272 the list of files and the first one is examined.
273 If the filename contains one or more spaces,
274 the entire filename should be enclosed in double quotes
275 (also see the -" option).
276 .IP "^X^V or E"
277 Same as :e.
278 Warning: some systems use ^V as a special literalization character.
279 On such systems, you may not be able to use ^V.
280 .IP ":n"
281 Examine the next file (from the list of files given in the command line).
282 If a number N is specified, the N-th next file is examined.
283 .IP ":p"
284 Examine the previous file in the command line list.
285 If a number N is specified, the N-th previous file is examined.
286 .IP ":x"
287 Examine the first file in the command line list.
288 If a number N is specified, the N-th file in the list is examined.
289 .IP ":d"
290 Remove the current file from the list of files.
291 .IP "t"
292 Go to the next tag, if there were more than one matches for the current tag.
293 See the \-t option for more details about tags.
294 .IP "T"
295 Go to the previous tag, if there were more than one matches for the current tag.
296 .IP "= or ^G or :f"
297 Prints some information about the file being viewed,
298 including its name
299 and the line number and byte offset of the bottom line being displayed.
300 If possible, it also prints the length of the file,
301 the number of lines in the file
302 and the percent of the file above the last displayed line.
303 .IP \-
304 Followed by one of the command line option letters (see OPTIONS below),
305 this will change the setting of that option
306 and print a message describing the new setting.
307 If a ^P (CONTROL-P) is entered immediately after the dash,
308 the setting of the option is changed but no message is printed.
309 If the option letter has a numeric value (such as -b or -h),
310 or a string value (such as -P or -t),
311 a new value may be entered after the option letter.
312 If no new value is entered, a message describing
313 the current setting is printed and nothing is changed.
314 .IP \-\-
315 Like the \- command, but takes a long option name (see OPTIONS below)
316 rather than a single option letter.
317 You must press RETURN after typing the option name.
318 A ^P immediately after the second dash suppresses printing of a 
319 message describing the new setting, as in the \- command.
320 .IP \-+
321 Followed by one of the command line option letters
322 this will reset the option to its default setting
323 and print a message describing the new setting.
324 (The "\-+\fIX\fP" command does the same thing
325 as "\-+\fIX\fP" on the command line.)
326 This does not work for string-valued options.
327 .IP \-\-+
328 Like the \-+ command, but takes a long option name
329 rather than a single option letter.
330 .IP \-!
331 Followed by one of the command line option letters,
332 this will reset the option to the "opposite" of its default setting
333 and print a message describing the new setting.
334 This does not work for numeric or string-valued options.
335 .IP \-\-!
336 Like the \-! command, but takes a long option name
337 rather than a single option letter.
338 .IP _
339 (Underscore.)
340 Followed by one of the command line option letters,
341 this will print a message describing the current setting of that option.
342 The setting of the option is not changed.
343 .IP __
344 (Double underscore.)
345 Like the _ (underscore) command, but takes a long option name
346 rather than a single option letter.
347 You must press RETURN after typing the option name.
348 .IP +cmd
349 Causes the specified cmd to be executed each time a new file is examined.
350 For example, +G causes 
351 .I less
352 to initially display each file starting at the end 
353 rather than the beginning.
354 .IP V
355 Prints the version number of 
356 .I less 
357 being run.
358 .IP "q or Q or :q or :Q or ZZ"
359 Exits
360 .I less.
361 .PP
362 The following 
363 four
364 commands may or may not be valid, depending on your particular installation.
365 .PP
366 .IP v
367 Invokes an editor to edit the current file being viewed.
368 The editor is taken from the environment variable VISUAL if defined,
369 or EDITOR if VISUAL is not defined,
370 or defaults to "vi" if neither VISUAL nor EDITOR is defined.
371 See also the discussion of LESSEDIT under the section on PROMPTS below.
372 .IP "! shell-command"
373 Invokes a shell to run the shell-command given.
374 A percent sign (%) in the command is replaced by the name of the
375 current file.  
376 A pound sign (#) is replaced by the name of the previously examined file.
377 "!!" repeats the last shell command.
378 "!" with no shell command simply invokes a shell.
379 On Unix systems, the shell is taken from the environment variable SHELL,
380 or defaults to "sh".
381 On MS-DOS and OS/2 systems, the shell is the normal command processor.
382 .IP "| <m> shell-command"
383 <m> represents any mark letter.
384 Pipes a section of the input file to the given shell command.
385 The section of the file to be piped is between the first line on
386 the current screen and the position marked by the letter.
387 <m> may also be ^ or $ to indicate beginning or end of file respectively.
388 If <m> is . or newline, the current screen is piped.
389 .IP "s filename"
390 Save the input to a file.
391 This only works if the input is a pipe, not an ordinary file.
392 .PP
393 .SH OPTIONS
394 Command line options are described below.
395 Most options may be changed while
396 .I less 
397 is running, via the "\-" command.
398 .PP
399 Most options may be given in one of two forms: 
400 either a dash followed by a single letter,
401 or two dashes followed by a long option name.
402 A long option name may be abbreviated as long as
403 the abbreviation is unambiguous.
404 For example, --quit-at-eof may be abbreviated --quit, but not
405 --qui, since both --quit-at-eof and --quiet begin with --qui.
406 Some long option names are in uppercase, such as --QUIT-AT-EOF, as
407 distinct from --quit-at-eof.
408 Such option names need only have their first letter capitalized;
409 the remainder of the name may be in either case.
410 For example, --Quit-at-eof is equivalent to --QUIT-AT-EOF.
411 .PP
412 Options are also taken from the environment variable "LESS".
413 For example, 
414 to avoid typing "less -options ..." each time 
415 .I less 
416 is invoked, you might tell 
417 .I csh:
418 .sp
419 setenv LESS "-options"
420 .sp
421 or if you use 
422 .I sh:
423 .sp
424 LESS="-options"; export LESS
425 .sp
426 On MS-DOS, you don't need the quotes, but you should replace any 
427 percent signs in the options string by double percent signs.
428 .sp
429 The environment variable is parsed before the command line,
430 so command line options override the LESS environment variable.
431 If an option appears in the LESS variable, it can be reset
432 to its default value on the command line by beginning the command
433 line option with "\-+".
434 .sp
435 For options like -P or -D which take a following string,
436 a dollar sign ($) must be used to signal the end of the string.
437 For example, to set two -D options on MS-DOS, you must have
438 a dollar sign between them, like this:
439 .sp
440 LESS="-Dn9.1$-Ds4.1"
441 .sp
442 .IP "-? or --help"
443 This option displays a summary of the commands accepted by
444 .I less
445 (the same as the h command).
446 (Depending on how your shell interprets the question mark,
447 it may be necessary to quote the question mark, thus: "-\\?".)
448 .IP "-a or --search-skip-screen"
449 Causes searches to start after the last line
450 displayed on the screen, 
451 thus skipping all lines displayed on the screen.
452 By default, searches start at the second line on the screen
453 (or after the last found line; see the -j option).
454 .IP "-b\fIn\fP or --buffers=\fIn\fP"
455 Specifies the number of buffers
456 .I less
457 will use for each file.
458 Buffers are 1K, and by default 10 buffers are used for each file
459 (except if the file is a pipe; see the -B option).
460 The number \fIn\fP specifies a different number of buffers to use.
461 .IP "-B or --auto-buffers"
462 By default, when data is read from a pipe,
463 buffers are allocated automatically as needed.
464 If a large amount of data is read from the pipe, this can cause
465 a large amount of memory to be allocated.
466 The -B option disables this automatic allocation of buffers for pipes,
467 so that only the number of buffers specified by the -b option are used.
468 Warning: use of -B can result in erroneous display, since only the
469 most recently viewed part of the file is kept in memory; 
470 any earlier data is lost.
471 .IP "-c or --clear-screen"
472 Causes full screen repaints to be painted from the top line down.
473 By default,
474 full screen repaints are done by scrolling from the bottom of the screen.
475 .IP "-C or --CLEAR-SCREEN"
476 The -C option is like -c, but the screen is cleared before it is repainted.
477 .IP "-d or --dumb"
478 The -d option suppresses the error message
479 normally displayed if the terminal is dumb;
480 that is, lacks some important capability,
481 such as the ability to clear the screen or scroll backward.
482 The -d option does not otherwise change the behavior of
483 .I less
484 on a dumb terminal).
485 .IP "-D\fBx\fP\fIcolor\fP or --color=\fBx\fP\fIcolor\fP"
486 [MS-DOS only]
487 Sets the color of the text displayed.
488 \fBx\fP is a single character which selects the type of text whose color is 
489 being set: n=normal, s=standout, d=bold, u=underlined, k=blink.
490 \fIcolor\fP is a pair of numbers separated by a period.  
491 The first number selects the foreground color and the second selects 
492 the background color of the text.
493 A single number \fIN\fP is the same as \fIN.0\fP.
494 .IP "-e or --quit-at-eof"
495 Causes 
496 .I less 
497 to automatically exit
498 the second time it reaches end-of-file.
499 By default, the only way to exit 
500 .I less
501 is via the "q" command.
502 .IP "-E or --QUIT-AT-EOF"
503 Causes 
504 .I less
505 to automatically exit the first time it reaches end-of-file.
506 .IP "-f or --force"
507 Forces non-regular files to be opened.
508 (A non-regular file is a directory or a device special file.)
509 Also suppresses the warning message when a binary file is opened.
510 By default,
511 .I less
512 will refuse to open non-regular files.
513 .IP "-F or --quit-if-one-screen"
514 Causes
515 .I less
516 to automatically exit
517 if the entire file can be displayed on the first screen.
518 .IP "-g or --hilite-search"
519 Normally, 
520 .I less 
521 will highlight ALL strings which match the last search command.
522 The -g option changes this behavior to highlight only the particular string 
523 which was found by the last search command.
524 This can cause 
525 .I less 
526 to run somewhat faster than the default.
527 .IP "-G or --HILITE-SEARCH"
528 The -G option suppresses all highlighting of strings found by search commands.
529 .IP "-h\fIn\fP or ---max-back-scroll=\fIn\fP"
530 Specifies a maximum number of lines to scroll backward.
531 If it is necessary to scroll backward more than \fIn\fP lines,
532 the screen is repainted in a forward direction instead.
533 (If the terminal does not have the ability to scroll
534 backward, -h0 is implied.)
535 .IP "-i or --ignore-case"
536 Causes searches to ignore case; that is,
537 uppercase and lowercase are considered identical.
538 This option is ignored if any uppercase letters
539 appear in the search pattern; 
540 in other words,
541 if a pattern contains uppercase letters, then that search does not ignore case.
542 .IP "-I or --IGNORE-CASE"
543 Like -i, but searches ignore case even if 
544 the pattern contains uppercase letters.
545 .IP "-j\fIn\fP or --jump-target=\fIn\fP"
546 Specifies a line on the screen where the "target" line
547 is to be positioned.
548 A target line is the object of a text search, 
549 tag search, jump to a line number,
550 jump to a file percentage, or jump to a marked position.
551 The screen line is specified by a number: the top line on the screen
552 is 1, the next is 2, and so on.
553 The number may be negative to specify a line relative to the bottom
554 of the screen: the bottom line on the screen is -1, the second
555 to the bottom is -2, and so on.
556 If the -j option is used, searches begin at the line immediately
557 after the target line.
558 For example, if "-j4" is used, the target line is the
559 fourth line on the screen, so searches begin at the fifth line
560 on the screen.
561 .IP "-J or --status-column"
562 Displays a status column at the left edge of the screen.
563 The status column shows the lines that matched the current search.
564 The status column is also used if the -w or -W option is in effect.
565 .IP "-k\fIfilename\fP or --lesskey-file=\fIfilename\fP"
566 Causes
567 .I less
568 to open and interpret the named file as a
569 .I lesskey
570 (1) file.
571 Multiple -k options may be specified.
572 If the LESSKEY or LESSKEY_SYSTEM environment variable is set, or
573 if a lesskey file is found in a standard place (see KEY BINDINGS),
574 it is also used as a 
575 .I lesskey
576 file.
577 .IP "-m or --long-prompt"
578 Causes 
579 .I less
580 to prompt verbosely (like \fImore\fP),
581 with the percent into the file.
582 By default,
583 .I less
584 prompts with a colon.
585 .IP "-M or --LONG-PROMPT"
586 Causes 
587 .I less
588 to prompt even more verbosely than 
589 .I more.
590 .IP "-n or --line-numbers"
591 Suppresses line numbers.
592 The default (to use line numbers) may cause
593 .I less
594 to run more slowly in some cases, especially with a very large input file.
595 Suppressing line numbers with the -n option will avoid this problem.
596 Using line numbers means: the line number will be displayed in the verbose
597 prompt and in the = command,
598 and the v command will pass the current line number to the editor
599 (see also the discussion of LESSEDIT in PROMPTS below).
600 .IP "-N or --LINE-NUMBERS"
601 Causes a line number to be displayed at the beginning of
602 each line in the display.
603 .IP "-o\fIfilename\fP or --log-file=\fIfilename\fP"
604 Causes
605 .I less
606 to copy its input to the named file as it is being viewed.
607 This applies only when the input file is a pipe,
608 not an ordinary file.
609 If the file already exists, 
610 .I less
611 will ask for confirmation before overwriting it.
612 .IP "-O\fIfilename\fP or --LOG-FILE=\fIfilename\fP"
613 The -O option is like -o, but it will overwrite an existing
614 file without asking for confirmation.
615 .sp
616 If no log file has been specified,
617 the -o and -O options can be used from within 
618 .I less
619 to specify a log file.
620 Without a file name, they will simply report the name of the log file.
621 The "s" command is equivalent to specifying -o from within
622 .I less.
623 .IP "-p\fIpattern\fP or --pattern=\fIpattern\fP"
624 The -p option on the command line is equivalent to 
625 specifying +/\fIpattern\fP;
626 that is, it tells
627 .I less
628 to start at the first occurrence of \fIpattern\fP in the file.
629 .IP "-P\fIprompt\fP or --prompt=\fIprompt\fP"
630 Provides a way to tailor the three prompt
631 styles to your own preference.
632 This option would normally be put in the LESS environment
633 variable, rather than being typed in with each 
634 .I less
635 command.
636 Such an option must either be the last option in the LESS variable,
637 or be terminated by a dollar sign.
638 -Ps followed by a string changes the default (short) prompt 
639 to that string.
640 -Pm changes the medium (-m) prompt.
641 -PM changes the long (-M) prompt.
642 -Ph changes the prompt for the help screen.
643 -P= changes the message printed by the = command.
644 -Pw changes the message printed while waiting for data (in the F command).
645 All prompt strings consist of a sequence of 
646 letters and special escape sequences.
647 See the section on PROMPTS for more details.
648 .IP "-q or --quiet or --silent"
649 Causes moderately "quiet" operation:
650 the terminal bell is not rung 
651 if an attempt is made to scroll past the end of the file
652 or before the beginning of the file.
653 If the terminal has a "visual bell", it is used instead.
654 The bell will be rung on certain other errors,
655 such as typing an invalid character.
656 The default is to ring the terminal bell in all such cases.
657 .IP "-Q or --QUIET or --SILENT"
658 Causes totally "quiet" operation:
659 the terminal bell is never rung.
660 .IP "-r or --raw-control-chars"
661 Causes "raw" control characters to be displayed.
662 The default is to display control characters using the caret notation;
663 for example, a control-A (octal 001) is displayed as "^A".
664 Warning: when the -r option is used,
665 .I less
666 cannot keep track of the actual appearance of the screen
667 (since this depends on how the screen responds to
668 each type of control character).
669 Thus, various display problems may result,
670 such as long lines being split in the wrong place.
671 .IP "-R or --RAW-CONTROL-CHARS"
672 Like -r, but tries to keep track of the screen appearance where possible.
673 This works only if the input consists of normal text and possibly some
674 ANSI "color" escape sequences, which are sequences of the form:
675 .sp
676         ESC [ ... m
677 .sp
678 where the "..." is zero or more characters other than "m".
679 For the purpose of keeping track of screen appearance,
680 all control characters and all ANSI color escape sequences are
681 assumed to not move the cursor.
682 You can make
683 .I less
684 think that characters other than "m" can end ANSI color escape sequences
685 by setting the environment variable LESSANSIENDCHARS to the list of
686 characters which can end a color escape sequence.
687 .IP "-s or --squeeze-blank-lines"
688 Causes consecutive blank lines to be squeezed into a single blank line.
689 This is useful when viewing
690 .I nroff
691 output.
692 .IP "-S or --chop-long-lines"
693 Causes lines longer than the screen width to be
694 chopped rather than folded.
695 That is, the remainder of a long line is simply discarded.
696 The default is to fold long lines; that is, display the remainder
697 on the next line.
698 .IP "-t\fItag\fP or --tag=\fItag\fP"
699 The -t option, followed immediately by a TAG,
700 will edit the file containing that tag.
701 For this to work, tag information must be available;
702 for example, there may be a file in the current directory called "tags",
703 which was previously built by 
704 .I ctags
705 (1) or an equivalent command.
706 If the environment variable LESSGLOBALTAGS is set, it is taken to be
707 the name of a command compatible with 
708 .I global
709 (1), and that command is executed to find the tag.
710 (See http://www.gnu.org/software/global/global.html).
711 The -t option may also be specified from within 
712 .I less 
713 (using the \- command) as a way of examining a new file.
714 The command ":t" is equivalent to specifying -t from within
715 .I less.
716 .IP "-T\fItagsfile\fP or --tag-file=\fItagsfile\fP"
717 Specifies a tags file to be used instead of "tags".
718 .IP "-u or --underline-special"
719 Causes backspaces and carriage returns to be treated as printable characters;
720 that is, they are sent to the terminal when they appear in the input.
721 .IP "-U or --UNDERLINE-SPECIAL"
722 Causes backspaces, tabs and carriage returns to be 
723 treated as control characters;
724 that is, they are handled as specified by the -r option.
725 .sp
726 By default, if neither -u nor -U is given,
727 backspaces which appear adjacent to an underscore character
728 are treated specially:
729 the underlined text is displayed 
730 using the terminal's hardware underlining capability.
731 Also, backspaces which appear between two identical characters
732 are treated specially: 
733 the overstruck text is printed 
734 using the terminal's hardware boldface capability.
735 Other backspaces are deleted, along with the preceding character.
736 Carriage returns immediately followed by a newline are deleted.
737 other carriage returns are handled as specified by the -r option.
738 Text which is overstruck or underlined can be searched for
739 if neither -u nor -U is in effect.
740 .IP "-V or --version"
741 Displays the version number of 
742 .I less.
743 .IP "-w or --hilite-unread"
744 Temporarily highlights the first "new" line after a forward movement
745 of a full page.
746 The first "new" line is the line immediately following the line previously
747 at the bottom of the screen.
748 Also highlights the target line after a g or p command.
749 The highlight is removed at the next command which causes movement.
750 The entire line is highlighted, unless the -J option is in effect,
751 in which case only the status column is highlighted.
752 .IP "-W or --HILITE-UNREAD"
753 Like -w, but temporarily highlights the first new line after any 
754 forward movement command larger than one line.
755 .IP "-x\fIn\fP,... or --tabs=\fIn\fP,..."
756 Sets tab stops.
757 If only one \fIn\fP is specified, tab stops are set at multiples of \fIn\fP.
758 If multiple values separated by commas are specified, tab stops
759 are set at those positions, and then continue with the same spacing as the
760 last two.
761 For example, \fI-x9,17\fP will set tabs at positions 9, 17, 25, 33, etc.
762 The default for \fIn\fP is 8.
763 .IP "-X or --no-init"
764 Disables sending the termcap initialization and deinitialization strings
765 to the terminal.
766 This is sometimes desirable if the deinitialization string does
767 something unnecessary, like clearing the screen.
768 .IP "--no-keypad"
769 Disables sending the keypad initialization and deinitialization strings
770 to the terminal.
771 This is sometimes useful if the keypad strings make the numeric
772 keypad behave in an undesirable manner.
773 .IP "-y\fIn\fP or --max-forw-scroll=\fIn\fP"
774 Specifies a maximum number of lines to scroll forward.
775 If it is necessary to scroll forward more than \fIn\fP lines,
776 the screen is repainted instead.
777 The -c or -C option may be used to repaint from the top of
778 the screen if desired.
779 By default, any forward movement causes scrolling.
780 .IP "-[z]\fIn\fP or --window=\fIn\fP"
781 Changes the default scrolling window size to \fIn\fP lines.
782 The default is one screenful.
783 The z and w commands can also be used to change the window size.
784 The "z" may be omitted for compatibility with
785 .I more.
786 If the number
787 .I n
788 is negative, it indicates 
789 .I n
790 lines less than the current screen size.
791 For example, if the screen is 24 lines, \fI-z-4\fP sets the 
792 scrolling window to 20 lines.  If the screen is resized to 40 lines,
793 the scrolling window automatically changes to 36 lines.
794 .IP -"\fIcc\fP\ or\ --quotes=\fIcc\fP
795 Changes the filename quoting character.
796 This may be necessary if you are trying to name a file
797 which contains both spaces and quote characters.
798 Followed by a single character, this changes the quote character to that
799 character.
800 Filenames containing a space should then be surrounded by that character
801 rather than by double quotes.
802 Followed by two characters, changes the open quote to the first character,
803 and the close quote to the second character.
804 Filenames containing a space should then be preceded by the open quote
805 character and followed by the close quote character.
806 Note that even after the quote characters are changed, this option
807 remains -" (a dash followed by a double quote).
808 .IP "-~ or --tilde"
809 Normally lines after end of file are displayed as a single tilde (~).
810 This option causes lines after end of file to be displayed as blank lines.
811 .IP "-# or --shift"
812 Specifies the default number of positions to scroll horizontally
813 in the RIGHTARROW and LEFTARROW commands.
814 If the number specified is zero, it sets the default number of
815 positions to one half of the screen width.
816 .IP --
817 A command line argument of "--" marks the end of option arguments.
818 Any arguments following this are interpreted as filenames.
819 This can be useful when viewing a file whose name begins with a "-" or "+".
820 .IP +
821 If a command line option begins with \fB+\fP,
822 the remainder of that option is taken to be an initial command to
823 .I less.
824 For example, +G tells
825 .I less
826 to start at the end of the file rather than the beginning,
827 and +/xyz tells it to start at the first occurrence of "xyz" in the file.
828 As a special case, +<number> acts like +<number>g; 
829 that is, it starts the display at the specified line number
830 (however, see the caveat under the "g" command above).
831 If the option starts with ++, the initial command applies to
832 every file being viewed, not just the first one.
833 The + command described previously
834 may also be used to set (or change) an initial command for every file.
835
836 .SH "LINE EDITING"
837 When entering command line at the bottom of the screen
838 (for example, a filename for the :e command,
839 or the pattern for a search command),
840 certain keys can be used to manipulate the command line.
841 Most commands have an alternate form in [ brackets ] which can be used if
842 a key does not exist on a particular keyboard. 
843 (The bracketed forms do not work in the MS-DOS version.)
844 Any of these special keys may be entered literally by preceding
845 it with the "literal" character, either ^V or ^A.
846 A backslash itself may also be entered literally by entering two backslashes.
847 .IP "LEFTARROW [ ESC-h ]"
848 Move the cursor one space to the left.
849 .IP "RIGHTARROW [ ESC-l ]"
850 Move the cursor one space to the right.
851 .IP "^LEFTARROW [ ESC-b or ESC-LEFTARROW ]"
852 (That is, CONTROL and LEFTARROW simultaneously.)
853 Move the cursor one word to the left.
854 .IP "^RIGHTARROW [ ESC-w or ESC-RIGHTARROW ]"
855 (That is, CONTROL and RIGHTARROW simultaneously.)
856 Move the cursor one word to the right.
857 .IP "HOME [ ESC-0 ]"
858 Move the cursor to the beginning of the line.
859 .IP "END [ ESC-$ ]"
860 Move the cursor to the end of the line.
861 .IP "BACKSPACE"
862 Delete the character to the left of the cursor,
863 or cancel the command if the command line is empty.
864 .IP "DELETE or [ ESC-x ]"
865 Delete the character under the cursor.
866 .IP "^BACKSPACE [ ESC-BACKSPACE ]"
867 (That is, CONTROL and BACKSPACE simultaneously.)
868 Delete the word to the left of the cursor.
869 .IP "^DELETE [ ESC-X or ESC-DELETE ]"
870 (That is, CONTROL and DELETE simultaneously.)
871 Delete the word under the cursor.
872 .IP "UPARROW [ ESC-k ]"
873 Retrieve the previous command line.
874 .IP "DOWNARROW [ ESC-j ]"
875 Retrieve the next command line.
876 .IP "TAB"
877 Complete the partial filename to the left of the cursor.
878 If it matches more than one filename, the first match
879 is entered into the command line.
880 Repeated TABs will cycle thru the other matching filenames.
881 If the completed filename is a directory, a "/" is appended to the filename.
882 (On MS-DOS systems, a "\\" is appended.)
883 The environment variable LESSSEPARATOR can be used to specify a 
884 different character to append to a directory name.
885 .IP "BACKTAB [ ESC-TAB ]"
886 Like, TAB, but cycles in the reverse direction thru the matching filenames.
887 .IP "^L"
888 Complete the partial filename to the left of the cursor.
889 If it matches more than one filename, all matches are entered into
890 the command line (if they fit).
891 .IP "^U (Unix and OS/2) or ESC (MS-DOS)"
892 Delete the entire command line,
893 or cancel the command if the command line is empty.
894 If you have changed your line-kill character in Unix to something
895 other than ^U, that character is used instead of ^U.
896
897 .SH "KEY BINDINGS"
898 You may define your own 
899 .I less
900 commands by using the program 
901 .I lesskey
902 (1)
903 to create a lesskey file.
904 This file specifies a set of command keys and an action
905 associated with each key.
906 You may also use
907 .I lesskey
908 to change the line-editing keys (see LINE EDITING),
909 and to set environment variables.
910 If the environment variable LESSKEY is set,
911 .I less
912 uses that as the name of the lesskey file.
913 Otherwise, 
914 .I less
915 looks in a standard place for the lesskey file:
916 On Unix systems,
917 .I less
918 looks for a lesskey file called "$HOME/.less".
919 On MS-DOS and Windows systems,
920 .I less
921 looks for a lesskey file called "$HOME/_less", and if it is not found there,
922 then looks for a lesskey file called "_less" in any directory specified
923 in the PATH environment variable.
924 On OS/2 systems,
925 .I less
926 looks for a lesskey file called "$HOME/less.ini", and if it is not found,
927 then looks for a lesskey file called "less.ini" in any directory specified
928 in the INIT environment variable, and if it not found there,
929 then looks for a lesskey file called "less.ini" in any directory specified
930 in the PATH environment variable.
931 See the
932 .I lesskey
933 manual page for more details.
934 .P
935 A system-wide lesskey file may also be set up to provide key bindings.
936 If a key is defined in both a local lesskey file and in the
937 system-wide file, key bindings in the local file take precedence over 
938 those in the system-wide file.
939 If the environment variable LESSKEY_SYSTEM is set,
940 .I less
941 uses that as the name of the system-wide lesskey file.
942 Otherwise,
943 .I less 
944 looks in a standard place for the system-wide lesskey file:
945 On Unix systems, the system-wide lesskey file is /usr/local/etc/sysless.
946 (However, if 
947 .I less 
948 was built with a different sysconf directory than /usr/local/etc,
949 that directory is where the sysless file is found.)
950 On MS-DOS and Windows systems, the system-wide lesskey file is c:\\_sysless.
951 On OS/2 systems, the system-wide lesskey file is c:\\sysless.ini.
952
953 .SH "INPUT PREPROCESSOR"
954 You may define an "input preprocessor" for 
955 .I less.
956 Before
957 .I less
958 opens a file, it first gives your input preprocessor a chance to modify the
959 way the contents of the file are displayed.
960 An input preprocessor is simply an executable program (or shell script),
961 which writes the contents of the file to a different file,
962 called the replacement file.
963 The contents of the replacement file are then displayed 
964 in place of the contents of the original file.
965 However, it will appear to the user as if the original file is opened;
966 that is, 
967 .I less
968 will display the original filename as the name of the current file.
969 .PP
970 An input preprocessor receives one command line argument, the original filename,
971 as entered by the user.
972 It should create the replacement file, and when finished,
973 print the name of the replacement file to its standard output.
974 If the input preprocessor does not output a replacement filename, 
975 .I less
976 uses the original file, as normal.
977 The input preprocessor is not called when viewing standard input.
978 To set up an input preprocessor, set the LESSOPEN environment variable
979 to a command line which will invoke your input preprocessor.
980 This command line should include one occurrence of the string "%s", 
981 which will be replaced by the filename
982 when the input preprocessor command is invoked.
983 .PP
984 When 
985 .I less
986 closes a file opened in such a way, it will call another program,
987 called the input postprocessor,
988 which may perform any desired clean-up action (such as deleting the
989 replacement file created by LESSOPEN).
990 This program receives two command line arguments, the original filename
991 as entered by the user, and the name of the replacement file.
992 To set up an input postprocessor, set the LESSCLOSE environment variable 
993 to a command line which will invoke your input postprocessor.
994 It may include two occurrences of the string "%s"; 
995 the first is replaced with the original name of the file and 
996 the second with the name of the replacement file, 
997 which was output by LESSOPEN.
998 .PP
999 For example, on many Unix systems, these two scripts will allow you
1000 to keep files in compressed format, but still let
1001 .I less
1002 view them directly:
1003 .PP
1004 lessopen.sh:
1005 .br
1006         #! /bin/sh
1007 .br
1008         case "$1" in
1009 .br
1010         *.Z)    uncompress -c $1  >/tmp/less.$$  2>/dev/null
1011 .br
1012                 if [ -s /tmp/less.$$ ]; then 
1013 .br
1014                         echo /tmp/less.$$
1015 .br
1016                 else
1017 .br
1018                         rm -f /tmp/less.$$
1019 .br
1020                 fi
1021 .br
1022                 ;;
1023 .br
1024         esac
1025 .PP
1026 lessclose.sh:
1027 .br
1028         #! /bin/sh
1029 .br
1030         rm $2
1031 .PP
1032 To use these scripts, put them both where they can be executed and
1033 set LESSOPEN="lessopen.sh\ %s", and
1034 LESSCLOSE="lessclose.sh\ %s\ %s".
1035 More complex LESSOPEN and LESSCLOSE scripts may be written
1036 to accept other types of compressed files, and so on.
1037 .PP
1038 It is also possible to set up an input preprocessor to
1039 pipe the file data directly to 
1040 .I less,
1041 rather than putting the data into a replacement file.
1042 This avoids the need to decompress the entire file before 
1043 starting to view it.
1044 An input preprocessor that works this way is called an input pipe.
1045 An input pipe, instead of writing the name of a replacement file on
1046 its standard output,
1047 writes the entire contents of the replacement file on its standard output.
1048 If the input pipe does not write any characters on its standard output,
1049 then there is no replacement file and 
1050 .I less
1051 uses the original file, as normal.
1052 To use an input pipe,
1053 make the first character in the LESSOPEN environment variable a 
1054 vertical bar (|) to signify that the input preprocessor is an input pipe.
1055 .PP
1056 For example, on many Unix systems, this script will work like the
1057 previous example scripts:
1058 .PP
1059 lesspipe.sh:
1060 .br
1061         #! /bin/sh
1062 .br
1063         case "$1" in
1064 .br
1065         *.Z)    uncompress -c $1  2>/dev/null
1066 .br
1067                 ;;
1068 .br
1069         esac
1070 .br
1071 .PP
1072 To use this script, put it where it can be executed and set
1073 LESSOPEN="|lesspipe.sh %s".
1074 When an input pipe is used, a LESSCLOSE postprocessor can be used,
1075 but it is usually not necessary since there is no replacement file
1076 to clean up.
1077 In this case, the replacement file name passed to the LESSCLOSE
1078 postprocessor is "-".
1079
1080 .SH "NATIONAL CHARACTER SETS"
1081 There are three types of characters in the input file:
1082 .IP "normal characters"
1083 can be displayed directly to the screen.
1084 .IP "control characters"
1085 should not be displayed directly, but are expected to be found
1086 in ordinary text files (such as backspace and tab).
1087 .IP "binary characters"
1088 should not be displayed directly and are not expected to be found
1089 in text files.
1090 .PP
1091 A "character set" is simply a description of which characters are to
1092 be considered normal, control, and binary.
1093 The LESSCHARSET environment variable may be used to select a character set.
1094 Possible values for LESSCHARSET are:
1095 .IP ascii
1096 BS, TAB, NL, CR, and formfeed are control characters,
1097 all chars with values between 32 and 126 are normal,
1098 and all others are binary.
1099 .IP iso8859
1100 Selects an ISO 8859 character set.
1101 This is the same as ASCII, except characters between 160 and 255 are
1102 treated as normal characters.
1103 .IP latin1
1104 Same as iso8859.
1105 .IP latin9
1106 Same as iso8859.
1107 .IP dos
1108 Selects a character set appropriate for MS-DOS.
1109 .IP ebcdic
1110 Selects an EBCDIC character set.
1111 .IP IBM-1047
1112 Selects an EBCDIC character set used by OS/390 Unix Services.
1113 This is the EBCDIC analogue of latin1.  You get similar results
1114 by setting either LESSCHARSET=IBM-1047 or LC_CTYPE=en_US
1115 in your environment.
1116 .IP koi8-r
1117 Selects a Russian character set.
1118 .IP next
1119 Selects a character set appropriate for NeXT computers.
1120 .IP utf-8
1121 Selects the UTF-8 encoding of the ISO 10646 character set.
1122 .PP
1123 In special cases, it may be desired to tailor
1124 .I less
1125 to use a character set other than the ones definable by LESSCHARSET.
1126 In this case, the environment variable LESSCHARDEF can be used
1127 to define a character set.
1128 It should be set to a string where each character in the string represents
1129 one character in the character set.
1130 The character "." is used for a normal character, "c" for control,
1131 and "b" for binary.
1132 A decimal number may be used for repetition.
1133 For example, "bccc4b." would mean character 0 is binary,
1134 1, 2 and 3 are control, 4, 5, 6 and 7 are binary, and 8 is normal.
1135 All characters after the last are taken to be the same as the last,
1136 so characters 9 through 255 would be normal.
1137 (This is an example, and does not necessarily 
1138 represent any real character set.)
1139 .PP
1140 This table shows the value of LESSCHARDEF which is equivalent
1141 to each of the possible values for LESSCHARSET:
1142 .sp
1143         ascii\  8bcccbcc18b95.b
1144 .br
1145         dos\ \ \        8bcccbcc12bc5b95.b.
1146 .br
1147         ebcdic  5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b
1148 .br
1149         \ \ \ \ \ \     9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b.
1150 .br
1151         IBM-1047        4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc
1152         \ \ \ \ \ \     191.b
1153 .br
1154         iso8859 8bcccbcc18b95.33b.
1155 .br
1156         koi8-r  8bcccbcc18b95.b128.
1157 .br
1158         latin1  8bcccbcc18b95.33b.
1159 .br
1160         next\ \         8bcccbcc18b95.bb125.bb
1161 .PP
1162 If neither LESSCHARSET nor LESSCHARDEF is set,
1163 but the string "UTF-8" is found in the LC_ALL, LC_TYPE or LANG
1164 environment variables, then the default character set is utf-8.
1165 .PP
1166 If that string is not found, but your system supports the
1167 .I setlocale
1168 interface,
1169 .I less
1170 will use setlocale to determine the character set.
1171 setlocale is controlled by setting the LANG or LC_CTYPE environment
1172 variables.
1173 .PP
1174 Finally, if the
1175 .I setlocale
1176 interface is also not available, the default character set is latin1.
1177 .PP
1178 Control and binary characters are displayed in standout (reverse video).
1179 Each such character is displayed in caret notation if possible
1180 (e.g. ^A for control-A).  Caret notation is used only if 
1181 inverting the 0100 bit results in a normal printable character.
1182 Otherwise, the character is displayed as a hex number in angle brackets.
1183 This format can be changed by 
1184 setting the LESSBINFMT environment variable.
1185 LESSBINFMT may begin with a "*" and one character to select 
1186 the display attribute:
1187 "*k" is blinking, "*d" is bold, "*u" is underlined, "*s" is standout,
1188 and "*n" is normal.
1189 If LESSBINFMT does not begin with a "*", normal attribute is assumed.
1190 The remainder of LESSBINFMT is a string which may include one
1191 printf-style escape sequence (a % followed by x, X, o, d, etc.).
1192 For example, if LESSBINFMT is "*u[%x]", binary characters
1193 are displayed in underlined hexadecimal surrounded by brackets.
1194 The default if no LESSBINFMT is specified is "*s<%X>".
1195
1196 .SH "PROMPTS"
1197 The -P option allows you to tailor the prompt to your preference.
1198 The string given to the -P option replaces the specified prompt string.
1199 Certain characters in the string are interpreted specially.
1200 The prompt mechanism is rather complicated to provide flexibility,
1201 but the ordinary user need not understand the details of constructing
1202 personalized prompt strings.
1203 .sp
1204 A percent sign followed by a single character is expanded
1205 according to what the following character is:
1206 .IP "%b\fIX\fP"
1207 Replaced by the byte offset into the current input file.
1208 The b is followed by a single character (shown as \fIX\fP above)
1209 which specifies the line whose byte offset is to be used.
1210 If the character is a "t", the byte offset of the top line in the
1211 display is used,
1212 an "m" means use the middle line,
1213 a "b" means use the bottom line,
1214 a "B" means use the line just after the bottom line,
1215 and a "j" means use the "target" line, as specified by the -j option.
1216 .IP "%B"
1217 Replaced by the size of the current input file.
1218 .IP "%c"
1219 Replaced by the column number of the text appearing in the first
1220 column of the screen.
1221 .IP "%d\fIX\fP"
1222 Replaced by the page number of a line in the input file.
1223 The line to be used is determined by the \fIX\fP, as with the %b option.
1224 .IP "%D"
1225 Replaced by the number of pages in the input file,
1226 or equivalently, the page number of the last line in the input file.
1227 .IP "%E"
1228 Replaced by the name of the editor (from the VISUAL environment variable,
1229 or the EDITOR environment variable if VISUAL is not defined).
1230 See the discussion of the LESSEDIT feature below.
1231 .IP "%f"
1232 Replaced by the name of the current input file.
1233 .IP "%i"
1234 Replaced by the index of the current file in the list of
1235 input files.
1236 .IP "%l\fIX\fP"
1237 Replaced by the line number of a line in the input file.
1238 The line to be used is determined by the \fIX\fP, as with the %b option.
1239 .IP "%L"
1240 Replaced by the line number of the last line in the input file.
1241 .IP "%m"
1242 Replaced by the total number of input files.
1243 .IP "%p\fIX\fP"
1244 Replaced by the percent into the current input file, based on byte offsets.
1245 The line used is determined by the \fIX\fP as with the %b option.
1246 .IP "%P\fIX\fP"
1247 Replaced by the percent into the current input file, based on line numbers.
1248 The line used is determined by the \fIX\fP as with the %b option.
1249 .IP "%s"
1250 Same as %B.
1251 .IP "%t"
1252 Causes any trailing spaces to be removed.
1253 Usually used at the end of the string, but may appear anywhere.
1254 .IP "%x"
1255 Replaced by the name of the next input file in the list.
1256 .PP
1257 If any item is unknown (for example, the file size if input
1258 is a pipe), a question mark is printed instead.
1259 .PP
1260 The format of the prompt string can be changed
1261 depending on certain conditions.
1262 A question mark followed by a single character acts like an "IF":
1263 depending on the following character, a condition is evaluated.
1264 If the condition is true, any characters following the question mark
1265 and condition character, up to a period, are included in the prompt.
1266 If the condition is false, such characters are not included.
1267 A colon appearing between the question mark and the
1268 period can be used to establish an "ELSE": any characters between
1269 the colon and the period are included in the string if and only if
1270 the IF condition is false.
1271 Condition characters (which follow a question mark) may be:
1272 .IP "?a"
1273 True if any characters have been included in the prompt so far.
1274 .IP "?b\fIX\fP"
1275 True if the byte offset of the specified line is known.
1276 .IP "?B"
1277 True if the size of current input file is known.
1278 .IP "?c"
1279 True if the text is horizontally shifted (%c is not zero).
1280 .IP "?d\fIX\fP"
1281 True if the page number of the specified line is known.
1282 .IP "?e"
1283 True if at end-of-file.
1284 .IP "?f"
1285 True if there is an input filename
1286 (that is, if input is not a pipe).
1287 .IP "?l\fIX\fP"
1288 True if the line number of the specified line is known.
1289 .IP "?L"
1290 True if the line number of the last line in the file is known.
1291 .IP "?m"
1292 True if there is more than one input file.
1293 .IP "?n"
1294 True if this is the first prompt in a new input file.
1295 .IP "?p\fIX\fP"
1296 True if the percent into the current input file, based on byte offsets,
1297 of the specified line is known.
1298 .IP "?P\fIX\fP"
1299 True if the percent into the current input file, based on line numbers,
1300 of the specified line is known.
1301 .IP "?s"
1302 Same as "?B".
1303 .IP "?x"
1304 True if there is a next input file
1305 (that is, if the current input file is not the last one).
1306 .PP
1307 Any characters other than the special ones
1308 (question mark, colon, period, percent, and backslash)
1309 become literally part of the prompt.
1310 Any of the special characters may be included in the prompt literally
1311 by preceding it with a backslash.
1312 .PP
1313 Some examples:
1314 .sp
1315 ?f%f:Standard input.
1316 .sp
1317 This prompt prints the filename, if known;
1318 otherwise the string "Standard input".
1319 .sp
1320 ?f%f .?ltLine %lt:?pt%pt\\%:?btByte %bt:-...
1321 .sp
1322 This prompt would print the filename, if known.
1323 The filename is followed by the line number, if known,
1324 otherwise the percent if known, otherwise the byte offset if known.
1325 Otherwise, a dash is printed.
1326 Notice how each question mark has a matching period,
1327 and how the % after the %pt
1328 is included literally by escaping it with a backslash.
1329 .sp
1330 ?n?f%f\ .?m(file\ %i\ of\ %m)\ ..?e(END)\ ?x-\ Next\\:\ %x..%t
1331 .sp
1332 This prints the filename if this is the first prompt in a file,
1333 followed by the "file N of N" message if there is more
1334 than one input file.
1335 Then, if we are at end-of-file, the string "(END)" is printed
1336 followed by the name of the next file, if there is one.
1337 Finally, any trailing spaces are truncated.
1338 This is the default prompt.
1339 For reference, here are the defaults for
1340 the other two prompts (-m and -M respectively).
1341 Each is broken into two lines here for readability only.
1342 .nf
1343 .sp
1344 ?n?f%f\ .?m(file\ %i\ of\ %m)\ ..?e(END)\ ?x-\ Next\\:\ %x.:
1345         ?pB%pB\\%:byte\ %bB?s/%s...%t
1346 .sp
1347 ?f%f\ .?n?m(file\ %i\ of\ %m)\ ..?ltlines\ %lt-%lb?L/%L.\ :
1348         byte\ %bB?s/%s.\ .?e(END)\ ?x-\ Next\\:\ %x.:?pB%pB\\%..%t
1349 .sp
1350 .fi
1351 And here is the default message produced by the = command:
1352 .nf
1353 .sp
1354 ?f%f\ .?m(file\ %i\ of\ %m)\ .?ltlines\ %lt-%lb?L/%L.\ .
1355         byte\ %bB?s/%s.\ ?e(END)\ :?pB%pB\\%..%t
1356 .fi
1357 .PP
1358 The prompt expansion features are also used for another purpose:
1359 if an environment variable LESSEDIT is defined, it is used
1360 as the command to be executed when the v command is invoked.
1361 The LESSEDIT string is expanded in the same way as the prompt strings.
1362 The default value for LESSEDIT is:
1363 .nf
1364 .sp
1365         %E\ ?lm+%lm.\ %f
1366 .sp
1367 .fi
1368 Note that this expands to the editor name, followed by a + and the
1369 line number, followed by the file name.
1370 If your editor does not accept the "+linenumber" syntax, or has other
1371 differences in invocation syntax, the LESSEDIT variable can be 
1372 changed to modify this default.
1373
1374 .SH SECURITY
1375 When the environment variable LESSSECURE is set to 1,
1376 .I less
1377 runs in a "secure" mode.
1378 This means these features are disabled:
1379 .RS
1380 .IP "!"
1381 the shell command
1382 .IP "|"
1383 the pipe command
1384 .IP ":e"
1385 the examine command.
1386 .IP "v"
1387 the editing command
1388 .IP "s  -o"
1389 log files
1390 .IP "-k"
1391 use of lesskey files
1392 .IP "-t"
1393 use of tags files
1394 .IP " "
1395 metacharacters in filenames, such as *
1396 .IP " "
1397 filename completion (TAB, ^L)
1398 .RE
1399 .PP
1400 Less can also be compiled to be permanently in "secure" mode.
1401
1402 .SH "ENVIRONMENT VARIABLES"
1403 Environment variables may be specified either in the system environment
1404 as usual, or in a 
1405 .I lesskey
1406 (1) file.
1407 If environment variables are defined in more than one place, 
1408 variables defined in a local lesskey file take precedence over
1409 variables defined in the system environment, which take precedence
1410 over variables defined in the system-wide lesskey file.
1411 .IP COLUMNS
1412 Sets the number of columns on the screen.
1413 Takes precedence over the number of columns specified by the TERM variable.
1414 (But if you have a windowing system which supports TIOCGWINSZ or WIOCGETD,
1415 the window system's idea of the screen size takes precedence over the
1416 LINES and COLUMNS environment variables.)
1417 .IP EDITOR
1418 The name of the editor (used for the v command).
1419 .IP HOME
1420 Name of the user's home directory
1421 (used to find a lesskey file on Unix and OS/2 systems).
1422 .IP "HOMEDRIVE, HOMEPATH"
1423 Concatenation of the HOMEDRIVE and HOMEPATH environment variables is
1424 the name of the user's home directory if the HOME variable is not set
1425 (only in the Windows version).
1426 .IP INIT
1427 Name of the user's init directory (used to find a lesskey file on OS/2 systems).
1428 .IP LANG
1429 Language for determining the character set.
1430 .IP LC_CTYPE
1431 Language for determining the character set.
1432 .IP LESS
1433 Options which are passed to 
1434 .I less
1435 automatically.
1436 .IP LESSANSIENDCHARS
1437 Characters which are assumed to end an ANSI color escape sequence
1438 (default "m").
1439 .IP LESSBINFMT
1440 Format for displaying non-printable, non-control characters.
1441 .IP LESSCHARDEF
1442 Defines a character set.
1443 .IP LESSCHARSET
1444 Selects a predefined character set.
1445 .IP LESSCLOSE
1446 Command line to invoke the (optional) input-postprocessor.
1447 .IP LESSECHO
1448 Name of the lessecho program (default "lessecho").
1449 The lessecho program is needed to expand metacharacters, such as * and ?,
1450 in filenames on Unix systems.
1451 .IP LESSEDIT
1452 Editor prototype string (used for the v command).
1453 See discussion under PROMPTS.
1454 .IP LESSGLOBALTAGS
1455 Name of the command used by the -t option to find global tags.
1456 Normally should be set to "global" if your system has the
1457 .I global
1458 (1) command.  If not set, global tags are not used.
1459 .IP LESSKEY
1460 Name of the default lesskey(1) file.
1461 .IP LESSKEY_SYSTEM
1462 Name of the default system-wide lesskey(1) file.
1463 .IP LESSMETACHARS
1464 List of characters which are considered "metacharacters" by the shell.
1465 .IP LESSMETAESCAPE
1466 Prefix which less will add before each metacharacter in a
1467 command sent to the shell.
1468 If LESSMETAESCAPE is an empty string, commands containing
1469 metacharacters will not be passed to the shell.
1470 .IP LESSOPEN
1471 Command line to invoke the (optional) input-preprocessor.
1472 .IP LESSSECURE
1473 Runs less in "secure" mode.
1474 See discussion under SECURITY.
1475 .IP LESSSEPARATOR
1476 String to be appended to a directory name in filename completion.
1477 .IP LINES
1478 Sets the number of lines on the screen.
1479 Takes precedence over the number of lines specified by the TERM variable.
1480 (But if you have a windowing system which supports TIOCGWINSZ or WIOCGETD,
1481 the window system's idea of the screen size takes precedence over the
1482 LINES and COLUMNS environment variables.)
1483 .IP PATH
1484 User's search path (used to find a lesskey file 
1485 on MS-DOS and OS/2 systems).
1486 .IP SHELL
1487 The shell used to execute the ! command, as well as to expand filenames.
1488 .IP TERM
1489 The type of terminal on which
1490 .I less
1491 is being run.
1492 .IP VISUAL
1493 The name of the editor (used for the v command).
1494
1495 .SH "SEE ALSO"
1496 lesskey(1)
1497
1498 .SH WARNINGS
1499 The = command and prompts (unless changed by -P)
1500 report the line numbers of the lines at the top and bottom of the screen,
1501 but the byte and percent of the line after the one at the bottom of the screen.
1502 .PP
1503 If the :e command is used to name more than one file,
1504 and one of the named files has been viewed previously,
1505 the new files may be entered into the list in an unexpected order.
1506 .PP
1507 On certain older terminals (the so-called "magic cookie" terminals),
1508 search highlighting will cause an erroneous display.
1509 On such terminals, search highlighting is disabled by default 
1510 to avoid possible problems.
1511 .PP
1512 In certain cases, when search highlighting is enabled and 
1513 a search pattern begins with a ^,
1514 more text than the matching string may be highlighted.
1515 (This problem does not occur when less is compiled to use the POSIX
1516 regular expression package.)
1517 .PP
1518 When viewing text containing ANSI color escape sequences using the -R option,
1519 searching will not find text containing an embedded escape sequence.
1520 Also, search highlighting may change the color of some of the text
1521 which follows the highlighted text.
1522 .PP
1523 On some systems,
1524 .I setlocale
1525 claims that ASCII characters 0 thru 31 are control characters 
1526 rather than binary characters.
1527 This causes 
1528 .I less 
1529 to treat some binary files as ordinary, non-binary files.
1530 To workaround this problem, set the environment variable
1531 LESSCHARSET to "ascii" (or whatever character set is appropriate).
1532 .PP
1533 See http://www.greenwoodsoftware.com/less for the latest list of known bugs in this
1534 version of less.
1535
1536 .SH COPYRIGHT
1537 Copyright (C) 2001  Mark Nudelman
1538 .PP
1539 less is part of the GNU project and is free software.
1540 You can redistribute it and/or modify it
1541 under the terms of either
1542 (1) the GNU General Public License as published by
1543 the Free Software Foundation; or (2) the Less License.
1544 See the file README in the less distribution for more details
1545 regarding redistribution.
1546 You should have received a copy of the GNU General Public License 
1547 along with the source for less; see the file COPYING.
1548 If not, write to the Free Software Foundation, 59 Temple Place,
1549 Suite 330, Boston, MA  02111-1307, USA.
1550 You should also have received a copy of the Less License;
1551 see the file LICENSE.
1552 .PP
1553 less is distributed in the hope that it will be useful, but
1554 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
1555 or FITNESS FOR A PARTICULAR PURPOSE.
1556 See the GNU General Public License for more details.
1557
1558 .SH AUTHOR
1559 .PP
1560 Mark Nudelman <markn@greenwoodsoftware.com>
1561 .br
1562 Send bug reports or comments to the above address or to bug-less@gnu.org.
1563 .br
1564 For more information, see the less homepage at http://www.greenwoodsoftware.com/less.