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