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