OSDN Git Service

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