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