8 less - opposite of more
10 S
\bSY
\bYN
\bNO
\bOP
\bPS
\bSI
\bIS
\bS
11 l
\ble
\bes
\bss
\bs -
\b-?
\b?
12 l
\ble
\bes
\bss
\bs -
\b--
\b-h
\bhe
\bel
\blp
\bp
13 l
\ble
\bes
\bss
\bs -
\b-V
\bV
14 l
\ble
\bes
\bss
\bs -
\b--
\b-v
\bve
\ber
\brs
\bsi
\bio
\bon
\bn
15 l
\ble
\bes
\bss
\bs [
\b[-
\b-[
\b[+
\b+]
\b]a
\baB
\bBc
\bcC
\bCd
\bde
\beE
\bEf
\bfF
\bFg
\bgG
\bGi
\biI
\bIJ
\bJm
\bmM
\bMn
\bnN
\bNq
\bqQ
\bQr
\brR
\bRs
\bsS
\bSu
\buU
\bUV
\bVw
\bwW
\bWX
\bX]
\b]
16 [
\b[-
\b-b
\bb _
\bb_
\bu_
\bf_
\bs]
\b] [
\b[-
\b-h
\bh _
\bl_
\bi_
\bn_
\be_
\bs]
\b] [
\b[-
\b-j
\bj _
\bl_
\bi_
\bn_
\be]
\b] [
\b[-
\b-k
\bk _
\bk_
\be_
\by_
\bf_
\bi_
\bl_
\be]
\b]
17 [
\b[-
\b-{
\b{o
\boO
\bO}
\b} _
\bl_
\bo_
\bg_
\bf_
\bi_
\bl_
\be]
\b] [
\b[-
\b-p
\bp _
\bp_
\ba_
\bt_
\bt_
\be_
\br_
\bn]
\b] [
\b[-
\b-P
\bP _
\bp_
\br_
\bo_
\bm_
\bp_
\bt]
\b] [
\b[-
\b-t
\bt _
\bt_
\ba_
\bg]
\b]
18 [
\b[-
\b-T
\bT _
\bt_
\ba_
\bg_
\bs_
\bf_
\bi_
\bl_
\be]
\b] [
\b[-
\b-x
\bx _
\bt_
\ba_
\bb,
\b,.
\b..
\b..
\b.]
\b] [
\b[-
\b-y
\by _
\bl_
\bi_
\bn_
\be_
\bs]
\b] [
\b[-
\b-[
\b[z
\bz]
\b] _
\bl_
\bi_
\bn_
\be_
\bs]
\b]
19 [
\b[+
\b+[
\b[+
\b+]
\b]_
\bc_
\bm_
\bd]
\b] [
\b[-
\b--
\b-]
\b] [
\b[_
\bf_
\bi_
\bl_
\be_
\bn_
\ba_
\bm_
\be]
\b].
\b..
\b..
\b.
20 (See the OPTIONS section for alternate option syntax with
24 D
\bDE
\bES
\bSC
\bCR
\bRI
\bIP
\bPT
\bTI
\bIO
\bON
\bN
25 _
\bL_
\be_
\bs_
\bs is a program similar to _
\bm_
\bo_
\br_
\be (1), but which allows
26 backward movement in the file as well as forward movement.
27 Also, _
\bl_
\be_
\bs_
\bs does not have to read the entire input file
28 before starting, so with large input files it starts up
29 faster than text editors like _
\bv_
\bi (1). _
\bL_
\be_
\bs_
\bs uses termcap
30 (or terminfo on some systems), so it can run on a variety
31 of terminals. There is even limited support for hardcopy
32 terminals. (On a hardcopy terminal, lines which should be
33 printed at the top of the screen are prefixed with a
36 Commands are based on both _
\bm_
\bo_
\br_
\be and _
\bv_
\bi_
\b. Commands may be
37 preceded by a decimal number, called N in the descriptions
38 below. The number is used by some commands, as indicated.
41 C
\bCO
\bOM
\bMM
\bMA
\bAN
\bND
\bDS
\bS
42 In the following descriptions, ^X means control-X. ESC
43 stands for the ESCAPE key; for example ESC-v means the two
44 character sequence "ESCAPE", then "v".
46 h or H Help: display a summary of these commands. If you
47 forget all the other commands, remember this one.
49 SPACE or ^V or f or ^F
50 Scroll forward N lines, default one window (see
51 option -z below). If N is more than the screen
52 size, only the final screenful is displayed. Warn
53 ing: some systems use ^V as a special literaliza
56 z Like SPACE, but if N is specified, it becomes the
60 Like SPACE, but scrolls a full screenful, even if
64 Version 371: 26 Dec 2001 1
73 it reaches end-of-file in the process.
75 RETURN or ^N or e or ^E or j or ^J
76 Scroll forward N lines, default 1. The entire N
77 lines are displayed, even if N is more than the
81 Scroll forward N lines, default one half of the
82 screen size. If N is specified, it becomes the new
83 default for subsequent d and u commands.
86 Scroll backward N lines, default one window (see
87 option -z below). If N is more than the screen
88 size, only the final screenful is displayed.
90 w Like ESC-v, but if N is specified, it becomes the
93 y or ^Y or ^P or k or ^K
94 Scroll backward N lines, default 1. The entire N
95 lines are displayed, even if N is more than the
96 screen size. Warning: some systems use ^Y as a
97 special job control character.
100 Scroll backward N lines, default one half of the
101 screen size. If N is specified, it becomes the new
102 default for subsequent d and u commands.
105 Scroll horizontally right N characters, default
106 half the screen width (see the -# option). If a
107 number N is specified, it becomes the default for
108 future RIGHTARROW and LEFTARROW commands. While
109 the text is scrolled, it acts as though the -S
110 option (chop lines) were in effect.
113 Scroll horizontally left N characters, default half
114 the screen width (see the -# option). If a number
115 N is specified, it becomes the default for future
116 RIGHTARROW and LEFTARROW commands.
121 R Repaint the screen, discarding any buffered input.
122 Useful if the file is changing while it is being
125 F Scroll forward, and keep trying to read when the
126 end of file is reached. Normally this command
130 Version 371: 26 Dec 2001 2
139 would be used when already at the end of the file.
140 It is a way to monitor the tail of a file which is
141 growing while it is being viewed. (The behavior is
142 similar to the "tail -f" command.)
145 Go to line N in the file, default 1 (beginning of
146 file). (Warning: this may be slow if N is large.)
149 Go to line N in the file, default the end of the
150 file. (Warning: this may be slow if N is large, or
151 if N is not specified and standard input, rather
152 than a file, is being read.)
154 p or % Go to a position N percent into the file. N should
155 be between 0 and 100.
157 { If a left curly bracket appears in the top line
158 displayed on the screen, the { command will go to
159 the matching right curly bracket. The matching
160 right curly bracket is positioned on the bottom
161 line of the screen. If there is more than one left
162 curly bracket on the top line, a number N may be
163 used to specify the N-th bracket on the line.
165 } If a right curly bracket appears in the bottom line
166 displayed on the screen, the } command will go to
167 the matching left curly bracket. The matching left
168 curly bracket is positioned on the top line of the
169 screen. If there is more than one right curly
170 bracket on the top line, a number N may be used to
171 specify the N-th bracket on the line.
173 ( Like {, but applies to parentheses rather than
176 ) Like }, but applies to parentheses rather than
179 [ Like {, but applies to square brackets rather than
182 ] Like }, but applies to square brackets rather than
185 ESC-^F Followed by two characters, acts like {, but uses
186 the two characters as open and close brackets,
187 respectively. For example, "ESC ^F < >" could be
188 used to go forward to the > which matches the < in
189 the top displayed line.
191 ESC-^B Followed by two characters, acts like }, but uses
192 the two characters as open and close brackets,
196 Version 371: 26 Dec 2001 3
205 respectively. For example, "ESC ^B < >" could be
206 used to go backward to the < which matches the > in
207 the bottom displayed line.
209 m Followed by any lowercase letter, marks the current
210 position with that letter.
212 ' (Single quote.) Followed by any lowercase letter,
213 returns to the position which was previously marked
214 with that letter. Followed by another single
215 quote, returns to the position at which the last
216 "large" movement command was executed. Followed by
217 a ^ or $, jumps to the beginning or end of the file
218 respectively. Marks are preserved when a new file
219 is examined, so the ' command can be used to switch
222 ^X^X Same as single quote.
225 Search forward in the file for the N-th line con
226 taining the pattern. N defaults to 1. The pattern
227 is a regular expression, as recognized by _
\be_
\bd_
\b. The
228 search starts at the second line displayed (but see
229 the -a and -j options, which change this).
231 Certain characters are special if entered at the
232 beginning of the pattern; they modify the type of
233 search rather than become part of the pattern:
236 Search for lines which do NOT match the pat
240 Search multiple files. That is, if the
241 search reaches the END of the current file
242 without finding a match, the search contin
243 ues in the next file in the command line
247 Begin the search at the first line of the
248 FIRST file in the command line list, regard
249 less of what is currently displayed on the
250 screen or the settings of the -a or -j
253 ^K Highlight any text which matches the pattern
254 on the current screen, but don't move to the
255 first match (KEEP current position).
257 ^R Don't interpret regular expression metachar
258 acters; that is, do a simple textual
262 Version 371: 26 Dec 2001 4
274 Search backward in the file for the N-th line con
275 taining the pattern. The search starts at the line
276 immediately before the top line displayed.
278 Certain characters are special as in the / command:
281 Search for lines which do NOT match the pat
285 Search multiple files. That is, if the
286 search reaches the beginning of the current
287 file without finding a match, the search
288 continues in the previous file in the com
292 Begin the search at the last line of the
293 last file in the command line list, regard
294 less of what is currently displayed on the
295 screen or the settings of the -a or -j
298 ^K As in forward searches.
300 ^R As in forward searches.
308 n Repeat previous search, for N-th line containing
309 the last pattern. If the previous search was modi
310 fied by ^N, the search is made for the N-th line
311 NOT containing the pattern. If the previous search
312 was modified by ^E, the search continues in the
313 next (or previous) file if not satisfied in the
314 current file. If the previous search was modified
315 by ^R, the search is done without using regular
316 expressions. There is no effect if the previous
317 search was modified by ^F or ^K.
319 N Repeat previous search, but in the reverse direc
322 ESC-n Repeat previous search, but crossing file bound
323 aries. The effect is as if the previous search
328 Version 371: 26 Dec 2001 5
337 ESC-N Repeat previous search, but in the reverse direc
338 tion and crossing file boundaries.
340 ESC-u Undo search highlighting. Turn off highlighting of
341 strings matching the current search pattern. If
342 highlighting is already off because of a previous
343 ESC-u command, turn highlighting back on. Any
344 search command will also turn highlighting back on.
345 (Highlighting can also be disabled by toggling the
346 -G option; in that case search commands do not turn
347 highlighting back on.)
350 Examine a new file. If the filename is missing,
351 the "current" file (see the :n and :p commands
352 below) from the list of files in the command line
353 is re-examined. A percent sign (%) in the filename
354 is replaced by the name of the current file. A
355 pound sign (#) is replaced by the name of the pre
356 viously examined file. However, two consecutive
357 percent signs are simply replaced with a single
358 percent sign. This allows you to enter a filename
359 that contains a percent sign in the name. Simi
360 larly, two consecutive pound signs are replaced
361 with a single pound sign. The filename is inserted
362 into the command line list of files so that it can
363 be seen by subsequent :n and :p commands. If the
364 filename consists of several files, they are all
365 inserted into the list of files and the first one
366 is examined. If the filename contains one or more
367 spaces, the entire filename should be enclosed in
368 double quotes (also see the -" option).
371 Same as :e. Warning: some systems use ^V as a spe
372 cial literalization character. On such systems,
373 you may not be able to use ^V.
375 :n Examine the next file (from the list of files given
376 in the command line). If a number N is specified,
377 the N-th next file is examined.
379 :p Examine the previous file in the command line list.
380 If a number N is specified, the N-th previous file
383 :x Examine the first file in the command line list.
384 If a number N is specified, the N-th file in the
387 :d Remove the current file from the list of files.
389 t Go to the next tag, if there were more than one
390 matches for the current tag. See the -t option for
394 Version 371: 26 Dec 2001 6
403 more details about tags.
405 T Go to the previous tag, if there were more than one
406 matches for the current tag.
409 Prints some information about the file being
410 viewed, including its name and the line number and
411 byte offset of the bottom line being displayed. If
412 possible, it also prints the length of the file,
413 the number of lines in the file and the percent of
414 the file above the last displayed line.
416 - Followed by one of the command line option letters
417 (see OPTIONS below), this will change the setting
418 of that option and print a message describing the
419 new setting. If a ^P (CONTROL-P) is entered imme
420 diately after the dash, the setting of the option
421 is changed but no message is printed. If the
422 option letter has a numeric value (such as -b or
423 -h), or a string value (such as -P or -t), a new
424 value may be entered after the option letter. If
425 no new value is entered, a message describing the
426 current setting is printed and nothing is changed.
428 -- Like the - command, but takes a long option name
429 (see OPTIONS below) rather than a single option
430 letter. You must press RETURN after typing the
431 option name. A ^P immediately after the second
432 dash suppresses printing of a message describing
433 the new setting, as in the - command.
435 -+ Followed by one of the command line option letters
436 this will reset the option to its default setting
437 and print a message describing the new setting.
438 (The "-+_
\bX" command does the same thing as "-+_
\bX" on
439 the command line.) This does not work for string-
442 --+ Like the -+ command, but takes a long option name
443 rather than a single option letter.
445 -! Followed by one of the command line option letters,
446 this will reset the option to the "opposite" of its
447 default setting and print a message describing the
448 new setting. This does not work for numeric or
449 string-valued options.
451 --! Like the -! command, but takes a long option name
452 rather than a single option letter.
454 _ (Underscore.) Followed by one of the command line
455 option letters, this will print a message describ
456 ing the current setting of that option. The
460 Version 371: 26 Dec 2001 7
469 setting of the option is not changed.
471 __ (Double underscore.) Like the _ (underscore) com
472 mand, but takes a long option name rather than a
473 single option letter. You must press RETURN after
474 typing the option name.
476 +cmd Causes the specified cmd to be executed each time a
477 new file is examined. For example, +G causes _
\bl_
\be_
\bs_
\bs
478 to initially display each file starting at the end
479 rather than the beginning.
481 V Prints the version number of _
\bl_
\be_
\bs_
\bs being run.
483 q or Q or :q or :Q or ZZ
484 Exits _
\bl_
\be_
\bs_
\bs_
\b.
486 The following four commands may or may not be valid,
487 depending on your particular installation.
490 v Invokes an editor to edit the current file being
491 viewed. The editor is taken from the environment
492 variable VISUAL if defined, or EDITOR if VISUAL is
493 not defined, or defaults to "vi" if neither VISUAL
494 nor EDITOR is defined. See also the discussion of
495 LESSEDIT under the section on PROMPTS below.
498 Invokes a shell to run the shell-command given. A
499 percent sign (%) in the command is replaced by the
500 name of the current file. A pound sign (#) is
501 replaced by the name of the previously examined
502 file. "!!" repeats the last shell command. "!"
503 with no shell command simply invokes a shell. On
504 Unix systems, the shell is taken from the environ
505 ment variable SHELL, or defaults to "sh". On MS-
506 DOS and OS/2 systems, the shell is the normal com
510 <m> represents any mark letter. Pipes a section of
511 the input file to the given shell command. The
512 section of the file to be piped is between the
513 first line on the current screen and the position
514 marked by the letter. <m> may also be ^ or $ to
515 indicate beginning or end of file respectively. If
516 <m> is . or newline, the current screen is piped.
519 Save the input to a file. This only works if the
520 input is a pipe, not an ordinary file.
526 Version 371: 26 Dec 2001 8
535 O
\bOP
\bPT
\bTI
\bIO
\bON
\bNS
\bS
536 Command line options are described below. Most options
537 may be changed while _
\bl_
\be_
\bs_
\bs is running, via the "-" command.
539 Most options may be given in one of two forms: either a
540 dash followed by a single letter, or two dashes followed
541 by a long option name. A long option name may be abbrevi
542 ated as long as the abbreviation is unambiguous. For
543 example, --quit-at-eof may be abbreviated --quit, but not
544 --qui, since both --quit-at-eof and --quiet begin with
545 --qui. Some long option names are in uppercase, such as
546 --QUIT-AT-EOF, as distinct from --quit-at-eof. Such
547 option names need only have their first letter capital
548 ized; the remainder of the name may be in either case.
549 For example, --Quit-at-eof is equivalent to --QUIT-AT-EOF.
551 Options are also taken from the environment variable
552 "LESS". For example, to avoid typing "less -options ..."
553 each time _
\bl_
\be_
\bs_
\bs is invoked, you might tell _
\bc_
\bs_
\bh_
\b:
555 setenv LESS "-options"
557 or if you use _
\bs_
\bh_
\b:
559 LESS="-options"; export LESS
561 On MS-DOS, you don't need the quotes, but you should
562 replace any percent signs in the options string by double
565 The environment variable is parsed before the command
566 line, so command line options override the LESS environ
567 ment variable. If an option appears in the LESS variable,
568 it can be reset to its default value on the command line
569 by beginning the command line option with "-+".
571 For options like -P or -D which take a following string, a
572 dollar sign ($) must be used to signal the end of the
573 string. For example, to set two -D options on MS-DOS, you
574 must have a dollar sign between them, like this:
580 This option displays a summary of the commands
581 accepted by _
\bl_
\be_
\bs_
\bs (the same as the h command).
582 (Depending on how your shell interprets the ques
583 tion mark, it may be necessary to quote the ques
584 tion mark, thus: "-\?".)
586 -a or --search-skip-screen
587 Causes searches to start after the last line dis
588 played on the screen, thus skipping all lines
592 Version 371: 26 Dec 2001 9
601 displayed on the screen. By default, searches
602 start at the second line on the screen (or after
603 the last found line; see the -j option).
605 -b_
\bn or --buffers=_
\bn
606 Specifies the number of buffers _
\bl_
\be_
\bs_
\bs will use for
607 each file. Buffers are 1K, and by default 10
608 buffers are used for each file (except if the file
609 is a pipe; see the -B option). The number _
\bn speci
610 fies a different number of buffers to use.
613 By default, when data is read from a pipe, buffers
614 are allocated automatically as needed. If a large
615 amount of data is read from the pipe, this can
616 cause a large amount of memory to be allocated.
617 The -B option disables this automatic allocation of
618 buffers for pipes, so that only the number of
619 buffers specified by the -b option are used. Warn
620 ing: use of -B can result in erroneous display,
621 since only the most recently viewed part of the
622 file is kept in memory; any earlier data is lost.
625 Causes full screen repaints to be painted from the
626 top line down. By default, full screen repaints
627 are done by scrolling from the bottom of the
631 The -C option is like -c, but the screen is cleared
632 before it is repainted.
635 The -d option suppresses the error message normally
636 displayed if the terminal is dumb; that is, lacks
637 some important capability, such as the ability to
638 clear the screen or scroll backward. The -d option
639 does not otherwise change the behavior of _
\bl_
\be_
\bs_
\bs on a
642 -Dx
\bx_
\bc_
\bo_
\bl_
\bo_
\br or --color=x
\bx_
\bc_
\bo_
\bl_
\bo_
\br
643 [MS-DOS only] Sets the color of the text displayed.
644 x
\bx is a single character which selects the type of
645 text whose color is being set: n=normal, s=stand
646 out, d=bold, u=underlined, k=blink. _
\bc_
\bo_
\bl_
\bo_
\br is a
647 pair of numbers separated by a period. The first
648 number selects the foreground color and the second
649 selects the background color of the text. A single
650 number _
\bN is the same as _
\bN_
\b._
\b0.
653 Causes _
\bl_
\be_
\bs_
\bs to automatically exit the second time
654 it reaches end-of-file. By default, the only way
658 Version 371: 26 Dec 2001 10
667 to exit _
\bl_
\be_
\bs_
\bs is via the "q" command.
670 Causes _
\bl_
\be_
\bs_
\bs to automatically exit the first time it
674 Forces non-regular files to be opened. (A non-reg
675 ular file is a directory or a device special file.)
676 Also suppresses the warning message when a binary
677 file is opened. By default, _
\bl_
\be_
\bs_
\bs will refuse to
678 open non-regular files.
680 -F or --quit-if-one-screen
681 Causes _
\bl_
\be_
\bs_
\bs to automatically exit if the entire
682 file can be displayed on the first screen.
684 -g or --hilite-search
685 Normally, _
\bl_
\be_
\bs_
\bs will highlight ALL strings which
686 match the last search command. The -g option
687 changes this behavior to highlight only the partic
688 ular string which was found by the last search com
689 mand. This can cause _
\bl_
\be_
\bs_
\bs to run somewhat faster
692 -G or --HILITE-SEARCH
693 The -G option suppresses all highlighting of
694 strings found by search commands.
696 -h_
\bn or ---max-back-scroll=_
\bn
697 Specifies a maximum number of lines to scroll back
698 ward. If it is necessary to scroll backward more
699 than _
\bn lines, the screen is repainted in a forward
700 direction instead. (If the terminal does not have
701 the ability to scroll backward, -h0 is implied.)
704 Causes searches to ignore case; that is, uppercase
705 and lowercase are considered identical. This
706 option is ignored if any uppercase letters appear
707 in the search pattern; in other words, if a pattern
708 contains uppercase letters, then that search does
712 Like -i, but searches ignore case even if the pat
713 tern contains uppercase letters.
715 -j_
\bn or --jump-target=_
\bn
716 Specifies a line on the screen where the "target"
717 line is to be positioned. A target line is the
718 object of a text search, tag search, jump to a line
719 number, jump to a file percentage, or jump to a
720 marked position. The screen line is specified by a
724 Version 371: 26 Dec 2001 11
733 number: the top line on the screen is 1, the next
734 is 2, and so on. The number may be negative to
735 specify a line relative to the bottom of the
736 screen: the bottom line on the screen is -1, the
737 second to the bottom is -2, and so on. If the -j
738 option is used, searches begin at the line immedi
739 ately after the target line. For example, if "-j4"
740 is used, the target line is the fourth line on the
741 screen, so searches begin at the fifth line on the
744 -J or --status-column
745 Displays a status column at the left edge of the
746 screen. The status column shows the lines that
747 matched the current search. The status column is
748 also used if the -w or -W option is in effect.
750 -k_
\bf_
\bi_
\bl_
\be_
\bn_
\ba_
\bm_
\be or --lesskey-file=_
\bf_
\bi_
\bl_
\be_
\bn_
\ba_
\bm_
\be
751 Causes _
\bl_
\be_
\bs_
\bs to open and interpret the named file as
752 a _
\bl_
\be_
\bs_
\bs_
\bk_
\be_
\by (1) file. Multiple -k options may be
753 specified. If the LESSKEY or LESSKEY_SYSTEM envi
754 ronment variable is set, or if a lesskey file is
755 found in a standard place (see KEY BINDINGS), it is
756 also used as a _
\bl_
\be_
\bs_
\bs_
\bk_
\be_
\by file.
759 Causes _
\bl_
\be_
\bs_
\bs to prompt verbosely (like _
\bm_
\bo_
\br_
\be), with
760 the percent into the file. By default, _
\bl_
\be_
\bs_
\bs
761 prompts with a colon.
764 Causes _
\bl_
\be_
\bs_
\bs to prompt even more verbosely than
768 Suppresses line numbers. The default (to use line
769 numbers) may cause _
\bl_
\be_
\bs_
\bs to run more slowly in some
770 cases, especially with a very large input file.
771 Suppressing line numbers with the -n option will
772 avoid this problem. Using line numbers means: the
773 line number will be displayed in the verbose prompt
774 and in the = command, and the v command will pass
775 the current line number to the editor (see also the
776 discussion of LESSEDIT in PROMPTS below).
779 Causes a line number to be displayed at the begin
780 ning of each line in the display.
782 -o_
\bf_
\bi_
\bl_
\be_
\bn_
\ba_
\bm_
\be or --log-file=_
\bf_
\bi_
\bl_
\be_
\bn_
\ba_
\bm_
\be
783 Causes _
\bl_
\be_
\bs_
\bs to copy its input to the named file as
784 it is being viewed. This applies only when the
785 input file is a pipe, not an ordinary file. If the
786 file already exists, _
\bl_
\be_
\bs_
\bs will ask for confirmation
790 Version 371: 26 Dec 2001 12
799 before overwriting it.
801 -O_
\bf_
\bi_
\bl_
\be_
\bn_
\ba_
\bm_
\be or --LOG-FILE=_
\bf_
\bi_
\bl_
\be_
\bn_
\ba_
\bm_
\be
802 The -O option is like -o, but it will overwrite an
803 existing file without asking for confirmation.
805 If no log file has been specified, the -o and -O
806 options can be used from within _
\bl_
\be_
\bs_
\bs to specify a
807 log file. Without a file name, they will simply
808 report the name of the log file. The "s" command
809 is equivalent to specifying -o from within _
\bl_
\be_
\bs_
\bs_
\b.
811 -p_
\bp_
\ba_
\bt_
\bt_
\be_
\br_
\bn or --pattern=_
\bp_
\ba_
\bt_
\bt_
\be_
\br_
\bn
812 The -p option on the command line is equivalent to
813 specifying +/_
\bp_
\ba_
\bt_
\bt_
\be_
\br_
\bn; that is, it tells _
\bl_
\be_
\bs_
\bs to
814 start at the first occurrence of _
\bp_
\ba_
\bt_
\bt_
\be_
\br_
\bn in the
817 -P_
\bp_
\br_
\bo_
\bm_
\bp_
\bt or --prompt=_
\bp_
\br_
\bo_
\bm_
\bp_
\bt
818 Provides a way to tailor the three prompt styles to
819 your own preference. This option would normally be
820 put in the LESS environment variable, rather than
821 being typed in with each _
\bl_
\be_
\bs_
\bs command. Such an
822 option must either be the last option in the LESS
823 variable, or be terminated by a dollar sign. -Ps
824 followed by a string changes the default (short)
825 prompt to that string. -Pm changes the medium (-m)
826 prompt. -PM changes the long (-M) prompt. -Ph
827 changes the prompt for the help screen. -P=
828 changes the message printed by the = command. -Pw
829 changes the message printed while waiting for data
830 (in the F command). All prompt strings consist of
831 a sequence of letters and special escape sequences.
832 See the section on PROMPTS for more details.
834 -q or --quiet or --silent
835 Causes moderately "quiet" operation: the terminal
836 bell is not rung if an attempt is made to scroll
837 past the end of the file or before the beginning of
838 the file. If the terminal has a "visual bell", it
839 is used instead. The bell will be rung on certain
840 other errors, such as typing an invalid character.
841 The default is to ring the terminal bell in all
844 -Q or --QUIET or --SILENT
845 Causes totally "quiet" operation: the terminal bell
848 -r or --raw-control-chars
849 Causes "raw" control characters to be displayed.
850 The default is to display control characters using
851 the caret notation; for example, a control-A (octal
852 001) is displayed as "^A". Warning: when the -r
856 Version 371: 26 Dec 2001 13
865 option is used, _
\bl_
\be_
\bs_
\bs cannot keep track of the
866 actual appearance of the screen (since this depends
867 on how the screen responds to each type of control
868 character). Thus, various display problems may
869 result, such as long lines being split in the wrong
872 -R or --RAW-CONTROL-CHARS
873 Like -r, but tries to keep track of the screen
874 appearance where possible. This works only if the
875 input consists of normal text and possibly some
876 ANSI "color" escape sequences, which are sequences
881 where the "..." is zero or more characters other
882 than "m". For the purpose of keeping track of
883 screen appearance, all control characters and all
884 ANSI color escape sequences are assumed to not move
885 the cursor. You can make _
\bl_
\be_
\bs_
\bs think that charac
886 ters other than "m" can end ANSI color escape
887 sequences by setting the environment variable
888 LESSANSIENDCHARS to the list of characters which
889 can end a color escape sequence.
891 -s or --squeeze-blank-lines
892 Causes consecutive blank lines to be squeezed into
893 a single blank line. This is useful when viewing
894 _
\bn_
\br_
\bo_
\bf_
\bf output.
896 -S or --chop-long-lines
897 Causes lines longer than the screen width to be
898 chopped rather than folded. That is, the remainder
899 of a long line is simply discarded. The default is
900 to fold long lines; that is, display the remainder
903 -t_
\bt_
\ba_
\bg or --tag=_
\bt_
\ba_
\bg
904 The -t option, followed immediately by a TAG, will
905 edit the file containing that tag. For this to
906 work, tag information must be available; for exam
907 ple, there may be a file in the current directory
908 called "tags", which was previously built by _
\bc_
\bt_
\ba_
\bg_
\bs
909 (1) or an equivalent command. If the environment
910 variable LESSGLOBALTAGS is set, it is taken to be
911 the name of a command compatible with _
\bg_
\bl_
\bo_
\bb_
\ba_
\bl (1),
912 and that command is executed to find the tag. (See
913 http://www.gnu.org/software/global/global.html).
914 The -t option may also be specified from within
915 _
\bl_
\be_
\bs_
\bs (using the - command) as a way of examining a
916 new file. The command ":t" is equivalent to speci
917 fying -t from within _
\bl_
\be_
\bs_
\bs_
\b.
922 Version 371: 26 Dec 2001 14
931 -T_
\bt_
\ba_
\bg_
\bs_
\bf_
\bi_
\bl_
\be or --tag-file=_
\bt_
\ba_
\bg_
\bs_
\bf_
\bi_
\bl_
\be
932 Specifies a tags file to be used instead of "tags".
934 -u or --underline-special
935 Causes backspaces and carriage returns to be
936 treated as printable characters; that is, they are
937 sent to the terminal when they appear in the input.
939 -U or --UNDERLINE-SPECIAL
940 Causes backspaces, tabs and carriage returns to be
941 treated as control characters; that is, they are
942 handled as specified by the -r option.
944 By default, if neither -u nor -U is given,
945 backspaces which appear adjacent to an underscore
946 character are treated specially: the underlined
947 text is displayed using the terminal's hardware
948 underlining capability. Also, backspaces which
949 appear between two identical characters are treated
950 specially: the overstruck text is printed using the
951 terminal's hardware boldface capability. Other
952 backspaces are deleted, along with the preceding
953 character. Carriage returns immediately followed
954 by a newline are deleted. other carriage returns
955 are handled as specified by the -r option. Text
956 which is overstruck or underlined can be searched
957 for if neither -u nor -U is in effect.
960 Displays the version number of _
\bl_
\be_
\bs_
\bs_
\b.
962 -w or --hilite-unread
963 Temporarily highlights the first "new" line after a
964 forward movement of a full page. The first "new"
965 line is the line immediately following the line
966 previously at the bottom of the screen. Also high
967 lights the target line after a g or p command. The
968 highlight is removed at the next command which
969 causes movement. The entire line is highlighted,
970 unless the -J option is in effect, in which case
971 only the status column is highlighted.
973 -W or --HILITE-UNREAD
974 Like -w, but temporarily highlights the first new
975 line after any forward movement command larger than
978 -x_
\bn,... or --tabs=_
\bn,...
979 Sets tab stops. If only one _
\bn is specified, tab
980 stops are set at multiples of _
\bn. If multiple val
981 ues separated by commas are specified, tab stops
982 are set at those positions, and then continue with
983 the same spacing as the last two. For example,
984 _
\b-_
\bx_
\b9_
\b,_
\b1_
\b7 will set tabs at positions 9, 17, 25, 33,
988 Version 371: 26 Dec 2001 15
997 etc. The default for _
\bn is 8.
1000 Disables sending the termcap initialization and
1001 deinitialization strings to the terminal. This is
1002 sometimes desirable if the deinitialization string
1003 does something unnecessary, like clearing the
1007 Disables sending the keypad initialization and
1008 deinitialization strings to the terminal. This is
1009 sometimes useful if the keypad strings make the
1010 numeric keypad behave in an undesirable manner.
1012 -y_
\bn or --max-forw-scroll=_
\bn
1013 Specifies a maximum number of lines to scroll for
1014 ward. If it is necessary to scroll forward more
1015 than _
\bn lines, the screen is repainted instead. The
1016 -c or -C option may be used to repaint from the top
1017 of the screen if desired. By default, any forward
1018 movement causes scrolling.
1020 -[z]_
\bn or --window=_
\bn
1021 Changes the default scrolling window size to _
\bn
1022 lines. The default is one screenful. The z and w
1023 commands can also be used to change the window
1024 size. The "z" may be omitted for compatibility
1025 with _
\bm_
\bo_
\br_
\be_
\b. If the number _
\bn is negative, it indi
1026 cates _
\bn lines less than the current screen size.
1027 For example, if the screen is 24 lines, _
\b-_
\bz_
\b-_
\b4 sets
1028 the scrolling window to 20 lines. If the screen is
1029 resized to 40 lines, the scrolling window automati
1030 cally changes to 36 lines.
1032 -"_
\bc_
\bc or --quotes=_
\bc_
\bc
1033 Changes the filename quoting character. This may
1034 be necessary if you are trying to name a file which
1035 contains both spaces and quote characters. Fol
1036 lowed by a single character, this changes the quote
1037 character to that character. Filenames containing
1038 a space should then be surrounded by that character
1039 rather than by double quotes. Followed by two
1040 characters, changes the open quote to the first
1041 character, and the close quote to the second char
1042 acter. Filenames containing a space should then be
1043 preceded by the open quote character and followed
1044 by the close quote character. Note that even after
1045 the quote characters are changed, this option
1046 remains -" (a dash followed by a double quote).
1049 Normally lines after end of file are displayed as a
1050 single tilde (~). This option causes lines after
1054 Version 371: 26 Dec 2001 16
1063 end of file to be displayed as blank lines.
1066 Specifies the default number of positions to scroll
1067 horizontally in the RIGHTARROW and LEFTARROW com
1068 mands. If the number specified is zero, it sets
1069 the default number of positions to one half of the
1072 -- A command line argument of "--" marks the end of
1073 option arguments. Any arguments following this are
1074 interpreted as filenames. This can be useful when
1075 viewing a file whose name begins with a "-" or "+".
1077 + If a command line option begins with +
\b+, the remain
1078 der of that option is taken to be an initial com
1079 mand to _
\bl_
\be_
\bs_
\bs_
\b. For example, +G tells _
\bl_
\be_
\bs_
\bs to start
1080 at the end of the file rather than the beginning,
1081 and +/xyz tells it to start at the first occurrence
1082 of "xyz" in the file. As a special case, +<number>
1083 acts like +<number>g; that is, it starts the dis
1084 play at the specified line number (however, see the
1085 caveat under the "g" command above). If the option
1086 starts with ++, the initial command applies to
1087 every file being viewed, not just the first one.
1088 The + command described previously may also be used
1089 to set (or change) an initial command for every
1093 L
\bLI
\bIN
\bNE
\bE E
\bED
\bDI
\bIT
\bTI
\bIN
\bNG
\bG
1094 When entering command line at the bottom of the screen
1095 (for example, a filename for the :e command, or the pat
1096 tern for a search command), certain keys can be used to
1097 manipulate the command line. Most commands have an alter
1098 nate form in [ brackets ] which can be used if a key does
1099 not exist on a particular keyboard. (The bracketed forms
1100 do not work in the MS-DOS version.) Any of these special
1101 keys may be entered literally by preceding it with the
1102 "literal" character, either ^V or ^A. A backslash itself
1103 may also be entered literally by entering two backslashes.
1106 Move the cursor one space to the left.
1108 RIGHTARROW [ ESC-l ]
1109 Move the cursor one space to the right.
1111 ^LEFTARROW [ ESC-b or ESC-LEFTARROW ]
1112 (That is, CONTROL and LEFTARROW simultaneously.)
1113 Move the cursor one word to the left.
1115 ^RIGHTARROW [ ESC-w or ESC-RIGHTARROW ]
1116 (That is, CONTROL and RIGHTARROW simultaneously.)
1120 Version 371: 26 Dec 2001 17
1129 Move the cursor one word to the right.
1132 Move the cursor to the beginning of the line.
1135 Move the cursor to the end of the line.
1138 Delete the character to the left of the cursor, or
1139 cancel the command if the command line is empty.
1142 Delete the character under the cursor.
1144 ^BACKSPACE [ ESC-BACKSPACE ]
1145 (That is, CONTROL and BACKSPACE simultaneously.)
1146 Delete the word to the left of the cursor.
1148 ^DELETE [ ESC-X or ESC-DELETE ]
1149 (That is, CONTROL and DELETE simultaneously.)
1150 Delete the word under the cursor.
1153 Retrieve the previous command line.
1156 Retrieve the next command line.
1158 TAB Complete the partial filename to the left of the
1159 cursor. If it matches more than one filename, the
1160 first match is entered into the command line.
1161 Repeated TABs will cycle thru the other matching
1162 filenames. If the completed filename is a direc
1163 tory, a "/" is appended to the filename. (On MS-
1164 DOS systems, a "\" is appended.) The environment
1165 variable LESSSEPARATOR can be used to specify a
1166 different character to append to a directory name.
1169 Like, TAB, but cycles in the reverse direction thru
1170 the matching filenames.
1172 ^L Complete the partial filename to the left of the
1173 cursor. If it matches more than one filename, all
1174 matches are entered into the command line (if they
1177 ^U (Unix and OS/2) or ESC (MS-DOS)
1178 Delete the entire command line, or cancel the com
1179 mand if the command line is empty. If you have
1180 changed your line-kill character in Unix to some
1181 thing other than ^U, that character is used instead
1186 Version 371: 26 Dec 2001 18
1195 K
\bKE
\bEY
\bY B
\bBI
\bIN
\bND
\bDI
\bIN
\bNG
\bGS
\bS
1196 You may define your own _
\bl_
\be_
\bs_
\bs commands by using the program
1197 _
\bl_
\be_
\bs_
\bs_
\bk_
\be_
\by (1) to create a lesskey file. This file specifies
1198 a set of command keys and an action associated with each
1199 key. You may also use _
\bl_
\be_
\bs_
\bs_
\bk_
\be_
\by to change the line-editing
1200 keys (see LINE EDITING), and to set environment variables.
1201 If the environment variable LESSKEY is set, _
\bl_
\be_
\bs_
\bs uses that
1202 as the name of the lesskey file. Otherwise, _
\bl_
\be_
\bs_
\bs looks in
1203 a standard place for the lesskey file: On Unix systems,
1204 _
\bl_
\be_
\bs_
\bs looks for a lesskey file called "$HOME/.less". On
1205 MS-DOS and Windows systems, _
\bl_
\be_
\bs_
\bs looks for a lesskey file
1206 called "$HOME/_less", and if it is not found there, then
1207 looks for a lesskey file called "_less" in any directory
1208 specified in the PATH environment variable. On OS/2 sys
1209 tems, _
\bl_
\be_
\bs_
\bs looks for a lesskey file called
1210 "$HOME/less.ini", and if it is not found, then looks for a
1211 lesskey file called "less.ini" in any directory specified
1212 in the INIT environment variable, and if it not found
1213 there, then looks for a lesskey file called "less.ini" in
1214 any directory specified in the PATH environment variable.
1215 See the _
\bl_
\be_
\bs_
\bs_
\bk_
\be_
\by manual page for more details.
1217 A system-wide lesskey file may also be set up to provide
1218 key bindings. If a key is defined in both a local lesskey
1219 file and in the system-wide file, key bindings in the
1220 local file take precedence over those in the system-wide
1221 file. If the environment variable LESSKEY_SYSTEM is set,
1222 _
\bl_
\be_
\bs_
\bs uses that as the name of the system-wide lesskey
1223 file. Otherwise, _
\bl_
\be_
\bs_
\bs looks in a standard place for the
1224 system-wide lesskey file: On Unix systems, the system-wide
1225 lesskey file is /usr/local/etc/sysless. (However, if _
\bl_
\be_
\bs_
\bs
1226 was built with a different sysconf directory than
1227 /usr/local/etc, that directory is where the sysless file
1228 is found.) On MS-DOS and Windows systems, the system-wide
1229 lesskey file is c:\_sysless. On OS/2 systems, the system-
1230 wide lesskey file is c:\sysless.ini.
1233 I
\bIN
\bNP
\bPU
\bUT
\bT P
\bPR
\bRE
\bEP
\bPR
\bRO
\bOC
\bCE
\bES
\bSS
\bSO
\bOR
\bR
1234 You may define an "input preprocessor" for _
\bl_
\be_
\bs_
\bs_
\b. Before
1235 _
\bl_
\be_
\bs_
\bs opens a file, it first gives your input preprocessor
1236 a chance to modify the way the contents of the file are
1237 displayed. An input preprocessor is simply an executable
1238 program (or shell script), which writes the contents of
1239 the file to a different file, called the replacement file.
1240 The contents of the replacement file are then displayed in
1241 place of the contents of the original file. However, it
1242 will appear to the user as if the original file is opened;
1243 that is, _
\bl_
\be_
\bs_
\bs will display the original filename as the
1244 name of the current file.
1246 An input preprocessor receives one command line argument,
1247 the original filename, as entered by the user. It should
1248 create the replacement file, and when finished, print the
1252 Version 371: 26 Dec 2001 19
1261 name of the replacement file to its standard output. If
1262 the input preprocessor does not output a replacement file
1263 name, _
\bl_
\be_
\bs_
\bs uses the original file, as normal. The input
1264 preprocessor is not called when viewing standard input.
1265 To set up an input preprocessor, set the LESSOPEN environ
1266 ment variable to a command line which will invoke your
1267 input preprocessor. This command line should include one
1268 occurrence of the string "%s", which will be replaced by
1269 the filename when the input preprocessor command is
1272 When _
\bl_
\be_
\bs_
\bs closes a file opened in such a way, it will call
1273 another program, called the input postprocessor, which may
1274 perform any desired clean-up action (such as deleting the
1275 replacement file created by LESSOPEN). This program
1276 receives two command line arguments, the original filename
1277 as entered by the user, and the name of the replacement
1278 file. To set up an input postprocessor, set the LESSCLOSE
1279 environment variable to a command line which will invoke
1280 your input postprocessor. It may include two occurrences
1281 of the string "%s"; the first is replaced with the origi
1282 nal name of the file and the second with the name of the
1283 replacement file, which was output by LESSOPEN.
1285 For example, on many Unix systems, these two scripts will
1286 allow you to keep files in compressed format, but still
1287 let _
\bl_
\be_
\bs_
\bs view them directly:
1292 *.Z) uncompress -c $1 >/tmp/less.$$ 2>/dev/null
1293 if [ -s /tmp/less.$$ ]; then
1305 To use these scripts, put them both where they can be exe
1306 cuted and set LESSOPEN="lessopen.sh %s", and
1307 LESSCLOSE="lessclose.sh %s %s". More complex LESSOPEN and
1308 LESSCLOSE scripts may be written to accept other types of
1309 compressed files, and so on.
1311 It is also possible to set up an input preprocessor to
1312 pipe the file data directly to _
\bl_
\be_
\bs_
\bs_
\b, rather than putting
1313 the data into a replacement file. This avoids the need to
1314 decompress the entire file before starting to view it. An
1318 Version 371: 26 Dec 2001 20
1327 input preprocessor that works this way is called an input
1328 pipe. An input pipe, instead of writing the name of a
1329 replacement file on its standard output, writes the entire
1330 contents of the replacement file on its standard output.
1331 If the input pipe does not write any characters on its
1332 standard output, then there is no replacement file and
1333 _
\bl_
\be_
\bs_
\bs uses the original file, as normal. To use an input
1334 pipe, make the first character in the LESSOPEN environment
1335 variable a vertical bar (|) to signify that the input pre
1336 processor is an input pipe.
1338 For example, on many Unix systems, this script will work
1339 like the previous example scripts:
1344 *.Z) uncompress -c $1 2>/dev/null
1348 To use this script, put it where it can be executed and
1349 set LESSOPEN="|lesspipe.sh %s". When an input pipe is
1350 used, a LESSCLOSE postprocessor can be used, but it is
1351 usually not necessary since there is no replacement file
1352 to clean up. In this case, the replacement file name
1353 passed to the LESSCLOSE postprocessor is "-".
1356 N
\bNA
\bAT
\bTI
\bIO
\bON
\bNA
\bAL
\bL C
\bCH
\bHA
\bAR
\bRA
\bAC
\bCT
\bTE
\bER
\bR S
\bSE
\bET
\bTS
\bS
1357 There are three types of characters in the input file:
1360 can be displayed directly to the screen.
1363 should not be displayed directly, but are expected
1364 to be found in ordinary text files (such as
1368 should not be displayed directly and are not
1369 expected to be found in text files.
1371 A "character set" is simply a description of which charac
1372 ters are to be considered normal, control, and binary.
1373 The LESSCHARSET environment variable may be used to select
1374 a character set. Possible values for LESSCHARSET are:
1376 ascii BS, TAB, NL, CR, and formfeed are control charac
1377 ters, all chars with values between 32 and 126 are
1378 normal, and all others are binary.
1384 Version 371: 26 Dec 2001 21
1394 Selects an ISO 8859 character set. This is the
1395 same as ASCII, except characters between 160 and
1396 255 are treated as normal characters.
1398 latin1 Same as iso8859.
1400 latin9 Same as iso8859.
1402 dos Selects a character set appropriate for MS-DOS.
1404 ebcdic Selects an EBCDIC character set.
1407 Selects an EBCDIC character set used by OS/390 Unix
1408 Services. This is the EBCDIC analogue of latin1.
1409 You get similar results by setting either LESS
1410 CHARSET=IBM-1047 or LC_CTYPE=en_US in your environ
1413 koi8-r Selects a Russian character set.
1415 next Selects a character set appropriate for NeXT com
1418 utf-8 Selects the UTF-8 encoding of the ISO 10646 charac
1421 In special cases, it may be desired to tailor _
\bl_
\be_
\bs_
\bs to use
1422 a character set other than the ones definable by LESS
1423 CHARSET. In this case, the environment variable LESS
1424 CHARDEF can be used to define a character set. It should
1425 be set to a string where each character in the string rep
1426 resents one character in the character set. The character
1427 "." is used for a normal character, "c" for control, and
1428 "b" for binary. A decimal number may be used for repeti
1429 tion. For example, "bccc4b." would mean character 0 is
1430 binary, 1, 2 and 3 are control, 4, 5, 6 and 7 are binary,
1431 and 8 is normal. All characters after the last are taken
1432 to be the same as the last, so characters 9 through 255
1433 would be normal. (This is an example, and does not neces
1434 sarily represent any real character set.)
1436 This table shows the value of LESSCHARDEF which is equiva
1437 lent to each of the possible values for LESSCHARSET:
1439 ascii 8bcccbcc18b95.b
1440 dos 8bcccbcc12bc5b95.b.
1441 ebcdic 5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b
1442 9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b.
1443 IBM-1047 4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc
1445 iso8859 8bcccbcc18b95.33b.
1446 koi8-r 8bcccbcc18b95.b128.
1450 Version 371: 26 Dec 2001 22
1459 latin1 8bcccbcc18b95.33b.
1460 next 8bcccbcc18b95.bb125.bb
1462 If neither LESSCHARSET nor LESSCHARDEF is set, but the
1463 string "UTF-8" is found in the LC_ALL, LC_TYPE or LANG
1464 environment variables, then the default character set is
1467 If that string is not found, but your system supports the
1468 _
\bs_
\be_
\bt_
\bl_
\bo_
\bc_
\ba_
\bl_
\be interface, _
\bl_
\be_
\bs_
\bs will use setlocale to determine
1469 the character set. setlocale is controlled by setting the
1470 LANG or LC_CTYPE environment variables.
1472 Finally, if the _
\bs_
\be_
\bt_
\bl_
\bo_
\bc_
\ba_
\bl_
\be interface is also not available,
1473 the default character set is latin1.
1475 Control and binary characters are displayed in standout
1476 (reverse video). Each such character is displayed in
1477 caret notation if possible (e.g. ^A for control-A). Caret
1478 notation is used only if inverting the 0100 bit results in
1479 a normal printable character. Otherwise, the character is
1480 displayed as a hex number in angle brackets. This format
1481 can be changed by setting the LESSBINFMT environment vari
1482 able. LESSBINFMT may begin with a "*" and one character
1483 to select the display attribute: "*k" is blinking, "*d" is
1484 bold, "*u" is underlined, "*s" is standout, and "*n" is
1485 normal. If LESSBINFMT does not begin with a "*", normal
1486 attribute is assumed. The remainder of LESSBINFMT is a
1487 string which may include one printf-style escape sequence
1488 (a % followed by x, X, o, d, etc.). For example, if LESS
1489 BINFMT is "*u[%x]", binary characters are displayed in
1490 underlined hexadecimal surrounded by brackets. The
1491 default if no LESSBINFMT is specified is "*s<%X>".
1494 P
\bPR
\bRO
\bOM
\bMP
\bPT
\bTS
\bS
1495 The -P option allows you to tailor the prompt to your
1496 preference. The string given to the -P option replaces
1497 the specified prompt string. Certain characters in the
1498 string are interpreted specially. The prompt mechanism is
1499 rather complicated to provide flexibility, but the ordi
1500 nary user need not understand the details of constructing
1501 personalized prompt strings.
1503 A percent sign followed by a single character is expanded
1504 according to what the following character is:
1506 %b_
\bX Replaced by the byte offset into the current input
1507 file. The b is followed by a single character
1508 (shown as _
\bX above) which specifies the line whose
1509 byte offset is to be used. If the character is a
1510 "t", the byte offset of the top line in the display
1511 is used, an "m" means use the middle line, a "b"
1512 means use the bottom line, a "B" means use the line
1516 Version 371: 26 Dec 2001 23
1525 just after the bottom line, and a "j" means use the
1526 "target" line, as specified by the -j option.
1528 %B Replaced by the size of the current input file.
1530 %c Replaced by the column number of the text appearing
1531 in the first column of the screen.
1533 %d_
\bX Replaced by the page number of a line in the input
1534 file. The line to be used is determined by the _
\bX,
1535 as with the %b option.
1537 %D Replaced by the number of pages in the input file,
1538 or equivalently, the page number of the last line
1541 %E Replaced by the name of the editor (from the VISUAL
1542 environment variable, or the EDITOR environment
1543 variable if VISUAL is not defined). See the dis
1544 cussion of the LESSEDIT feature below.
1546 %f Replaced by the name of the current input file.
1548 %i Replaced by the index of the current file in the
1549 list of input files.
1551 %l_
\bX Replaced by the line number of a line in the input
1552 file. The line to be used is determined by the _
\bX,
1553 as with the %b option.
1555 %L Replaced by the line number of the last line in the
1558 %m Replaced by the total number of input files.
1560 %p_
\bX Replaced by the percent into the current input
1561 file, based on byte offsets. The line used is
1562 determined by the _
\bX as with the %b option.
1564 %P_
\bX Replaced by the percent into the current input
1565 file, based on line numbers. The line used is
1566 determined by the _
\bX as with the %b option.
1570 %t Causes any trailing spaces to be removed. Usually
1571 used at the end of the string, but may appear any
1574 %x Replaced by the name of the next input file in the
1577 If any item is unknown (for example, the file size if
1578 input is a pipe), a question mark is printed instead.
1582 Version 371: 26 Dec 2001 24
1591 The format of the prompt string can be changed depending
1592 on certain conditions. A question mark followed by a sin
1593 gle character acts like an "IF": depending on the follow
1594 ing character, a condition is evaluated. If the condition
1595 is true, any characters following the question mark and
1596 condition character, up to a period, are included in the
1597 prompt. If the condition is false, such characters are
1598 not included. A colon appearing between the question mark
1599 and the period can be used to establish an "ELSE": any
1600 characters between the colon and the period are included
1601 in the string if and only if the IF condition is false.
1602 Condition characters (which follow a question mark) may
1605 ?a True if any characters have been included in the
1608 ?b_
\bX True if the byte offset of the specified line is
1611 ?B True if the size of current input file is known.
1613 ?c True if the text is horizontally shifted (%c is not
1616 ?d_
\bX True if the page number of the specified line is
1619 ?e True if at end-of-file.
1621 ?f True if there is an input filename (that is, if
1622 input is not a pipe).
1624 ?l_
\bX True if the line number of the specified line is
1627 ?L True if the line number of the last line in the
1630 ?m True if there is more than one input file.
1632 ?n True if this is the first prompt in a new input
1635 ?p_
\bX True if the percent into the current input file,
1636 based on byte offsets, of the specified line is
1639 ?P_
\bX True if the percent into the current input file,
1640 based on line numbers, of the specified line is
1648 Version 371: 26 Dec 2001 25
1657 ?x True if there is a next input file (that is, if the
1658 current input file is not the last one).
1660 Any characters other than the special ones (question mark,
1661 colon, period, percent, and backslash) become literally
1662 part of the prompt. Any of the special characters may be
1663 included in the prompt literally by preceding it with a
1668 ?f%f:Standard input.
1670 This prompt prints the filename, if known; otherwise the
1671 string "Standard input".
1673 ?f%f .?ltLine %lt:?pt%pt\%:?btByte %bt:-...
1675 This prompt would print the filename, if known. The file
1676 name is followed by the line number, if known, otherwise
1677 the percent if known, otherwise the byte offset if known.
1678 Otherwise, a dash is printed. Notice how each question
1679 mark has a matching period, and how the % after the %pt is
1680 included literally by escaping it with a backslash.
1682 ?n?f%f .?m(file %i of %m) ..?e(END) ?x- Next\: %x..%t
1684 This prints the filename if this is the first prompt in a
1685 file, followed by the "file N of N" message if there is
1686 more than one input file. Then, if we are at end-of-file,
1687 the string "(END)" is printed followed by the name of the
1688 next file, if there is one. Finally, any trailing spaces
1689 are truncated. This is the default prompt. For refer
1690 ence, here are the defaults for the other two prompts (-m
1691 and -M respectively). Each is broken into two lines here
1692 for readability only.
1694 ?n?f%f .?m(file %i of %m) ..?e(END) ?x- Next\: %x.:
1695 ?pB%pB\%:byte %bB?s/%s...%t
1697 ?f%f .?n?m(file %i of %m) ..?ltlines %lt-%lb?L/%L. :
1698 byte %bB?s/%s. .?e(END) ?x- Next\: %x.:?pB%pB\%..%t
1700 And here is the default message produced by the = command:
1702 ?f%f .?m(file %i of %m) .?ltlines %lt-%lb?L/%L. .
1703 byte %bB?s/%s. ?e(END) :?pB%pB\%..%t
1705 The prompt expansion features are also used for another
1706 purpose: if an environment variable LESSEDIT is defined,
1707 it is used as the command to be executed when the v com
1708 mand is invoked. The LESSEDIT string is expanded in the
1709 same way as the prompt strings. The default value for
1714 Version 371: 26 Dec 2001 26
1725 Note that this expands to the editor name, followed by a +
1726 and the line number, followed by the file name. If your
1727 editor does not accept the "+linenumber" syntax, or has
1728 other differences in invocation syntax, the LESSEDIT vari
1729 able can be changed to modify this default.
1732 S
\bSE
\bEC
\bCU
\bUR
\bRI
\bIT
\bTY
\bY
1733 When the environment variable LESSSECURE is set to 1, _
\bl_
\be_
\bs_
\bs
1734 runs in a "secure" mode. This means these features are
1741 :e the examine command.
1743 v the editing command
1747 -k use of lesskey files
1749 -t use of tags files
1751 metacharacters in filenames, such as *
1753 filename completion (TAB, ^L)
1755 Less can also be compiled to be permanently in "secure"
1759 E
\bEN
\bNV
\bVI
\bIR
\bRO
\bON
\bNM
\bME
\bEN
\bNT
\bT V
\bVA
\bAR
\bRI
\bIA
\bAB
\bBL
\bLE
\bES
\bS
1760 Environment variables may be specified either in the sys
1761 tem environment as usual, or in a _
\bl_
\be_
\bs_
\bs_
\bk_
\be_
\by (1) file. If
1762 environment variables are defined in more than one place,
1763 variables defined in a local lesskey file take precedence
1764 over variables defined in the system environment, which
1765 take precedence over variables defined in the system-wide
1769 Sets the number of columns on the screen. Takes
1770 precedence over the number of columns specified by
1771 the TERM variable. (But if you have a windowing
1772 system which supports TIOCGWINSZ or WIOCGETD, the
1773 window system's idea of the screen size takes
1774 precedence over the LINES and COLUMNS environment
1780 Version 371: 26 Dec 2001 27
1789 EDITOR The name of the editor (used for the v command).
1791 HOME Name of the user's home directory (used to find a
1792 lesskey file on Unix and OS/2 systems).
1795 Concatenation of the HOMEDRIVE and HOMEPATH envi
1796 ronment variables is the name of the user's home
1797 directory if the HOME variable is not set (only in
1798 the Windows version).
1800 INIT Name of the user's init directory (used to find a
1801 lesskey file on OS/2 systems).
1803 LANG Language for determining the character set.
1806 Language for determining the character set.
1808 LESS Options which are passed to _
\bl_
\be_
\bs_
\bs automatically.
1811 Characters which are assumed to end an ANSI color
1812 escape sequence (default "m").
1815 Format for displaying non-printable, non-control
1819 Defines a character set.
1822 Selects a predefined character set.
1825 Command line to invoke the (optional) input-post
1829 Name of the lessecho program (default "lessecho").
1830 The lessecho program is needed to expand metachar
1831 acters, such as * and ?, in filenames on Unix sys
1835 Editor prototype string (used for the v command).
1836 See discussion under PROMPTS.
1839 Name of the command used by the -t option to find
1840 global tags. Normally should be set to "global" if
1841 your system has the _
\bg_
\bl_
\bo_
\bb_
\ba_
\bl (1) command. If not
1842 set, global tags are not used.
1846 Version 371: 26 Dec 2001 28
1856 Name of the default lesskey(1) file.
1859 Name of the default system-wide lesskey(1) file.
1862 List of characters which are considered "metachar
1863 acters" by the shell.
1866 Prefix which less will add before each metacharac
1867 ter in a command sent to the shell. If LESS
1868 METAESCAPE is an empty string, commands containing
1869 metacharacters will not be passed to the shell.
1872 Command line to invoke the (optional) input-prepro
1876 Runs less in "secure" mode. See discussion under
1880 String to be appended to a directory name in file
1883 LINES Sets the number of lines on the screen. Takes
1884 precedence over the number of lines specified by
1885 the TERM variable. (But if you have a windowing
1886 system which supports TIOCGWINSZ or WIOCGETD, the
1887 window system's idea of the screen size takes
1888 precedence over the LINES and COLUMNS environment
1891 PATH User's search path (used to find a lesskey file on
1892 MS-DOS and OS/2 systems).
1894 SHELL The shell used to execute the ! command, as well as
1895 to expand filenames.
1897 TERM The type of terminal on which _
\bl_
\be_
\bs_
\bs is being run.
1899 VISUAL The name of the editor (used for the v command).
1902 S
\bSE
\bEE
\bE A
\bAL
\bLS
\bSO
\bO
1906 W
\bWA
\bAR
\bRN
\bNI
\bIN
\bNG
\bGS
\bS
1907 The = command and prompts (unless changed by -P) report
1908 the line numbers of the lines at the top and bottom of the
1912 Version 371: 26 Dec 2001 29
1921 screen, but the byte and percent of the line after the one
1922 at the bottom of the screen.
1924 If the :e command is used to name more than one file, and
1925 one of the named files has been viewed previously, the new
1926 files may be entered into the list in an unexpected order.
1928 On certain older terminals (the so-called "magic cookie"
1929 terminals), search highlighting will cause an erroneous
1930 display. On such terminals, search highlighting is dis
1931 abled by default to avoid possible problems.
1933 In certain cases, when search highlighting is enabled and
1934 a search pattern begins with a ^, more text than the
1935 matching string may be highlighted. (This problem does
1936 not occur when less is compiled to use the POSIX regular
1937 expression package.)
1939 When viewing text containing ANSI color escape sequences
1940 using the -R option, searching will not find text contain
1941 ing an embedded escape sequence. Also, search highlight
1942 ing may change the color of some of the text which follows
1943 the highlighted text.
1945 On some systems, _
\bs_
\be_
\bt_
\bl_
\bo_
\bc_
\ba_
\bl_
\be claims that ASCII characters 0
1946 thru 31 are control characters rather than binary charac
1947 ters. This causes _
\bl_
\be_
\bs_
\bs to treat some binary files as
1948 ordinary, non-binary files. To workaround this problem,
1949 set the environment variable LESSCHARSET to "ascii" (or
1950 whatever character set is appropriate).
1952 See http://www.greenwoodsoftware.com/less for the latest
1953 list of known bugs in this version of less.
1956 C
\bCO
\bOP
\bPY
\bYR
\bRI
\bIG
\bGH
\bHT
\bT
1957 Copyright (C) 2001 Mark Nudelman
1959 less is part of the GNU project and is free software. You
1960 can redistribute it and/or modify it under the terms of
1961 either (1) the GNU General Public License as published by
1962 the Free Software Foundation; or (2) the Less License.
1963 See the file README in the less distribution for more
1964 details regarding redistribution. You should have
1965 received a copy of the GNU General Public License along
1966 with the source for less; see the file COPYING. If not,
1967 write to the Free Software Foundation, 59 Temple Place,
1968 Suite 330, Boston, MA 02111-1307, USA. You should also
1969 have received a copy of the Less License; see the file
1972 less is distributed in the hope that it will be useful,
1973 but WITHOUT ANY WARRANTY; without even the implied war
1974 ranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
1978 Version 371: 26 Dec 2001 30
1987 PURPOSE. See the GNU General Public License for more
1991 A
\bAU
\bUT
\bTH
\bHO
\bOR
\bR
1992 Mark Nudelman <markn@greenwoodsoftware.com>
1993 Send bug reports or comments to the above address or to
1995 For more information, see the less homepage at
1996 http://www.greenwoodsoftware.com/less.
2044 Version 371: 26 Dec 2001 31