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