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