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