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