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