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