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