less.man revision 63128
160786Sps
260786Sps
360786Sps
460786SpsLESS(1)                                                   LESS(1)
560786Sps
660786Sps
760786SpsNNAAMMEE
860786Sps       less - opposite of more
960786Sps
1060786SpsSSYYNNOOPPSSIISS
1160786Sps       lleessss --??
1260786Sps       lleessss ----hheellpp
1360786Sps       lleessss --VV
1460786Sps       lleessss ----vveerrssiioonn
1560786Sps       lleessss [[--[[++]]aaBBccCCddeeEEffggGGiiIImmMMnnNNqqQQrrssSSuuUUVVwwXX]]
1660786Sps            [[--bb _b_u_f_s]] [[--hh _l_i_n_e_s]] [[--jj _l_i_n_e]] [[--kk _k_e_y_f_i_l_e]]
1760786Sps            [[--{{ooOO}} _l_o_g_f_i_l_e]] [[--pp _p_a_t_t_e_r_n]] [[--PP _p_r_o_m_p_t]] [[--tt _t_a_g]]
1860786Sps            [[--TT _t_a_g_s_f_i_l_e]] [[--xx _t_a_b]] [[--yy _l_i_n_e_s]] [[--[[zz]] _l_i_n_e_s]]
1960786Sps            [[++[[++]]_c_m_d]] [[----]] [[_f_i_l_e_n_a_m_e]]......
2060786Sps       (See  the OPTIONS section for alternate option syntax with
2160786Sps       long option names.)
2260786Sps
2360786Sps
2460786SpsDDEESSCCRRIIPPTTIIOONN
2560786Sps       _L_e_s_s is a program similar to _m_o_r_e (1),  but  which  allows
2660786Sps       backward movement in the file as well as forward movement.
2760786Sps       Also, _l_e_s_s does not have to read  the  entire  input  file
2860786Sps       before  starting,  so  with large input files it starts up
2960786Sps       faster than text editors like _v_i (1).  _L_e_s_s  uses  termcap
3060786Sps       (or  terminfo on some systems), so it can run on a variety
3160786Sps       of terminals.  There is even limited support for  hardcopy
3260786Sps       terminals.  (On a hardcopy terminal, lines which should be
3360786Sps       printed at the top of  the  screen  are  prefixed  with  a
3460786Sps       caret.)
3560786Sps
3660786Sps       Commands  are  based on both _m_o_r_e and _v_i_.  Commands may be
3760786Sps       preceded by a decimal number, called N in the descriptions
3860786Sps       below.  The number is used by some commands, as indicated.
3960786Sps
4060786Sps
4160786SpsCCOOMMMMAANNDDSS
4260786Sps       In the following descriptions, ^X  means  control-X.   ESC
4360786Sps       stands for the ESCAPE key; for example ESC-v means the two
4460786Sps       character sequence "ESCAPE", then "v".
4560786Sps
4660786Sps       h or H Help: display a summary of these commands.  If  you
4760786Sps              forget all the other commands, remember this one.
4860786Sps
4960786Sps       SPACE or ^V or f or ^F
5060786Sps              Scroll  forward  N  lines,  default one window (see
5160786Sps              option -z below).  If N is  more  than  the  screen
5260786Sps              size, only the final screenful is displayed.  Warn-
5360786Sps              ing: some systems use ^V as a  special  literaliza-
5460786Sps              tion character.
5560786Sps
5660786Sps       z      Like  SPACE,  but if N is specified, it becomes the
5760786Sps              new window size.
5860786Sps
5960786Sps       ESC-SPACE
6060786Sps              Like SPACE, but scrolls a full screenful,  even  if
6160786Sps
6260786Sps
6360786Sps
6463128Sps                     Version 358: 08 Jul 2000                   1
6560786Sps
6660786Sps
6760786Sps
6860786Sps
6960786Sps
7060786SpsLESS(1)                                                   LESS(1)
7160786Sps
7260786Sps
7360786Sps              it reaches end-of-file in the process.
7460786Sps
7560786Sps       RETURN or ^N or e or ^E or j or ^J
7660786Sps              Scroll  forward  N  lines, default 1.  The entire N
7760786Sps              lines are displayed, even if N  is  more  than  the
7860786Sps              screen size.
7960786Sps
8060786Sps       d or ^D
8160786Sps              Scroll  forward  N  lines,  default one half of the
8260786Sps              screen size.  If N is specified, it becomes the new
8360786Sps              default for subsequent d and u commands.
8460786Sps
8560786Sps       b or ^B or ESC-v
8660786Sps              Scroll  backward  N  lines, default one window (see
8760786Sps              option -z below).  If N is  more  than  the  screen
8860786Sps              size, only the final screenful is displayed.
8960786Sps
9060786Sps       w      Like  ESC-v,  but if N is specified, it becomes the
9160786Sps              new window size.
9260786Sps
9360786Sps       y or ^Y or ^P or k or ^K
9460786Sps              Scroll backward N lines, default 1.  The  entire  N
9560786Sps              lines  are  displayed,  even  if N is more than the
9660786Sps              screen size.  Warning: some systems  use  ^Y  as  a
9760786Sps              special job control character.
9860786Sps
9960786Sps       u or ^U
10060786Sps              Scroll  backward  N  lines, default one half of the
10160786Sps              screen size.  If N is specified, it becomes the new
10260786Sps              default for subsequent d and u commands.
10360786Sps
10460786Sps       ESC-) or RIGHTARROW
10563128Sps              Scroll  horizontally  right  N  characters, default
10663128Sps              half the screen width (see the -#  option).   While
10763128Sps              the  text  is  scrolled,  it  acts as though the -S
10863128Sps              option (chop lines) were in effect.  Note  that  if
10963128Sps              you  wish  to enter a number N, you must use ESC-),
11063128Sps              not RIGHTARROW, because the arrow is taken to be  a
11163128Sps              line  editing  command  (see  the LINE EDITING sec-
11263128Sps              tion).
11360786Sps
11460786Sps       ESC-( or LEFTARROW
11563128Sps              Scroll horizontally left N characters, default half
11663128Sps              the screen width (see the -# option).
11760786Sps
11860786Sps       r or ^R or ^L
11960786Sps              Repaint the screen.
12060786Sps
12163128Sps       R      Repaint  the screen, discarding any buffered input.
12263128Sps              Useful if the file is changing while  it  is  being
12360786Sps              viewed.
12460786Sps
12563128Sps       F      Scroll  forward,  and  keep trying to read when the
12663128Sps              end of file  is  reached.   Normally  this  command
12760786Sps
12860786Sps
12960786Sps
13063128Sps                     Version 358: 08 Jul 2000                   2
13160786Sps
13260786Sps
13360786Sps
13460786Sps
13560786Sps
13660786SpsLESS(1)                                                   LESS(1)
13760786Sps
13860786Sps
13963128Sps              would  be used when already at the end of the file.
14063128Sps              It is a way to monitor the tail of a file which  is
14163128Sps              growing while it is being viewed.  (The behavior is
14260786Sps              similar to the "tail -f" command.)
14360786Sps
14460786Sps       g or < or ESC-<
14563128Sps              Go to line N in the file, default 1  (beginning  of
14663128Sps              file).   (Warning: this may be slow if N is large.)
14760786Sps
14860786Sps       G or > or ESC->
14963128Sps              Go to line N in the file, default the  end  of  the
15060786Sps              file.  (Warning: this may be slow if N is large, or
15163128Sps              if N is not specified and  standard  input,  rather
15260786Sps              than a file, is being read.)
15360786Sps
15460786Sps       p or % Go to a position N percent into the file.  N should
15560786Sps              be between 0 and 100.
15660786Sps
15763128Sps       {      If a left curly bracket appears  in  the  top  line
15863128Sps              displayed  on  the screen, the { command will go to
15963128Sps              the matching right  curly  bracket.   The  matching
16063128Sps              right  curly  bracket  is  positioned on the bottom
16160786Sps              line of the screen.  If there is more than one left
16263128Sps              curly  bracket  on  the top line, a number N may be
16360786Sps              used to specify the N-th bracket on the line.
16460786Sps
16560786Sps       }      If a right curly bracket appears in the bottom line
16663128Sps              displayed  on  the screen, the } command will go to
16760786Sps              the matching left curly bracket.  The matching left
16863128Sps              curly  bracket is positioned on the top line of the
16963128Sps              screen.  If there is  more  than  one  right  curly
17063128Sps              bracket  on the top line, a number N may be used to
17160786Sps              specify the N-th bracket on the line.
17260786Sps
17363128Sps       (      Like {, but  applies  to  parentheses  rather  than
17460786Sps              curly brackets.
17560786Sps
17663128Sps       )      Like  },  but  applies  to  parentheses rather than
17760786Sps              curly brackets.
17860786Sps
17963128Sps       [      Like {, but applies to square brackets rather  than
18060786Sps              curly brackets.
18160786Sps
18263128Sps       ]      Like  }, but applies to square brackets rather than
18360786Sps              curly brackets.
18460786Sps
18563128Sps       ESC-^F Followed by two characters, acts like {,  but  uses
18663128Sps              the  two  characters  as  open  and close brackets,
18763128Sps              respectively.  For example, "ESC ^F < >"  could  be
18863128Sps              used  to go forward to the > which matches the < in
18960786Sps              the top displayed line.
19060786Sps
19163128Sps       ESC-^B Followed by two characters, acts like },  but  uses
19263128Sps              the  two  characters  as  open  and close brackets,
19360786Sps
19460786Sps
19560786Sps
19663128Sps                     Version 358: 08 Jul 2000                   3
19760786Sps
19860786Sps
19960786Sps
20060786Sps
20160786Sps
20260786SpsLESS(1)                                                   LESS(1)
20360786Sps
20460786Sps
20563128Sps              respectively.  For example, "ESC ^B < >"  could  be
20663128Sps              used to go backward to the < which matches the > in
20763128Sps              the bottom displayed line.
20863128Sps
20960786Sps       m      Followed by any lowercase letter, marks the current
21060786Sps              position with that letter.
21160786Sps
21263128Sps       '      (Single  quote.)  Followed by any lowercase letter,
21360786Sps              returns to the position which was previously marked
21460786Sps              with  that  letter.   Followed  by  another  single
21563128Sps              quote, returns to the position at  which  the  last
21660786Sps              "large" movement command was executed.  Followed by
21760786Sps              a ^ or $, jumps to the beginning or end of the file
21863128Sps              respectively.   Marks are preserved when a new file
21960786Sps              is examined, so the ' command can be used to switch
22060786Sps              between input files.
22160786Sps
22260786Sps       ^X^X   Same as single quote.
22360786Sps
22460786Sps       /pattern
22563128Sps              Search  forward  in the file for the N-th line con-
22660786Sps              taining the pattern.  N defaults to 1.  The pattern
22763128Sps              is  a regular expression, as recognized by _e_d_.  The
22860786Sps              search starts at the second line displayed (but see
22960786Sps              the -a and -j options, which change this).
23060786Sps
23163128Sps              Certain  characters  are  special if entered at the
23263128Sps              beginning of the pattern; they modify the  type  of
23360786Sps              search rather than become part of the pattern:
23460786Sps
23560786Sps              ^N or !
23660786Sps                     Search for lines which do NOT match the pat-
23760786Sps                     tern.
23860786Sps
23960786Sps              ^E or *
24063128Sps                     Search multiple  files.   That  is,  if  the
24163128Sps                     search  reaches  the END of the current file
24263128Sps                     without finding a match, the search  contin-
24363128Sps                     ues  in  the  next  file in the command line
24460786Sps                     list.
24560786Sps
24660786Sps              ^F or @
24763128Sps                     Begin the search at the first  line  of  the
24860786Sps                     FIRST file in the command line list, regard-
24963128Sps                     less of what is currently displayed  on  the
25063128Sps                     screen  or  the  settings  of  the  -a or -j
25160786Sps                     options.
25260786Sps
25360786Sps              ^K     Highlight any text which matches the pattern
25460786Sps                     on the current screen, but don't move to the
25560786Sps                     first match (KEEP current position).
25660786Sps
25760786Sps              ^R     Don't interpret regular expression metachar-
25863128Sps                     acters;   that   is,  do  a  simple  textual
25960786Sps
26060786Sps
26160786Sps
26263128Sps                     Version 358: 08 Jul 2000                   4
26360786Sps
26460786Sps
26560786Sps
26660786Sps
26760786Sps
26860786SpsLESS(1)                                                   LESS(1)
26960786Sps
27060786Sps
27163128Sps                     comparison.
27260786Sps
27363128Sps       ?pattern
27463128Sps              Search backward in the file for the N-th line  con-
27563128Sps              taining the pattern.  The search starts at the line
27663128Sps              immediately before the top line displayed.
27763128Sps
27860786Sps              Certain characters are special as in the / command:
27960786Sps
28060786Sps              ^N or !
28160786Sps                     Search for lines which do NOT match the pat-
28260786Sps                     tern.
28360786Sps
28460786Sps              ^E or *
28563128Sps                     Search multiple  files.   That  is,  if  the
28663128Sps                     search  reaches the beginning of the current
28763128Sps                     file without finding  a  match,  the  search
28863128Sps                     continues  in  the previous file in the com-
28960786Sps                     mand line list.
29060786Sps
29160786Sps              ^F or @
29263128Sps                     Begin the search at the  last  line  of  the
29363128Sps                     last  file in the command line list, regard-
29463128Sps                     less of what is currently displayed  on  the
29563128Sps                     screen  or  the  settings  of  the  -a or -j
29660786Sps                     options.
29760786Sps
29860786Sps              ^K     As in forward searches.
29960786Sps
30060786Sps              ^R     As in forward searches.
30160786Sps
30260786Sps       ESC-/pattern
30360786Sps              Same as "/*".
30460786Sps
30560786Sps       ESC-?pattern
30660786Sps              Same as "?*".
30760786Sps
30863128Sps       n      Repeat previous search, for  N-th  line  containing
30960786Sps              the last pattern.  If the previous search was modi-
31063128Sps              fied by ^N, the search is made for  the  N-th  line
31160786Sps              NOT containing the pattern.  If the previous search
31263128Sps              was modified by ^E, the  search  continues  in  the
31363128Sps              next  (or  previous)  file  if not satisfied in the
31463128Sps              current file.  If the previous search was  modified
31563128Sps              by  ^R,  the  search  is done without using regular
31663128Sps              expressions.  There is no effect  if  the  previous
31760786Sps              search was modified by ^F or ^K.
31860786Sps
31963128Sps       N      Repeat  previous  search, but in the reverse direc-
32060786Sps              tion.
32160786Sps
32263128Sps       ESC-n  Repeat previous search, but  crossing  file  bound-
32363128Sps              aries.   The  effect  is  as if the previous search
32460786Sps              were modified by *.
32560786Sps
32660786Sps
32760786Sps
32863128Sps                     Version 358: 08 Jul 2000                   5
32960786Sps
33060786Sps
33160786Sps
33260786Sps
33360786Sps
33463128SpsLESS(1)                                                   LESS(1)
33560786Sps
33660786Sps
33763128Sps       ESC-N  Repeat previous search, but in the  reverse  direc-
33863128Sps              tion and crossing file boundaries.
33960786Sps
34060786Sps       ESC-u  Undo search highlighting.  Turn off highlighting of
34163128Sps              strings matching the current  search  pattern.   If
34263128Sps              highlighting  is  already off because of a previous
34363128Sps              ESC-u command,  turn  highlighting  back  on.   Any
34460786Sps              search command will also turn highlighting back on.
34563128Sps              (Highlighting can also be disabled by toggling  the
34660786Sps              -G option; in that case search commands do not turn
34760786Sps              highlighting back on.)
34860786Sps
34960786Sps       :e [filename]
35063128Sps              Examine a new file.  If the  filename  is  missing,
35163128Sps              the  "current"  file  (see  the  :n and :p commands
35263128Sps              below) from the list of files in the  command  line
35360786Sps              is re-examined.  A percent sign (%) in the filename
35463128Sps              is replaced by the name of  the  current  file.   A
35563128Sps              pound  sign (#) is replaced by the name of the pre-
35663128Sps              viously examined file.   However,  two  consecutive
35763128Sps              percent  signs  are  simply  replaced with a single
35863128Sps              percent sign.  This allows you to enter a  filename
35963128Sps              that  contains  a  percent sign in the name.  Simi-
36063128Sps              larly, two consecutive  pound  signs  are  replaced
36160786Sps              with a single pound sign.  The filename is inserted
36263128Sps              into the command line list of files so that it  can
36363128Sps              be  seen  by subsequent :n and :p commands.  If the
36463128Sps              filename consists of several files,  they  are  all
36563128Sps              inserted  into  the list of files and the first one
36663128Sps              is examined.  If the filename contains one or  more
36763128Sps              spaces,  the  entire filename should be enclosed in
36860786Sps              double quotes (also see the -" option).
36960786Sps
37060786Sps       ^X^V or E
37160786Sps              Same as :e.  Warning: some systems use ^V as a spe-
37263128Sps              cial  literalization  character.   On such systems,
37360786Sps              you may not be able to use ^V.
37460786Sps
37560786Sps       :n     Examine the next file (from the list of files given
37663128Sps              in  the command line).  If a number N is specified,
37760786Sps              the N-th next file is examined.
37860786Sps
37960786Sps       :p     Examine the previous file in the command line list.
38063128Sps              If  a number N is specified, the N-th previous file
38160786Sps              is examined.
38260786Sps
38363128Sps       :x     Examine the first file in the  command  line  list.
38463128Sps              If  a  number  N is specified, the N-th file in the
38560786Sps              list is examined.
38660786Sps
38760786Sps       :d     Remove the current file from the list of files.
38860786Sps
38960786Sps       = or ^G or :f
39063128Sps              Prints  some  information  about  the  file   being
39160786Sps
39260786Sps
39360786Sps
39463128Sps                     Version 358: 08 Jul 2000                   6
39560786Sps
39660786Sps
39760786Sps
39860786Sps
39960786Sps
40060786SpsLESS(1)                                                   LESS(1)
40160786Sps
40260786Sps
40363128Sps              viewed,  including its name and the line number and
40463128Sps              byte offset of the bottom line being displayed.  If
40563128Sps              possible,  it  also  prints the length of the file,
40663128Sps              the number of lines in the file and the percent  of
40760786Sps              the file above the last displayed line.
40860786Sps
40963128Sps       -      Followed  by one of the command line option letters
41063128Sps              (see OPTIONS below), this will change  the  setting
41163128Sps              of  that  option and print a message describing the
41263128Sps              new setting.  If a ^P (CONTROL-P) is entered  imme-
41363128Sps              diately  after  the dash, the setting of the option
41463128Sps              is changed but  no  message  is  printed.   If  the
41563128Sps              option  letter  has  a numeric value (such as -b or
41663128Sps              -h), or a string value (such as -P or  -t),  a  new
41763128Sps              value  may  be entered after the option letter.  If
41863128Sps              no new value is entered, a message  describing  the
41963128Sps              current  setting is printed and nothing is changed.
42060786Sps
42163128Sps       --     Like the - command, but takes a  long  option  name
42263128Sps              (see  OPTIONS  below)  rather  than a single option
42363128Sps              letter.  You must press  RETURN  after  typing  the
42463128Sps              option  name.   A  ^P  immediately after the second
42563128Sps              dash suppresses printing of  a  message  describing
42660786Sps              the new setting, as in the - command.
42760786Sps
42863128Sps       -+     Followed  by one of the command line option letters
42963128Sps              this will reset the option to its  default  setting
43063128Sps              and  print  a  message  describing the new setting.
43163128Sps              (The "-+_X" command does the same thing as "-+_X"  on
43263128Sps              the  command line.)  This does not work for string-
43360786Sps              valued options.
43460786Sps
43563128Sps       --+    Like the -+ command, but takes a long  option  name
43660786Sps              rather than a single option letter.
43760786Sps
43860786Sps       -!     Followed by one of the command line option letters,
43960786Sps              this will reset the option to the "opposite" of its
44063128Sps              default  setting and print a message describing the
44163128Sps              new setting.  This does not  work  for  numeric  or
44260786Sps              string-valued options.
44360786Sps
44463128Sps       --!    Like  the  -! command, but takes a long option name
44560786Sps              rather than a single option letter.
44660786Sps
44763128Sps       _      (Underscore.)  Followed by one of the command  line
44863128Sps              option  letters, this will print a message describ-
44963128Sps              ing the current setting of that option.   The  set-
45060786Sps              ting of the option is not changed.
45160786Sps
45263128Sps       __     (Double  underscore.)  Like the _ (underscore) com-
45363128Sps              mand, but takes a long option name  rather  than  a
45463128Sps              single  option letter.  You must press RETURN after
45560786Sps              typing the option name.
45660786Sps
45760786Sps
45860786Sps
45960786Sps
46063128Sps                     Version 358: 08 Jul 2000                   7
46160786Sps
46260786Sps
46360786Sps
46460786Sps
46560786Sps
46660786SpsLESS(1)                                                   LESS(1)
46760786Sps
46860786Sps
46963128Sps       +cmd   Causes the specified cmd to be executed each time a
47063128Sps              new  file is examined.  For example, +G causes _l_e_s_s
47163128Sps              to initially display each file starting at the  end
47260786Sps              rather than the beginning.
47360786Sps
47460786Sps       V      Prints the version number of _l_e_s_s being run.
47560786Sps
47660786Sps       q or Q or :q or :Q or ZZ
47760786Sps              Exits _l_e_s_s_.
47860786Sps
47963128Sps       The  following  four  commands  may  or  may not be valid,
48060786Sps       depending on your particular installation.
48160786Sps
48260786Sps
48363128Sps       v      Invokes an editor to edit the  current  file  being
48463128Sps              viewed.   The  editor is taken from the environment
48563128Sps              variable VISUAL if defined, or EDITOR if VISUAL  is
48663128Sps              not  defined, or defaults to "vi" if neither VISUAL
48763128Sps              nor EDITOR is defined.  See also the discussion  of
48860786Sps              LESSEDIT under the section on PROMPTS below.
48960786Sps
49060786Sps       ! shell-command
49163128Sps              Invokes  a shell to run the shell-command given.  A
49263128Sps              percent sign (%) in the command is replaced by  the
49363128Sps              name  of  the  current  file.   A pound sign (#) is
49463128Sps              replaced by the name  of  the  previously  examined
49563128Sps              file.   "!!"  repeats  the last shell command.  "!"
49663128Sps              with no shell command simply invokes a  shell.   On
49763128Sps              Unix  systems, the shell is taken from the environ-
49863128Sps              ment variable SHELL, or defaults to "sh".   On  MS-
49963128Sps              DOS  and OS/2 systems, the shell is the normal com-
50060786Sps              mand processor.
50160786Sps
50260786Sps       | <m> shell-command
50360786Sps              <m> represents any mark letter.  Pipes a section of
50463128Sps              the  input  file  to  the given shell command.  The
50563128Sps              section of the file to  be  piped  is  between  the
50663128Sps              first  line  on the current screen and the position
50763128Sps              marked by the letter.  <m> may also be ^  or  $  to
50860786Sps              indicate beginning or end of file respectively.  If
50960786Sps              <m> is . or newline, the current screen is piped.
51060786Sps
51160786Sps       s filename
51263128Sps              Save the input to a file.  This only works  if  the
51360786Sps              input is a pipe, not an ordinary file.
51460786Sps
51560786Sps
51660786SpsOOPPTTIIOONNSS
51763128Sps       Command  line  options  are described below.  Most options
51860786Sps       may be changed while _l_e_s_s is running, via the "-" command.
51960786Sps
52063128Sps       Most  options  may  be given in one of two forms: either a
52163128Sps       dash followed by a single letter, or two  dashes  followed
52263128Sps       by  a  long  option  name.   A  long  option  name  may be
52360786Sps
52460786Sps
52560786Sps
52663128Sps                     Version 358: 08 Jul 2000                   8
52760786Sps
52860786Sps
52960786Sps
53060786Sps
53160786Sps
53260786SpsLESS(1)                                                   LESS(1)
53360786Sps
53460786Sps
53563128Sps       abbreviated as long as the  abbreviation  is  unambiguous.
53663128Sps       For  example, --quit-at-eof may be abbreviated --quit, but
53763128Sps       not --qui, since both --quit-at-eof and --quiet begin with
53863128Sps       --qui.   Some  long option names are in uppercase, such as
53963128Sps       --QUIT-AT-EOF,  as  distinct  from  --quit-at-eof.    Such
54063128Sps       option  names  need  only have their first letter capital-
54163128Sps       ized; the remainder of the name may  be  in  either  case.
54260786Sps       For example, --Quit-at-eof is equivalent to --QUIT-AT-EOF.
54360786Sps
54463128Sps       Options are  also  taken  from  the  environment  variable
54563128Sps       "LESS".   For example, to avoid typing "less -options ..."
54660786Sps       each time _l_e_s_s is invoked, you might tell _c_s_h_:
54760786Sps
54860786Sps       setenv LESS "-options"
54960786Sps
55060786Sps       or if you use _s_h_:
55160786Sps
55260786Sps       LESS="-options"; export LESS
55360786Sps
55463128Sps       On MS-DOS, you don't  need  the  quotes,  but  you  should
55563128Sps       replace  any percent signs in the options string by double
55660786Sps       percent signs.
55760786Sps
55863128Sps       The environment variable  is  parsed  before  the  command
55963128Sps       line,  so  command line options override the LESS environ-
56060786Sps       ment variable.  If an option appears in the LESS variable,
56163128Sps       it  can  be reset to its default value on the command line
56260786Sps       by beginning the command line option with "-+".
56360786Sps
56460786Sps       For options like -P or -D which take a following string, a
56563128Sps       dollar  sign  ($)  must  be  used to signal the end of the
56660786Sps       string.  For example, to set two -D options on MS-DOS, you
56760786Sps       must have a dollar sign between them, like this:
56860786Sps
56960786Sps       LESS="-Dn9.1$-Ds4.1"
57060786Sps
57160786Sps
57260786Sps       -? or --help
57363128Sps              This  option  displays  a  summary  of the commands
57463128Sps              accepted by _l_e_s_s  (the  same  as  the  h  command).
57563128Sps              (Depending  on  how your shell interprets the ques-
57663128Sps              tion mark, it may be necessary to quote  the  ques-
57760786Sps              tion mark, thus: "-\?".)
57860786Sps
57960786Sps       -a or --search-skip-screen
58063128Sps              Causes  searches  to start after the last line dis-
58163128Sps              played on the screen, thus skipping all lines  dis-
58263128Sps              played  on  the screen.  By default, searches start
58360786Sps              at the second line on the screen (or after the last
58460786Sps              found line; see the -j option).
58560786Sps
58660786Sps       -b_n or --buffers=_n
58763128Sps              Specifies  the  number of buffers _l_e_s_s will use for
58863128Sps              each file.  Buffers  are  1K,  and  by  default  10
58960786Sps
59060786Sps
59160786Sps
59263128Sps                     Version 358: 08 Jul 2000                   9
59360786Sps
59460786Sps
59560786Sps
59660786Sps
59760786Sps
59860786SpsLESS(1)                                                   LESS(1)
59960786Sps
60060786Sps
60163128Sps              buffers  are used for each file (except if the file
60263128Sps              is a pipe; see the -B option).  The number _n speci-
60363128Sps              fies a different number of buffers to use.
60463128Sps
60560786Sps       -B or --auto-buffers
60663128Sps              By  default, when data is read from a pipe, buffers
60763128Sps              are allocated automatically as needed.  If a  large
60863128Sps              amount  of  data  is  read  from the pipe, this can
60963128Sps              cause a large amount of  memory  to  be  allocated.
61060786Sps              The -B option disables this automatic allocation of
61163128Sps              buffers for pipes,  so  that  only  the  number  of
61260786Sps              buffers specified by the -b option are used.  Warn-
61363128Sps              ing: use of -B can  result  in  erroneous  display,
61463128Sps              since  only  the  most  recently viewed part of the
61560786Sps              file is kept in memory; any earlier data is lost.
61660786Sps
61760786Sps       -c or --clear-screen
61863128Sps              Causes full screen repaints to be painted from  the
61963128Sps              top  line  down.   By default, full screen repaints
62063128Sps              are done  by  scrolling  from  the  bottom  of  the
62160786Sps              screen.
62260786Sps
62360786Sps       -C or --CLEAR-SCREEN
62460786Sps              The -C option is like -c, but the screen is cleared
62560786Sps              before it is repainted.
62660786Sps
62760786Sps       -d or --dumb
62860786Sps              The -d option suppresses the error message normally
62963128Sps              displayed  if  the terminal is dumb; that is, lacks
63063128Sps              some important capability, such as the  ability  to
63160786Sps              clear the screen or scroll backward.  The -d option
63260786Sps              does not otherwise change the behavior of _l_e_s_s on a
63360786Sps              dumb terminal).
63460786Sps
63560786Sps       -Dxx_c_o_l_o_r or --color=xx_c_o_l_o_r
63660786Sps              [MS-DOS only] Sets the color of the text displayed.
63763128Sps              xx is a single character which selects the  type  of
63863128Sps              text  whose  color is being set: n=normal, s=stand-
63963128Sps              out, d=bold, u=underlined,  k=blink.   _c_o_l_o_r  is  a
64063128Sps              pair  of  numbers separated by a period.  The first
64163128Sps              number selects the foreground color and the  second
64260786Sps              selects the background color of the text.  A single
64360786Sps              number _N is the same as _N_._0.
64460786Sps
64560786Sps       -e or --quit-at-eof
64663128Sps              Causes _l_e_s_s to automatically exit the  second  time
64763128Sps              it  reaches  end-of-file.  By default, the only way
64860786Sps              to exit _l_e_s_s is via the "q" command.
64960786Sps
65060786Sps       -E or --QUIT-AT-EOF
65160786Sps              Causes _l_e_s_s to automatically exit the first time it
65260786Sps              reaches end-of-file.
65360786Sps
65460786Sps
65560786Sps
65660786Sps
65760786Sps
65863128Sps                     Version 358: 08 Jul 2000                  10
65960786Sps
66060786Sps
66160786Sps
66260786Sps
66363128Sps
66460786SpsLESS(1)                                                   LESS(1)
66560786Sps
66660786Sps
66763128Sps       -f or --force
66863128Sps              Forces non-regular files to be opened.  (A non-reg-
66963128Sps              ular file is a directory or a device special file.)
67063128Sps              Also  suppresses  the warning message when a binary
67163128Sps              file is opened.  By default, _l_e_s_s  will  refuse  to
67260786Sps              open non-regular files.
67360786Sps
67460786Sps       -F or --quit-if-one-screen
67563128Sps              Causes  _l_e_s_s  to  automatically  exit if the entire
67660786Sps              file can be displayed on the first screen.
67760786Sps
67860786Sps       -g or --hilite-search
67963128Sps              Normally, _l_e_s_s will  highlight  ALL  strings  which
68063128Sps              match  the  last  search  command.   The  -g option
68160786Sps              changes this behavior to highlight only the partic-
68260786Sps              ular string which was found by the last search com-
68363128Sps              mand.  This can cause _l_e_s_s to run  somewhat  faster
68460786Sps              than the default.
68560786Sps
68660786Sps       -G or --HILITE-SEARCH
68763128Sps              The   -G  option  suppresses  all  highlighting  of
68860786Sps              strings found by search commands.
68960786Sps
69060786Sps       -h_n or ---max-back-scroll=_n
69160786Sps              Specifies a maximum number of lines to scroll back-
69263128Sps              ward.   If  it is necessary to scroll backward more
69363128Sps              than _n lines, the screen is repainted in a  forward
69463128Sps              direction  instead.  (If the terminal does not have
69560786Sps              the ability to scroll backward, -h0 is implied.)
69660786Sps
69760786Sps       -i or --ignore-case
69863128Sps              Causes searches to ignore case; that is,  uppercase
69963128Sps              and   lowercase  are  considered  identical.   This
70063128Sps              option is ignored if any uppercase  letters  appear
70160786Sps              in the search pattern; in other words, if a pattern
70263128Sps              contains uppercase letters, then that  search  does
70360786Sps              not ignore case.
70460786Sps
70560786Sps       -I or --IGNORE-CASE
70663128Sps              Like  -i, but searches ignore case even if the pat-
70760786Sps              tern contains uppercase letters.
70860786Sps
70960786Sps       -j_n or --jump-target=_n
71063128Sps              Specifies a line on the screen where  the  "target"
71163128Sps              line  is  to  be  positioned.  A target line is the
71260786Sps              object of a text search, tag search, jump to a line
71363128Sps              number,  jump  to  a  file percentage, or jump to a
71460786Sps              marked position.  The screen line is specified by a
71563128Sps              number:  the  top line on the screen is 1, the next
71663128Sps              is 2, and so on.  The number  may  be  negative  to
71763128Sps              specify  a  line  relative  to  the  bottom  of the
71863128Sps              screen: the bottom line on the screen  is  -1,  the
71963128Sps              second  to  the bottom is -2, and so on.  If the -j
72063128Sps              option  is  used,  searches  begin  at   the   line
72160786Sps
72260786Sps
72360786Sps
72463128Sps                     Version 358: 08 Jul 2000                  11
72560786Sps
72660786Sps
72760786Sps
72860786Sps
72960786Sps
73060786SpsLESS(1)                                                   LESS(1)
73160786Sps
73260786Sps
73363128Sps              immediately after the target line.  For example, if
73463128Sps              "-j4" is used, the target line is the  fourth  line
73563128Sps              on  the screen, so searches begin at the fifth line
73663128Sps              on the screen.
73763128Sps
73863128Sps       -J or --status-column
73963128Sps              Displays a status column at the left  edge  of  the
74063128Sps              screen.   The  status column is used only if the -w
74163128Sps              or -W option is in effect.
74263128Sps
74360786Sps       -k_f_i_l_e_n_a_m_e or --lesskey-file=_f_i_l_e_n_a_m_e
74460786Sps              Causes _l_e_s_s to open and interpret the named file as
74563128Sps              a  _l_e_s_s_k_e_y  (1)  file.   Multiple -k options may be
74663128Sps              specified.  If the LESSKEY or LESSKEY_SYSTEM  envi-
74763128Sps              ronment  variable  is  set, or if a lesskey file is
74860786Sps              found in a standard place (see KEY BINDINGS), it is
74960786Sps              also used as a _l_e_s_s_k_e_y file.
75060786Sps
75160786Sps       -m or --long-prompt
75263128Sps              Causes  _l_e_s_s  to prompt verbosely (like _m_o_r_e), with
75360786Sps              the  percent  into  the  file.   By  default,  _l_e_s_s
75460786Sps              prompts with a colon.
75560786Sps
75660786Sps       -M or --LONG-PROMPT
75763128Sps              Causes  _l_e_s_s  to  prompt  even  more verbosely than
75860786Sps              _m_o_r_e_.
75960786Sps
76060786Sps       -n or --line-numbers
76163128Sps              Suppresses line numbers.  The default (to use  line
76263128Sps              numbers)  may cause _l_e_s_s to run more slowly in some
76363128Sps              cases, especially with a  very  large  input  file.
76463128Sps              Suppressing  line  numbers  with the -n option will
76563128Sps              avoid this problem.  Using line numbers means:  the
76660786Sps              line number will be displayed in the verbose prompt
76763128Sps              and in the = command, and the v command  will  pass
76860786Sps              the current line number to the editor (see also the
76960786Sps              discussion of LESSEDIT in PROMPTS below).
77060786Sps
77160786Sps       -N or --LINE-NUMBERS
77263128Sps              Causes a line number to be displayed at the  begin-
77360786Sps              ning of each line in the display.
77460786Sps
77560786Sps       -o_f_i_l_e_n_a_m_e or --log-file=_f_i_l_e_n_a_m_e
77663128Sps              Causes  _l_e_s_s to copy its input to the named file as
77763128Sps              it is being viewed.  This  applies  only  when  the
77860786Sps              input file is a pipe, not an ordinary file.  If the
77960786Sps              file already exists, _l_e_s_s will ask for confirmation
78060786Sps              before overwriting it.
78160786Sps
78260786Sps       -O_f_i_l_e_n_a_m_e or --LOG-FILE=_f_i_l_e_n_a_m_e
78363128Sps              The  -O option is like -o, but it will overwrite an
78460786Sps              existing file without asking for confirmation.
78560786Sps
78663128Sps              If no log file has been specified, the  -o  and  -O
78760786Sps
78860786Sps
78960786Sps
79063128Sps                     Version 358: 08 Jul 2000                  12
79160786Sps
79260786Sps
79360786Sps
79460786Sps
79560786Sps
79660786SpsLESS(1)                                                   LESS(1)
79760786Sps
79860786Sps
79963128Sps              options  can  be used from within _l_e_s_s to specify a
80063128Sps              log file.  Without a file name,  they  will  simply
80163128Sps              report  the  name of the log file.  The "s" command
80263128Sps              is equivalent to specifying -o from within _l_e_s_s_.
80363128Sps
80463128Sps       -p_p_a_t_t_e_r_n or --pattern=_p_a_t_t_e_r_n
80563128Sps              The -p option on the command line is equivalent  to
80663128Sps              specifying  +/_p_a_t_t_e_r_n;  that  is,  it tells _l_e_s_s to
80763128Sps              start at the first occurrence  of  _p_a_t_t_e_r_n  in  the
80863128Sps              file.
80963128Sps
81060786Sps       -P_p_r_o_m_p_t or --prompt=_p_r_o_m_p_t
81160786Sps              Provides a way to tailor the three prompt styles to
81260786Sps              your own preference.  This option would normally be
81363128Sps              put  in  the LESS environment variable, rather than
81463128Sps              being typed in with each  _l_e_s_s  command.   Such  an
81563128Sps              option  must  either be the last option in the LESS
81663128Sps              variable, or be terminated by a dollar  sign.   -Ps
81763128Sps              followed  by  a  string changes the default (short)
81860786Sps              prompt to that string.  -Pm changes the medium (-m)
81963128Sps              prompt.   -PM  changes  the  long (-M) prompt.  -Ph
82060786Sps              changes  the  prompt  for  the  help  screen.   -P=
82163128Sps              changes  the message printed by the = command.  All
82260786Sps              prompt strings consist of a sequence of letters and
82360786Sps              special  escape  sequences.   See  the  section  on
82460786Sps              PROMPTS for more details.
82560786Sps
82660786Sps       -q or --quiet or --silent
82763128Sps              Causes moderately "quiet" operation:  the  terminal
82863128Sps              bell  is  not  rung if an attempt is made to scroll
82960786Sps              past the end of the file or before the beginning of
83063128Sps              the  file.  If the terminal has a "visual bell", it
83163128Sps              is used instead.  The bell will be rung on  certain
83263128Sps              other  errors, such as typing an invalid character.
83363128Sps              The default is to ring the  terminal  bell  in  all
83460786Sps              such cases.
83560786Sps
83660786Sps       -Q or --QUIET or --SILENT
83760786Sps              Causes totally "quiet" operation: the terminal bell
83860786Sps              is never rung.
83960786Sps
84060786Sps       -r or --raw-control-chars
84163128Sps              Causes "raw" control characters  to  be  displayed.
84263128Sps              The  default is to display control characters using
84360786Sps              the caret notation; for example, a control-A (octal
84463128Sps              001)  is  displayed  as "^A".  Warning: when the -r
84563128Sps              option is used,  _l_e_s_s  cannot  keep  track  of  the
84660786Sps              actual appearance of the screen (since this depends
84763128Sps              on how the screen responds to each type of  control
84863128Sps              character).   Thus,  various  display  problems may
84960786Sps              result, such as long lines being split in the wrong
85060786Sps              place.
85160786Sps
85260786Sps
85360786Sps
85460786Sps
85560786Sps
85663128Sps                     Version 358: 08 Jul 2000                  13
85760786Sps
85860786Sps
85960786Sps
86060786Sps
86160786Sps
86260786SpsLESS(1)                                                   LESS(1)
86360786Sps
86460786Sps
86563128Sps       -R or --RAW-CONTROL-CHARS
86663128Sps              Like  -r,  but  tries  to  keep track of the screen
86763128Sps              appearance where possible.  This works only if  the
86863128Sps              input  consists  of  normal  text and possibly some
86963128Sps              ANSI "color" escape sequences, which are  sequences
87063128Sps              of the form:
87163128Sps
87263128Sps                   ESC [ ... m
87363128Sps
87463128Sps              where  the  "..."  is zero or more characters other
87563128Sps              than "m".  For the  purpose  of  keeping  track  of
87663128Sps              screen  appearance,  all control characters and all
87760786Sps              ANSI color escape sequences are assumed to not move
87863128Sps              the  cursor.   You can make _l_e_s_s think that charac-
87963128Sps              ters other than  "m"  can  end  ANSI  color  escape
88063128Sps              sequences   by  setting  the  environment  variable
88163128Sps              LESSANSIENDCHARS to the list  of  characters  which
88260786Sps              can end a color escape sequence.
88360786Sps
88460786Sps       -s or --squeeze-blank-lines
88563128Sps              Causes  consecutive blank lines to be squeezed into
88663128Sps              a single blank line.  This is useful  when  viewing
88760786Sps              _n_r_o_f_f output.
88860786Sps
88960786Sps       -S or --chop-long-lines
89063128Sps              Causes  lines  longer  than  the screen width to be
89160786Sps              chopped rather than folded.  That is, the remainder
89260786Sps              of a long line is simply discarded.  The default is
89363128Sps              to fold long lines; that is, display the  remainder
89460786Sps              on the next line.
89560786Sps
89660786Sps       -t_t_a_g or --tag=_t_a_g
89763128Sps              The  -t option, followed immediately by a TAG, will
89863128Sps              edit the file containing that  tag.   For  this  to
89963128Sps              work,  there  must  be  a file called "tags" in the
90063128Sps              current directory, which was  previously  built  by
90163128Sps              the  _c_t_a_g_s  (1)  command.   This option may also be
90260786Sps              specified from within _l_e_s_s (using the - command) as
90360786Sps              a way of examining a new file.  The command ":t" is
90460786Sps              equivalent to specifying -t from within _l_e_s_s_.
90560786Sps
90660786Sps       -T_t_a_g_s_f_i_l_e or --tag-file=_t_a_g_s_f_i_l_e
90760786Sps              Specifies a tags file to be used instead of "tags".
90860786Sps
90960786Sps       -u or --underline-special
91063128Sps              Causes   backspaces  and  carriage  returns  to  be
91163128Sps              treated as printable characters; that is, they  are
91260786Sps              sent to the terminal when they appear in the input.
91360786Sps
91460786Sps       -U or --UNDERLINE-SPECIAL
91563128Sps              Causes backspaces, tabs and carriage returns to  be
91663128Sps              treated  as  control  characters; that is, they are
91760786Sps              handled as specified by the -r option.
91860786Sps
91960786Sps
92060786Sps
92160786Sps
92263128Sps                     Version 358: 08 Jul 2000                  14
92360786Sps
92460786Sps
92560786Sps
92660786Sps
92760786Sps
92860786SpsLESS(1)                                                   LESS(1)
92960786Sps
93060786Sps
93163128Sps              By  default,  if  neither  -u  nor  -U  is   given,
93263128Sps              backspaces  which  appear adjacent to an underscore
93363128Sps              character are  treated  specially:  the  underlined
93463128Sps              text  is  displayed  using  the terminal's hardware
93563128Sps              underlining  capability.   Also,  backspaces  which
93663128Sps              appear between two identical characters are treated
93763128Sps              specially: the overstruck text is printed using the
93863128Sps              terminal's  hardware  boldface  capability.   Other
93963128Sps              backspaces are deleted, along  with  the  preceding
94063128Sps              character.   Carriage  returns immediately followed
94163128Sps              by a newline are deleted.  other  carriage  returns
94263128Sps              are  handled  as  specified by the -r option.  Text
94363128Sps              which is overstruck or underlined can  be  searched
94460786Sps              for if neither -u nor -U is in effect.
94560786Sps
94660786Sps       -V or --version
94760786Sps              Displays the version number of _l_e_s_s_.
94860786Sps
94960786Sps       -w or --hilite-unread
95060786Sps              Temporarily highlights the first "new" line after a
95163128Sps              forward movement of a full page.  The  first  "new"
95263128Sps              line  is  the  line  immediately following the line
95360786Sps              previously at the bottom of the screen.  Also high-
95460786Sps              lights the target line after a g or p command.  The
95563128Sps              highlight is removed  at  the  next  command  which
95663128Sps              causes  movement.   The entire line is highlighted,
95763128Sps              unless the -J option is in effect,  in  which  case
95863128Sps              only the status column is highlighted.
95960786Sps
96060786Sps       -W or --HILITE-UNREAD
96163128Sps              Like  -w,  but temporarily highlights the first new
96260786Sps              line after any forward movement command larger than
96360786Sps              one line.
96460786Sps
96560786Sps       -x_n or --tabs=_n
96663128Sps              Sets  tab stops every _n positions.  The default for
96760786Sps              _n is 8.
96860786Sps
96960786Sps       -X or --no-init
97063128Sps              Disables sending  the  termcap  initialization  and
97163128Sps              deinitialization  strings to the terminal.  This is
97263128Sps              sometimes desirable if the deinitialization  string
97363128Sps              does   something  unnecessary,  like  clearing  the
97460786Sps              screen.
97560786Sps
97660786Sps       -y_n or --max-forw-scroll=_n
97763128Sps              Specifies a maximum number of lines to scroll  for-
97863128Sps              ward.   If  it  is necessary to scroll forward more
97960786Sps              than _n lines, the screen is repainted instead.  The
98060786Sps              -c or -C option may be used to repaint from the top
98163128Sps              of the screen if desired.  By default, any  forward
98260786Sps              movement causes scrolling.
98360786Sps
98460786Sps
98560786Sps
98660786Sps
98760786Sps
98863128Sps                     Version 358: 08 Jul 2000                  15
98960786Sps
99060786Sps
99160786Sps
99260786Sps
99360786Sps
99460786SpsLESS(1)                                                   LESS(1)
99560786Sps
99660786Sps
99763128Sps       -[z]_n or --window=_n
99863128Sps              Changes  the  default  scrolling  window  size to _n
99963128Sps              lines.  The default is one screenful.  The z and  w
100063128Sps              commands  can  also  be  used  to change the window
100163128Sps              size.  The "z" may  be  omitted  for  compatibility
100263128Sps              with  _m_o_r_e_.   If the number _n is negative, it indi-
100363128Sps              cates _n lines less than the  current  screen  size.
100463128Sps              For  example,  if the screen is 24 lines, _-_z_-_4 sets
100563128Sps              the scrolling window to 20 lines.  If the screen is
100663128Sps              resized to 40 lines, the scrolling window automati-
100763128Sps              cally changes to 36 lines.
100863128Sps
100963128Sps       -"_c_c or --quotes=_c_c
101063128Sps              Changes the filename quoting character.   This  may
101163128Sps              be necessary if you are trying to name a file which
101263128Sps              contains both spaces and  quote  characters.   Fol-
101360786Sps              lowed by a single character, this changes the quote
101463128Sps              character to that character.  Filenames  containing
101560786Sps              a space should then be surrounded by that character
101663128Sps              rather than by  double  quotes.   Followed  by  two
101763128Sps              characters,  changes  the  open  quote to the first
101863128Sps              character, and the close quote to the second  char-
101960786Sps              acter.  Filenames containing a space should then be
102063128Sps              preceded by the open quote character  and  followed
102160786Sps              by the close quote character.  Note that even after
102260786Sps              the  quote  characters  are  changed,  this  option
102360786Sps              remains -" (a dash followed by a double quote).
102460786Sps
102560786Sps       -~ or --tilde
102660786Sps              Normally lines after end of file are displayed as a
102763128Sps              single tilde (~).  This option causes  lines  after
102860786Sps              end of file to be displayed as blank lines.
102960786Sps
103063128Sps       -# or --shift
103163128Sps              Specifies the default number of positions to scroll
103263128Sps              horizontally in the RIGHTARROW and  LEFTARROW  com-
103363128Sps              mands.   If  the  number specified is zero, it sets
103463128Sps              the default number of positions to one half of  the
103563128Sps              screen width.
103663128Sps
103763128Sps       --     A  command  line  argument of "--" marks the end of
103860786Sps              option arguments.  Any arguments following this are
103963128Sps              interpreted  as filenames.  This can be useful when
104060786Sps              viewing a file whose name begins with a "-" or "+".
104160786Sps
104260786Sps       +      If a command line option begins with ++, the remain-
104363128Sps              der of that option is taken to be an  initial  com-
104463128Sps              mand  to _l_e_s_s_.  For example, +G tells _l_e_s_s to start
104563128Sps              at the end of the file rather than  the  beginning,
104660786Sps              and +/xyz tells it to start at the first occurrence
104760786Sps              of "xyz" in the file.  As a special case, +<number>
104863128Sps              acts  like  +<number>g; that is, it starts the dis-
104960786Sps              play at the specified line number (however, see the
105060786Sps              caveat under the "g" command above).  If the option
105160786Sps
105260786Sps
105360786Sps
105463128Sps                     Version 358: 08 Jul 2000                  16
105560786Sps
105660786Sps
105760786Sps
105860786Sps
105960786Sps
106063128SpsLESS(1)                                                   LESS(1)
106160786Sps
106260786Sps
106363128Sps              starts with ++,  the  initial  command  applies  to
106463128Sps              every  file  being  viewed, not just the first one.
106563128Sps              The + command described previously may also be used
106663128Sps              to  set  (or  change)  an initial command for every
106763128Sps              file.
106860786Sps
106960786Sps
107063128SpsLLIINNEE EEDDIITTIINNGG
107163128Sps       When entering command line at the  bottom  of  the  screen
107263128Sps       (for  example,  a filename for the :e command, or the pat-
107363128Sps       tern for a search command), certain keys can  be  used  to
107463128Sps       manipulate the command line.  Most commands have an alter-
107563128Sps       nate form in [ brackets ] which can be used if a key  does
107663128Sps       not  exist on a particular keyboard.  (The bracketed forms
107763128Sps       do not work in the MS-DOS version.)  Any of these  special
107863128Sps       keys  may  be  entered  literally by preceding it with the
107963128Sps       "literal" character, either ^V or ^A.  A backslash  itself
108063128Sps       may also be entered literally by entering two backslashes.
108160786Sps
108263128Sps       LEFTARROW [ ESC-h ]
108363128Sps              Move the cursor one space to the left.
108460786Sps
108560786Sps       RIGHTARROW [ ESC-l ]
108660786Sps              Move the cursor one space to the right.
108760786Sps
108860786Sps       ^LEFTARROW [ ESC-b or ESC-LEFTARROW ]
108963128Sps              (That is, CONTROL  and  LEFTARROW  simultaneously.)
109060786Sps              Move the cursor one word to the left.
109160786Sps
109260786Sps       ^RIGHTARROW [ ESC-w or ESC-RIGHTARROW ]
109363128Sps              (That  is,  CONTROL and RIGHTARROW simultaneously.)
109460786Sps              Move the cursor one word to the right.
109560786Sps
109660786Sps       HOME [ ESC-0 ]
109760786Sps              Move the cursor to the beginning of the line.
109860786Sps
109960786Sps       END [ ESC-$ ]
110060786Sps              Move the cursor to the end of the line.
110160786Sps
110260786Sps       BACKSPACE
110363128Sps              Delete the character to the left of the cursor,  or
110460786Sps              cancel the command if the command line is empty.
110560786Sps
110660786Sps       DELETE or [ ESC-x ]
110760786Sps              Delete the character under the cursor.
110860786Sps
110960786Sps       ^BACKSPACE [ ESC-BACKSPACE ]
111063128Sps              (That  is,  CONTROL  and BACKSPACE simultaneously.)
111160786Sps              Delete the word to the left of the cursor.
111260786Sps
111360786Sps       ^DELETE [ ESC-X or ESC-DELETE ]
111463128Sps              (That  is,  CONTROL  and  DELETE   simultaneously.)
111560786Sps              Delete the word under the cursor.
111660786Sps
111760786Sps
111860786Sps
111960786Sps
112063128Sps                     Version 358: 08 Jul 2000                  17
112160786Sps
112260786Sps
112360786Sps
112460786Sps
112560786Sps
112663128SpsLESS(1)                                                   LESS(1)
112760786Sps
112860786Sps
112963128Sps       UPARROW [ ESC-k ]
113063128Sps              Retrieve the previous command line.
113160786Sps
113263128Sps       DOWNARROW [ ESC-j ]
113363128Sps              Retrieve the next command line.
113460786Sps
113563128Sps       TAB    Complete  the  partial  filename to the left of the
113663128Sps              cursor.  If it matches more than one filename,  the
113763128Sps              first  match  is  entered  into  the  command line.
113863128Sps              Repeated TABs will cycle thru  the  other  matching
113963128Sps              filenames.   If  the completed filename is a direc-
114063128Sps              tory, a "/" is appended to the filename.   (On  MS-
114163128Sps              DOS  systems,  a "\" is appended.)  The environment
114263128Sps              variable LESSSEPARATOR can be  used  to  specify  a
114363128Sps              different  character to append to a directory name.
114460786Sps
114563128Sps       BACKTAB [ ESC-TAB ]
114663128Sps              Like, TAB, but cycles in the reverse direction thru
114763128Sps              the matching filenames.
114860786Sps
114963128Sps       ^L     Complete  the  partial  filename to the left of the
115063128Sps              cursor.  If it matches more than one filename,  all
115163128Sps              matches  are entered into the command line (if they
115260786Sps              fit).
115360786Sps
115460786Sps       ^U (Unix) or ESC (MS-DOS)
115563128Sps              Delete the entire command line, or cancel the  com-
115663128Sps              mand  if  the  command  line is empty.  If you have
115763128Sps              changed your line-kill character in Unix  to  some-
115860786Sps              thing other than ^U, that character is used instead
115960786Sps              of ^U.
116060786Sps
116160786Sps
116260786SpsKKEEYY BBIINNDDIINNGGSS
116360786Sps       You may define your own _l_e_s_s commands by using the program
116460786Sps       _l_e_s_s_k_e_y (1) to create a lesskey file.  This file specifies
116563128Sps       a set of command keys and an action associated  with  each
116663128Sps       key.   You may also use _l_e_s_s_k_e_y to change the line-editing
116760786Sps       keys (see LINE EDITING), and to set environment variables.
116860786Sps       If the environment variable LESSKEY is set, _l_e_s_s uses that
116960786Sps       as the name of the lesskey file.  Otherwise, _l_e_s_s looks in
117063128Sps       a  standard  place  for the lesskey file: On Unix systems,
117163128Sps       _l_e_s_s looks for a lesskey file  called  "$HOME/.less".   On
117263128Sps       MS-DOS  and Windows systems, _l_e_s_s looks for a lesskey file
117363128Sps       called "$HOME/_less", and if it is not found  there,  then
117463128Sps       looks  for  a lesskey file called "_less" in any directory
117563128Sps       specified in the PATH environment variable.  On OS/2  sys-
117663128Sps       tems,    _l_e_s_s    looks   for   a   lesskey   file   called
117760786Sps       "$HOME/less.ini", and if it is not found, then looks for a
117863128Sps       lesskey  file called "less.ini" in any directory specified
117963128Sps       in the INIT environment variable,  and  if  it  not  found
118063128Sps       there,  then looks for a lesskey file called "less.ini" in
118163128Sps       any directory specified in the PATH environment  variable.
118260786Sps       See the _l_e_s_s_k_e_y manual page for more details.
118360786Sps
118460786Sps
118560786Sps
118663128Sps                     Version 358: 08 Jul 2000                  18
118760786Sps
118860786Sps
118960786Sps
119060786Sps
119160786Sps
119263128SpsLESS(1)                                                   LESS(1)
119360786Sps
119460786Sps
119563128Sps       A  system-wide  lesskey file may also be set up to provide
119663128Sps       key bindings.  If a key is defined in both a local lesskey
119763128Sps       file  and  in  the  system-wide  file, key bindings in the
119863128Sps       local file take precedence over those in  the  system-wide
119963128Sps       file.   If the environment variable LESSKEY_SYSTEM is set,
120063128Sps       _l_e_s_s uses that as the  name  of  the  system-wide  lesskey
120163128Sps       file.   Otherwise,  _l_e_s_s looks in a standard place for the
120263128Sps       system-wide lesskey file: On Unix systems, the system-wide
120363128Sps       lesskey  file  is  /usr/local/bin/.sysless.   (However, if
120463128Sps       _l_e_s_s was built with  a  different  binary  directory  than
120563128Sps       /usr/local/bin,  that directory is where the .sysless file
120663128Sps       is found.)  On MS-DOS and Windows systems, the system-wide
120763128Sps       lesskey file is c:\_sysless.  On OS/2 systems, the system-
120863128Sps       wide lesskey file is c:\sysless.ini.
120960786Sps
121060786Sps
121163128SpsIINNPPUUTT PPRREEPPRROOCCEESSSSOORR
121263128Sps       You may define an "input preprocessor" for  _l_e_s_s_.   Before
121363128Sps       _l_e_s_s  opens a file, it first gives your input preprocessor
121463128Sps       a chance to modify the way the contents of  the  file  are
121563128Sps       displayed.   An input preprocessor is simply an executable
121663128Sps       program (or shell script), which writes  the  contents  of
121760786Sps       the file to a different file, called the replacement file.
121860786Sps       The contents of the replacement file are then displayed in
121963128Sps       place  of  the contents of the original file.  However, it
122060786Sps       will appear to the user as if the original file is opened;
122163128Sps       that  is,  _l_e_s_s  will display the original filename as the
122260786Sps       name of the current file.
122360786Sps
122463128Sps       An input preprocessor receives one command line  argument,
122563128Sps       the  original filename, as entered by the user.  It should
122663128Sps       create the replacement file, and when finished, print  the
122763128Sps       name  of  the replacement file to its standard output.  If
122860786Sps       the input preprocessor does not output a replacement file-
122963128Sps       name,  _l_e_s_s  uses the original file, as normal.  The input
123063128Sps       preprocessor is not called when  viewing  standard  input.
123160786Sps       To set up an input preprocessor, set the LESSOPEN environ-
123263128Sps       ment variable to a command line  which  will  invoke  your
123363128Sps       input  preprocessor.  This command line should include one
123463128Sps       occurrence of the string "%s", which will be  replaced  by
123560786Sps       the  filename  when  the  input  preprocessor  command  is
123660786Sps       invoked.
123760786Sps
123860786Sps       When _l_e_s_s closes a file opened in such a way, it will call
123960786Sps       another program, called the input postprocessor, which may
124063128Sps       perform any desired clean-up action (such as deleting  the
124160786Sps       replacement  file  created  by  LESSOPEN).   This  program
124260786Sps       receives two command line arguments, the original filename
124363128Sps       as  entered  by  the user, and the name of the replacement
124460786Sps       file.  To set up an input postprocessor, set the LESSCLOSE
124563128Sps       environment  variable  to a command line which will invoke
124663128Sps       your input postprocessor.  It may include two  occurrences
124763128Sps       of  the string "%s"; the first is replaced with the origi-
124863128Sps       nal name of the file and the second with the name  of  the
124963128Sps
125063128Sps
125163128Sps
125263128Sps                     Version 358: 08 Jul 2000                  19
125363128Sps
125463128Sps
125563128Sps
125663128Sps
125763128Sps
125863128SpsLESS(1)                                                   LESS(1)
125963128Sps
126063128Sps
126160786Sps       replacement file, which was output by LESSOPEN.
126260786Sps
126363128Sps       For  example, on many Unix systems, these two scripts will
126463128Sps       allow you to keep files in compressed  format,  but  still
126560786Sps       let _l_e_s_s view them directly:
126660786Sps
126760786Sps       lessopen.sh:
126860786Sps            #! /bin/sh
126960786Sps            case "$1" in
127060786Sps            *.Z) uncompress -c $1  >/tmp/less.$$  2>/dev/null
127160786Sps                 if [ -s /tmp/less.$$ ]; then
127260786Sps                      echo /tmp/less.$$
127360786Sps                 else
127460786Sps                      rm -f /tmp/less.$$
127560786Sps                 fi
127660786Sps                 ;;
127760786Sps            esac
127860786Sps
127960786Sps       lessclose.sh:
128060786Sps            #! /bin/sh
128160786Sps            rm $2
128260786Sps
128360786Sps       To use these scripts, put them both where they can be exe-
128463128Sps       cuted    and    set     LESSOPEN="lessopen.sh %s",     and
128560786Sps       LESSCLOSE="lessclose.sh %s %s".  More complex LESSOPEN and
128663128Sps       LESSCLOSE scripts may be written to accept other types  of
128760786Sps       compressed files, and so on.
128860786Sps
128963128Sps       It  is  also  possible  to set up an input preprocessor to
129063128Sps       pipe the file data directly to _l_e_s_s_, rather  than  putting
129160786Sps       the data into a replacement file.  This avoids the need to
129260786Sps       decompress the entire file before starting to view it.  An
129363128Sps       input  preprocessor that works this way is called an input
129463128Sps       pipe.  An input pipe, instead of writing  the  name  of  a
129560786Sps       replacement file on its standard output, writes the entire
129663128Sps       contents of the replacement file on its  standard  output.
129763128Sps       If  the  input  pipe  does not write any characters on its
129863128Sps       standard output, then there is  no  replacement  file  and
129963128Sps       _l_e_s_s  uses  the original file, as normal.  To use an input
130060786Sps       pipe, make the first character in the LESSOPEN environment
130160786Sps       variable a vertical bar (|) to signify that the input pre-
130260786Sps       processor is an input pipe.
130360786Sps
130463128Sps       For example, on many Unix systems, this script  will  work
130560786Sps       like the previous example scripts:
130660786Sps
130760786Sps       lesspipe.sh:
130860786Sps            #! /bin/sh
130960786Sps            case "$1" in
131060786Sps            *.Z) uncompress -c $1  2>/dev/null
131160786Sps                 ;;
131260786Sps            esac
131360786Sps
131463128Sps       To  use  this  script, put it where it can be executed and
131563128Sps
131663128Sps
131763128Sps
131863128Sps                     Version 358: 08 Jul 2000                  20
131963128Sps
132063128Sps
132163128Sps
132263128Sps
132363128Sps
132463128SpsLESS(1)                                                   LESS(1)
132563128Sps
132663128Sps
132763128Sps       set LESSOPEN="|lesspipe.sh %s".  When  an  input  pipe  is
132863128Sps       used,  a  LESSCLOSE  postprocessor  can be used, but it is
132963128Sps       usually not necessary since there is no  replacement  file
133063128Sps       to  clean  up.   In  this  case, the replacement file name
133160786Sps       passed to the LESSCLOSE postprocessor is "-".
133260786Sps
133360786Sps
133460786SpsNNAATTIIOONNAALL CCHHAARRAACCTTEERR SSEETTSS
133560786Sps       There are three types of characters in the input file:
133660786Sps
133760786Sps       normal characters
133860786Sps              can be displayed directly to the screen.
133960786Sps
134060786Sps       control characters
134163128Sps              should not be displayed directly, but are  expected
134260786Sps              to  be  found  in  ordinary  text  files  (such  as
134360786Sps              backspace and tab).
134460786Sps
134560786Sps       binary characters
134660786Sps              should  not  be  displayed  directly  and  are  not
134760786Sps              expected to be found in text files.
134860786Sps
134960786Sps       A "character set" is simply a description of which charac-
135063128Sps       ters are to be considered  normal,  control,  and  binary.
135160786Sps       The LESSCHARSET environment variable may be used to select
135260786Sps       a character set.  Possible values for LESSCHARSET are:
135360786Sps
135463128Sps       ascii  BS, TAB, NL, CR, and formfeed are  control  charac-
135563128Sps              ters,  all chars with values between 32 and 126 are
135660786Sps              normal, and all others are binary.
135760786Sps
135860786Sps       iso8859
135963128Sps              Selects an ISO 8859 character  set.   This  is  the
136063128Sps              same  as  ASCII,  except characters between 160 and
136160786Sps              255 are treated as normal characters.
136260786Sps
136360786Sps       latin1 Same as iso8859.
136460786Sps
136560786Sps       dos    Selects a character set appropriate for MS-DOS.
136660786Sps
136760786Sps       ebcdic Selects an EBCDIC character set.
136860786Sps
136960786Sps       koi8-r Selects a Russian character set.
137060786Sps
137163128Sps       next   Selects a character set appropriate for  NeXT  com-
137260786Sps              puters.
137360786Sps
137460786Sps       utf-8  Selects the UTF-8 encoding of the ISO 10646 charac-
137560786Sps              ter set.
137660786Sps
137763128Sps       If the LESSCHARSET environment variable is  not  set,  the
137863128Sps       default  character  set is latin1.  However, if the string
137963128Sps       "UTF-8" is found in the LC_ALL, LC_CTYPE or LANG  environ-
138063128Sps       ment  variables,  then  the default character set is utf-8
138160786Sps
138260786Sps
138360786Sps
138463128Sps                     Version 358: 08 Jul 2000                  21
138560786Sps
138660786Sps
138760786Sps
138860786Sps
138960786Sps
139063128SpsLESS(1)                                                   LESS(1)
139160786Sps
139260786Sps
139363128Sps       instead.
139460786Sps
139563128Sps       In special cases, it may be desired to tailor _l_e_s_s to  use
139663128Sps       a  character  set  other  than the ones definable by LESS-
139763128Sps       CHARSET.  In this case,  the  environment  variable  LESS-
139863128Sps       CHARDEF  can be used to define a character set.  It should
139963128Sps       be set to a string where each character in the string rep-
140063128Sps       resents one character in the character set.  The character
140163128Sps       "." is used for a normal character, "c" for  control,  and
140263128Sps       "b"  for binary.  A decimal number may be used for repeti-
140363128Sps       tion.  For example, "bccc4b." would mean  character  0  is
140463128Sps       binary,  1, 2 and 3 are control, 4, 5, 6 and 7 are binary,
140563128Sps       and 8 is normal.  All characters after the last are  taken
140663128Sps       to  be  the  same as the last, so characters 9 through 255
140763128Sps       would be normal.  (This is an example, and does not neces-
140863128Sps       sarily represent any real character set.)
140960786Sps
141063128Sps       This table shows the value of LESSCHARDEF which is equiva-
141163128Sps       lent to each of the possible values for LESSCHARSET:
141260786Sps
141363128Sps            ascii     8bcccbcc18b95.b
141463128Sps            dos       8bcccbcc12bc5b95.b.
141560786Sps            ebcdic    5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b
141660786Sps                      9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b.
141760786Sps            iso8859   8bcccbcc18b95.33b.
141860786Sps            koi8-r    8bcccbcc18b95.b128.
141960786Sps            latin1    8bcccbcc18b95.33b.
142060786Sps            next      8bcccbcc18b95.bb125.bb
142160786Sps
142263128Sps       If neither LESSCHARSET nor LESSCHARDEF is  set,  but  your
142363128Sps       system  supports  the  _s_e_t_l_o_c_a_l_e  interface, _l_e_s_s will use
142463128Sps       setlocale to determine the character  set.   setlocale  is
142563128Sps       controlled  by  setting  the  LANG or LC_CTYPE environment
142660786Sps       variables.
142760786Sps
142863128Sps       Control and binary characters are  displayed  in  standout
142963128Sps       (reverse  video).   Each  such  character  is displayed in
143060786Sps       caret notation if possible (e.g. ^A for control-A).  Caret
143160786Sps       notation is used only if inverting the 0100 bit results in
143260786Sps       a normal printable character.  Otherwise, the character is
143363128Sps       displayed  as a hex number in angle brackets.  This format
143460786Sps       can be changed by setting the LESSBINFMT environment vari-
143563128Sps       able.   LESSBINFMT  may begin with a "*" and one character
143660786Sps       to select the display attribute: "*k" is blinking, "*d" is
143763128Sps       bold,  "*u"  is  underlined, "*s" is standout, and "*n" is
143863128Sps       normal.  If LESSBINFMT does not begin with a  "*",  normal
143963128Sps       attribute  is  assumed.   The remainder of LESSBINFMT is a
144063128Sps       string which may include one printf-style escape  sequence
144160786Sps       (a % followed by x, X, o, d, etc.).  For example, if LESS-
144263128Sps       BINFMT is "*u[%x]", binary  characters  are  displayed  in
144363128Sps       underlined   hexadecimal   surrounded  by  brackets.   The
144460786Sps       default if no LESSBINFMT is specified is "*s<%X>".
144560786Sps
144660786Sps
144760786Sps
144860786Sps
144960786Sps
145063128Sps                     Version 358: 08 Jul 2000                  22
145160786Sps
145260786Sps
145360786Sps
145460786Sps
145560786Sps
145663128SpsLESS(1)                                                   LESS(1)
145760786Sps
145860786Sps
145963128SpsPPRROOMMPPTTSS
146063128Sps       The -P option allows you to  tailor  the  prompt  to  your
146163128Sps       preference.   The  string  given to the -P option replaces
146263128Sps       the specified prompt string.  Certain  characters  in  the
146363128Sps       string are interpreted specially.  The prompt mechanism is
146463128Sps       rather complicated to provide flexibility, but  the  ordi-
146563128Sps       nary  user need not understand the details of constructing
146663128Sps       personalized prompt strings.
146760786Sps
146863128Sps       A percent sign followed by a single character is  expanded
146963128Sps       according to what the following character is:
147060786Sps
147163128Sps       %b_X    Replaced  by the byte offset into the current input
147263128Sps              file.  The b is  followed  by  a  single  character
147363128Sps              (shown  as  _X above) which specifies the line whose
147463128Sps              byte offset is to be used.  If the character  is  a
147563128Sps              "t", the byte offset of the top line in the display
147663128Sps              is used, an "m" means use the middle  line,  a  "b"
147763128Sps              means use the bottom line, a "B" means use the line
147863128Sps              just after the bottom line, and a "j" means use the
147963128Sps              "target" line, as specified by the -j option.
148060786Sps
148160786Sps       %B     Replaced by the size of the current input file.
148260786Sps
148360786Sps       %c     Replaced by the column number of the text appearing
148460786Sps              in the first column of the screen.
148560786Sps
148663128Sps       %d_X    Replaced by the page number of a line in the  input
148763128Sps              file.   The line to be used is determined by the _X,
148860786Sps              as with the %b option.
148960786Sps
149063128Sps       %D     Replaced by the number of pages in the input  file,
149163128Sps              or  equivalently,  the page number of the last line
149260786Sps              in the input file.
149360786Sps
149460786Sps       %E     Replaced by the name of the editor (from the VISUAL
149563128Sps              environment  variable,  or  the  EDITOR environment
149663128Sps              variable if VISUAL is not defined).  See  the  dis-
149760786Sps              cussion of the LESSEDIT feature below.
149860786Sps
149960786Sps       %f     Replaced by the name of the current input file.
150060786Sps
150163128Sps       %i     Replaced  by  the  index of the current file in the
150260786Sps              list of input files.
150360786Sps
150463128Sps       %l_X    Replaced by the line number of a line in the  input
150563128Sps              file.   The line to be used is determined by the _X,
150660786Sps              as with the %b option.
150760786Sps
150860786Sps       %L     Replaced by the line number of the last line in the
150960786Sps              input file.
151060786Sps
151160786Sps       %m     Replaced by the total number of input files.
151260786Sps
151360786Sps
151460786Sps
151560786Sps
151663128Sps                     Version 358: 08 Jul 2000                  23
151760786Sps
151860786Sps
151960786Sps
152060786Sps
152160786Sps
152263128SpsLESS(1)                                                   LESS(1)
152360786Sps
152460786Sps
152563128Sps       %p_X    Replaced  by  the  percent  into  the current input
152663128Sps              file, based on byte  offsets.   The  line  used  is
152763128Sps              determined by the _X as with the %b option.
152860786Sps
152963128Sps       %P_X    Replaced  by  the  percent  into  the current input
153063128Sps              file, based on line  numbers.   The  line  used  is
153163128Sps              determined by the _X as with the %b option.
153260786Sps
153363128Sps       %s     Same as %B.
153460786Sps
153563128Sps       %t     Causes  any trailing spaces to be removed.  Usually
153663128Sps              used at the end of the string, but may appear  any-
153763128Sps              where.
153860786Sps
153963128Sps       %x     Replaced  by the name of the next input file in the
154063128Sps              list.
154160786Sps
154263128Sps       If any item is unknown (for  example,  the  file  size  if
154363128Sps       input is a pipe), a question mark is printed instead.
154460786Sps
154563128Sps       The  format  of the prompt string can be changed depending
154663128Sps       on certain conditions.  A question mark followed by a sin-
154763128Sps       gle  character acts like an "IF": depending on the follow-
154863128Sps       ing character, a condition is evaluated.  If the condition
154963128Sps       is  true,  any  characters following the question mark and
155063128Sps       condition character, up to a period, are included  in  the
155163128Sps       prompt.   If  the  condition is false, such characters are
155263128Sps       not included.  A colon appearing between the question mark
155363128Sps       and  the  period  can  be used to establish an "ELSE": any
155463128Sps       characters between the colon and the period  are  included
155563128Sps       in  the  string  if and only if the IF condition is false.
155663128Sps       Condition characters (which follow a  question  mark)  may
155763128Sps       be:
155860786Sps
155963128Sps       ?a     True  if  any  characters have been included in the
156060786Sps              prompt so far.
156160786Sps
156263128Sps       ?b_X    True if the byte offset of the  specified  line  is
156360786Sps              known.
156460786Sps
156560786Sps       ?B     True if the size of current input file is known.
156660786Sps
156760786Sps       ?c     True if the text is horizontally shifted (%c is not
156860786Sps              zero).
156960786Sps
157063128Sps       ?d_X    True if the page number of the  specified  line  is
157160786Sps              known.
157260786Sps
157360786Sps       ?e     True if at end-of-file.
157460786Sps
157563128Sps       ?f     True  if  there  is  an input filename (that is, if
157660786Sps              input is not a pipe).
157760786Sps
157863128Sps       ?l_X    True if the line number of the  specified  line  is
157963128Sps
158063128Sps
158163128Sps
158263128Sps                     Version 358: 08 Jul 2000                  24
158363128Sps
158463128Sps
158563128Sps
158663128Sps
158763128Sps
158863128SpsLESS(1)                                                   LESS(1)
158963128Sps
159063128Sps
159160786Sps              known.
159260786Sps
159363128Sps       ?L     True  if  the  line  number of the last line in the
159460786Sps              file is known.
159560786Sps
159660786Sps       ?m     True if there is more than one input file.
159760786Sps
159863128Sps       ?n     True if this is the first prompt  in  a  new  input
159960786Sps              file.
160060786Sps
160163128Sps       ?p_X    True  if  the  percent into the current input file,
160263128Sps              based on byte offsets, of  the  specified  line  is
160360786Sps              known.
160460786Sps
160563128Sps       ?P_X    True  if  the  percent into the current input file,
160663128Sps              based on line numbers, of  the  specified  line  is
160760786Sps              known.
160860786Sps
160960786Sps       ?s     Same as "?B".
161060786Sps
161160786Sps       ?x     True if there is a next input file (that is, if the
161260786Sps              current input file is not the last one).
161360786Sps
161460786Sps       Any characters other than the special ones (question mark,
161563128Sps       colon,  period,  percent,  and backslash) become literally
161663128Sps       part of the prompt.  Any of the special characters may  be
161763128Sps       included  in  the  prompt literally by preceding it with a
161860786Sps       backslash.
161960786Sps
162060786Sps       Some examples:
162160786Sps
162260786Sps       ?f%f:Standard input.
162360786Sps
162463128Sps       This prompt prints the filename, if known;  otherwise  the
162560786Sps       string "Standard input".
162660786Sps
162760786Sps       ?f%f .?ltLine %lt:?pt%pt\%:?btByte %bt:-...
162860786Sps
162960786Sps       This prompt would print the filename, if known.  The file-
163063128Sps       name is followed by the line number, if  known,  otherwise
163163128Sps       the  percent if known, otherwise the byte offset if known.
163263128Sps       Otherwise, a dash is printed.  Notice  how  each  question
163360786Sps       mark has a matching period, and how the % after the %pt is
163460786Sps       included literally by escaping it with a backslash.
163560786Sps
163660786Sps       ?n?f%f .?m(file %i of %m) ..?e(END) ?x- Next\: %x..%t
163760786Sps
163863128Sps       This prints the filename if this is the first prompt in  a
163963128Sps       file,  followed  by  the "file N of N" message if there is
164060786Sps       more than one input file.  Then, if we are at end-of-file,
164163128Sps       the  string "(END)" is printed followed by the name of the
164263128Sps       next file, if there is one.  Finally, any trailing  spaces
164363128Sps       are  truncated.   This  is the default prompt.  For refer-
164463128Sps       ence, here are the defaults for the other two prompts  (-m
164563128Sps
164663128Sps
164763128Sps
164863128Sps                     Version 358: 08 Jul 2000                  25
164963128Sps
165063128Sps
165163128Sps
165263128Sps
165363128Sps
165463128SpsLESS(1)                                                   LESS(1)
165563128Sps
165663128Sps
165763128Sps       and  -M respectively).  Each is broken into two lines here
165860786Sps       for readability only.
165960786Sps
166060786Sps       ?n?f%f .?m(file %i of %m) ..?e(END) ?x- Next\: %x.:
166160786Sps            ?pB%pB\%:byte %bB?s/%s...%t
166260786Sps
166360786Sps       ?f%f .?n?m(file %i of %m) ..?ltlines %lt-%lb?L/%L. :
166460786Sps            byte %bB?s/%s. .?e(END) ?x- Next\: %x.:?pB%pB\%..%t
166560786Sps
166660786Sps       And here is the default message produced by the = command:
166760786Sps
166860786Sps       ?f%f .?m(file %i of %m) .?ltlines %lt-%lb?L/%L. .
166960786Sps            byte %bB?s/%s. ?e(END) :?pB%pB\%..%t
167060786Sps
167163128Sps       The  prompt  expansion  features are also used for another
167263128Sps       purpose: if an environment variable LESSEDIT  is  defined,
167363128Sps       it  is  used as the command to be executed when the v com-
167463128Sps       mand is invoked.  The LESSEDIT string is expanded  in  the
167563128Sps       same  way  as  the  prompt strings.  The default value for
167660786Sps       LESSEDIT is:
167760786Sps
167860786Sps            %E ?lm+%lm. %f
167960786Sps
168060786Sps       Note that this expands to the editor name, followed by a +
168163128Sps       and  the  line number, followed by the file name.  If your
168263128Sps       editor does not accept the "+linenumber"  syntax,  or  has
168360786Sps       other differences in invocation syntax, the LESSEDIT vari-
168460786Sps       able can be changed to modify this default.
168560786Sps
168660786Sps
168760786SpsSSEECCUURRIITTYY
168860786Sps       When the environment variable LESSSECURE is set to 1, _l_e_s_s
168963128Sps       runs  in  a  "secure" mode.  This means these features are
169060786Sps       disabled:
169160786Sps
169260786Sps              !      the shell command
169360786Sps
169460786Sps              |      the pipe command
169560786Sps
169660786Sps              :e     the examine command.
169760786Sps
169860786Sps              v      the editing command
169960786Sps
170060786Sps              s  -o  log files
170160786Sps
170260786Sps              -k     use of lesskey files
170360786Sps
170460786Sps              -t     use of tags files
170560786Sps
170660786Sps                     metacharacters in filenames, such as *
170760786Sps
170860786Sps                     filename completion (TAB, ^L)
170960786Sps
171063128Sps       Less can also be compiled to be  permanently  in  "secure"
171160786Sps
171260786Sps
171360786Sps
171463128Sps                     Version 358: 08 Jul 2000                  26
171560786Sps
171660786Sps
171760786Sps
171860786Sps
171960786Sps
172063128SpsLESS(1)                                                   LESS(1)
172160786Sps
172260786Sps
172363128Sps       mode.
172460786Sps
172560786Sps
172663128SpsEENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS
172763128Sps       Environment  variables may be specified either in the sys-
172863128Sps       tem environment as usual, or in a _l_e_s_s_k_e_y  (1)  file.   If
172963128Sps       environment  variables are defined in more than one place,
173063128Sps       variables defined in a local lesskey file take  precedence
173163128Sps       over  variables  defined  in the system environment, which
173263128Sps       take precedence over variables defined in the  system-wide
173363128Sps       lesskey file.
173460786Sps
173563128Sps       COLUMNS
173663128Sps              Sets  the  number  of columns on the screen.  Takes
173763128Sps              precedence over the number of columns specified  by
173863128Sps              the  TERM  variable.   (But if you have a windowing
173963128Sps              system which supports TIOCGWINSZ or  WIOCGETD,  the
174063128Sps              window  system's  idea  of  the  screen  size takes
174163128Sps              precedence over the LINES and  COLUMNS  environment
174263128Sps              variables.)
174360786Sps
174463128Sps       EDITOR The name of the editor (used for the v command).
174560786Sps
174663128Sps       HOME   Name  of  the user's home directory (used to find a
174760786Sps              lesskey file on Unix systems).
174860786Sps
174960786Sps       HOMEDRIVE, HOMEPATH
175063128Sps              Concatenation of the HOMEDRIVE and  HOMEPATH  envi-
175163128Sps              ronment  variables  is  the name of the user's home
175263128Sps              directory if the HOME variable is not set (only  in
175360786Sps              the Windows version).
175460786Sps
175563128Sps       INIT   Name  of  the user's init directory (used to find a
175660786Sps              lesskey file on OS/2 systems).
175760786Sps
175860786Sps       LANG   Language for determining the character set.
175960786Sps
176060786Sps       LC_CTYPE
176160786Sps              Language for determining the character set.
176260786Sps
176360786Sps       LESS   Options which are passed to _l_e_s_s automatically.
176460786Sps
176560786Sps       LESSANSIENDCHARS
176663128Sps              Characters which are assumed to end an  ANSI  color
176760786Sps              escape sequence (default "m").
176860786Sps
176960786Sps       LESSBINFMT
177063128Sps              Format  for  displaying  non-printable, non-control
177160786Sps              characters.
177260786Sps
177360786Sps       LESSCHARDEF
177460786Sps              Defines a character set.
177560786Sps
177663128Sps
177763128Sps
177863128Sps
177963128Sps
178063128Sps                     Version 358: 08 Jul 2000                  27
178163128Sps
178263128Sps
178363128Sps
178463128Sps
178563128Sps
178663128SpsLESS(1)                                                   LESS(1)
178763128Sps
178863128Sps
178960786Sps       LESSCHARSET
179060786Sps              Selects a predefined character set.
179160786Sps
179260786Sps       LESSCLOSE
179363128Sps              Command line to invoke the  (optional)  input-post-
179460786Sps              processor.
179560786Sps
179660786Sps       LESSECHO
179763128Sps              Name  of the lessecho program (default "lessecho").
179863128Sps              The lessecho program is needed to expand  metachar-
179963128Sps              acters,  such as * and ?, in filenames on Unix sys-
180060786Sps              tems.
180160786Sps
180260786Sps       LESSEDIT
180363128Sps              Editor prototype string (used for the  v  command).
180460786Sps              See discussion under PROMPTS.
180560786Sps
180660786Sps       LESSKEY
180760786Sps              Name of the default lesskey(1) file.
180860786Sps
180960786Sps       LESSKEY_SYSTEM
181060786Sps              Name of the default system-wide lesskey(1) file.
181160786Sps
181260786Sps       LESSMETACHARS
181363128Sps              List  of characters which are considered "metachar-
181460786Sps              acters" by the shell.
181560786Sps
181660786Sps       LESSMETAESCAPE
181763128Sps              Prefix which less will add before each  metacharac-
181863128Sps              ter  in  a  command  sent  to  the shell.  If LESS-
181963128Sps              METAESCAPE is an empty string, commands  containing
182060786Sps              metacharacters will not be passed to the shell.
182160786Sps
182260786Sps       LESSOPEN
182360786Sps              Command line to invoke the (optional) input-prepro-
182460786Sps              cessor.
182560786Sps
182660786Sps       LESSSECURE
182763128Sps              Runs less in "secure" mode.  See  discussion  under
182860786Sps              SECURITY.
182960786Sps
183060786Sps       LESSSEPARATOR
183163128Sps              String  to be appended to a directory name in file-
183260786Sps              name completion.
183360786Sps
183463128Sps       LINES  Sets the number of  lines  on  the  screen.   Takes
183563128Sps              precedence  over  the  number of lines specified by
183663128Sps              the TERM variable.  (But if you  have  a  windowing
183763128Sps              system  which  supports TIOCGWINSZ or WIOCGETD, the
183863128Sps              window system's  idea  of  the  screen  size  takes
183963128Sps              precedence  over  the LINES and COLUMNS environment
184060786Sps              variables.)
184160786Sps
184263128Sps       PATH   User's search path (used to find a lesskey file  on
184363128Sps
184463128Sps
184563128Sps
184663128Sps                     Version 358: 08 Jul 2000                  28
184763128Sps
184863128Sps
184963128Sps
185063128Sps
185163128Sps
185263128SpsLESS(1)                                                   LESS(1)
185363128Sps
185463128Sps
185560786Sps              MS-DOS and OS/2 systems).
185660786Sps
185760786Sps       SHELL  The shell used to execute the ! command, as well as
185860786Sps              to expand filenames.
185960786Sps
186060786Sps       TERM   The type of terminal on which _l_e_s_s is being run.
186160786Sps
186260786Sps       VISUAL The name of the editor (used for the v command).
186360786Sps
186460786Sps
186560786SpsSSEEEE AALLSSOO
186660786Sps       lesskey(1)
186760786Sps
186860786Sps
186960786SpsWWAARRNNIINNGGSS
187063128Sps       The = command and prompts (unless changed  by  -P)  report
187160786Sps       the line numbers of the lines at the top and bottom of the
187260786Sps       screen, but the byte and percent of the line after the one
187360786Sps       at the bottom of the screen.
187460786Sps
187563128Sps       If  the :e command is used to name more than one file, and
187660786Sps       one of the named files has been viewed previously, the new
187760786Sps       files may be entered into the list in an unexpected order.
187860786Sps
187963128Sps       On certain older terminals (the so-called  "magic  cookie"
188063128Sps       terminals),  search  highlighting  will cause an erroneous
188163128Sps       display.  On such terminals, search highlighting  is  dis-
188263128Sps       abled by default to avoid possible problems.
188360786Sps
188463128Sps       In  certain cases, when search highlighting is enabled and
188563128Sps       a search pattern begins with  a  ^,  more  text  than  the
188663128Sps       matching  string  may  be highlighted.  (This problem does
188763128Sps       not occur when less is compiled to use the  POSIX  regular
188863128Sps       expression package.)
188960786Sps
189063128Sps       On  some systems, _s_e_t_l_o_c_a_l_e claims that ASCII characters 0
189163128Sps       thru 31 are control characters rather than binary  charac-
189263128Sps       ters.   This  causes  _l_e_s_s  to  treat some binary files as
189363128Sps       ordinary, non-binary files.  To workaround  this  problem,
189463128Sps       set  the  environment  variable LESSCHARSET to "ascii" (or
189563128Sps       whatever character set is appropriate).
189660786Sps
189763128Sps       See http://www.flash.net/~marknu/less for the latest  list
189863128Sps       of known bugs in this version of less.
189960786Sps
190060786Sps
190163128SpsCCOOPPYYRRIIGGHHTT
190263128Sps       Copyright (C) 2000  Mark Nudelman
190360786Sps
190463128Sps       less is part of the GNU project and is free software.  You
190563128Sps       can redistribute it and/or modify it under  the  terms  of
190663128Sps       either  (1) the GNU General Public License as published by
190763128Sps       the Free Software Foundation; or  (2)  the  Less  License.
190863128Sps       See  the  file  README  in  the less distribution for more
190960786Sps
191060786Sps
191160786Sps
191263128Sps                     Version 358: 08 Jul 2000                  29
191360786Sps
191460786Sps
191560786Sps
191660786Sps
191760786Sps
191863128SpsLESS(1)                                                   LESS(1)
191960786Sps
192063128Sps
192163128Sps       details  regarding  redistribution.    You   should   have
192263128Sps       received  a  copy  of the GNU General Public License along
192363128Sps       with the source for less; see the file COPYING.   If  not,
192463128Sps       write  to  the  Free Software Foundation, 59 Temple Place,
192563128Sps       Suite 330, Boston, MA  02111-1307, USA.  You  should  also
192663128Sps       have  received  a  copy  of the Less License; see the file
192760786Sps       LICENSE.
192860786Sps
192963128Sps       less is distributed in the hope that it  will  be  useful,
193063128Sps       but  WITHOUT  ANY  WARRANTY; without even the implied war-
193163128Sps       ranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR  PUR-
193260786Sps       POSE.   See  the  GNU  General  Public  License  for  more
193360786Sps       details.
193460786Sps
193560786Sps
193660786SpsAAUUTTHHOORR
193760786Sps       Mark Nudelman <marknu@flash.net>
193863128Sps       Send bug reports or comments to the above  address  or  to
193960786Sps       bug-less@gnu.org.
194060786Sps
194160786Sps
194260786Sps
194360786Sps
194460786Sps
194560786Sps
194660786Sps
194760786Sps
194860786Sps
194960786Sps
195063128Sps
195163128Sps
195263128Sps
195363128Sps
195463128Sps
195563128Sps
195663128Sps
195763128Sps
195863128Sps
195963128Sps
196063128Sps
196163128Sps
196263128Sps
196363128Sps
196463128Sps
196563128Sps
196663128Sps
196763128Sps
196863128Sps
196963128Sps
197063128Sps
197163128Sps
197263128Sps
197363128Sps
197463128Sps
197563128Sps
197663128Sps
197763128Sps
197863128Sps                     Version 358: 08 Jul 2000                  30
197963128Sps
198063128Sps
1981