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