less.man revision 170256
1161475SdelphijLESS(1)                                                                LESS(1)
260786Sps
360786Sps
460786Sps
5170256Sdelphij[1mNAME[0m
660786Sps       less - opposite of more
760786Sps
8170256Sdelphij[1mSYNOPSIS[0m
9170256Sdelphij       [1mless -?[0m
10170256Sdelphij       [1mless --help[0m
11170256Sdelphij       [1mless -V[0m
12170256Sdelphij       [1mless --version[0m
13170256Sdelphij       [1mless [-[+]aBcCdeEfFgGiIJKLmMnNqQrRsSuUVwWX~][0m
14170256Sdelphij            [1m[-b [4m[22mspace[24m[1m] [-h [4m[22mlines[24m[1m] [-j [4m[22mline[24m[1m] [-k [4m[22mkeyfile[24m[1m][0m
15170256Sdelphij            [1m[-{oO} [4m[22mlogfile[24m[1m] [-p [4m[22mpattern[24m[1m] [-P [4m[22mprompt[24m[1m] [-t [4m[22mtag[24m[1m][0m
16170256Sdelphij            [1m[-T [4m[22mtagsfile[24m[1m] [-x [4m[22mtab[24m[1m,...] [-y [4m[22mlines[24m[1m] [-[z] [4m[22mlines[24m[1m][0m
17170256Sdelphij            [1m[-# [4m[22mshift[24m[1m] [+[+][4m[22mcmd[24m[1m] [--] [[4m[22mfilename[24m[1m]...[0m
18161475Sdelphij       (See  the  OPTIONS section for alternate option syntax with long option
19161475Sdelphij       names.)
2060786Sps
2160786Sps
22170256Sdelphij[1mDESCRIPTION[0m
23170256Sdelphij       [4mLess[24m is a program similar to [4mmore[24m (1), but which allows backward  move-
24170256Sdelphij       ment in the file as well as forward movement.  Also, [4mless[24m does not have
25161475Sdelphij       to read the entire input file before  starting,  so  with  large  input
26170256Sdelphij       files  it  starts  up  faster than text editors like [4mvi[24m (1).  [4mLess[24m uses
27161475Sdelphij       termcap (or terminfo on some systems), so it can run on  a  variety  of
28161475Sdelphij       terminals.   There is even limited support for hardcopy terminals.  (On
29161475Sdelphij       a hardcopy terminal, lines which should be printed at the  top  of  the
30161475Sdelphij       screen are prefixed with a caret.)
3160786Sps
32170256Sdelphij       Commands  are based on both [4mmore[24m and [4mvi.[24m  Commands may be preceded by a
33161475Sdelphij       decimal number, called N in the descriptions below.  The number is used
34161475Sdelphij       by some commands, as indicated.
3560786Sps
3660786Sps
37170256Sdelphij[1mCOMMANDS[0m
38161475Sdelphij       In  the following descriptions, ^X means control-X.  ESC stands for the
39161475Sdelphij       ESCAPE  key;  for  example  ESC-v  means  the  two  character  sequence
40161475Sdelphij       "ESCAPE", then "v".
4160786Sps
42161475Sdelphij       h or H Help:  display  a  summary of these commands.  If you forget all
43161475Sdelphij              the other commands, remember this one.
4460786Sps
4560786Sps       SPACE or ^V or f or ^F
46161475Sdelphij              Scroll forward N  lines,  default  one  window  (see  option  -z
47161475Sdelphij              below).   If  N  is  more  than  the screen size, only the final
48161475Sdelphij              screenful is displayed.  Warning: some systems use ^V as a  spe-
49161475Sdelphij              cial literalization character.
5060786Sps
51161475Sdelphij       z      Like  SPACE,  but  if  N is specified, it becomes the new window
52161475Sdelphij              size.
5360786Sps
5460786Sps       ESC-SPACE
55161475Sdelphij              Like SPACE, but scrolls a full screenful,  even  if  it  reaches
56161475Sdelphij              end-of-file in the process.
5760786Sps
5860786Sps       RETURN or ^N or e or ^E or j or ^J
59161475Sdelphij              Scroll  forward N lines, default 1.  The entire N lines are dis-
60161475Sdelphij              played, even if N is more than the screen size.
6160786Sps
6260786Sps       d or ^D
63161475Sdelphij              Scroll forward N lines, default one half of the screen size.  If
64161475Sdelphij              N  is specified, it becomes the new default for subsequent d and
65161475Sdelphij              u commands.
6660786Sps
6760786Sps       b or ^B or ESC-v
68161475Sdelphij              Scroll backward N lines,  default  one  window  (see  option  -z
69161475Sdelphij              below).   If  N  is  more  than  the screen size, only the final
70161475Sdelphij              screenful is displayed.
7160786Sps
72161475Sdelphij       w      Like ESC-v, but if N is specified, it  becomes  the  new  window
73161475Sdelphij              size.
7460786Sps
7560786Sps       y or ^Y or ^P or k or ^K
76161475Sdelphij              Scroll backward N lines, default 1.  The entire N lines are dis-
77161475Sdelphij              played, even if N is more than the screen size.   Warning:  some
78161475Sdelphij              systems use ^Y as a special job control character.
7960786Sps
8060786Sps       u or ^U
81161475Sdelphij              Scroll  backward  N  lines, default one half of the screen size.
82161475Sdelphij              If N is specified, it becomes the new default for  subsequent  d
83161475Sdelphij              and u commands.
8460786Sps
8560786Sps       ESC-) or RIGHTARROW
86161475Sdelphij              Scroll  horizontally right N characters, default half the screen
87161475Sdelphij              width (see the -# option).  If  a  number  N  is  specified,  it
88161475Sdelphij              becomes  the  default  for  future RIGHTARROW and LEFTARROW com-
89161475Sdelphij              mands.  While the text is scrolled, it acts  as  though  the  -S
9089019Sps              option (chop lines) were in effect.
9160786Sps
9260786Sps       ESC-( or LEFTARROW
93161475Sdelphij              Scroll  horizontally  left N characters, default half the screen
94161475Sdelphij              width (see the -# option).  If  a  number  N  is  specified,  it
95161475Sdelphij              becomes  the  default  for  future RIGHTARROW and LEFTARROW com-
96161475Sdelphij              mands.
9760786Sps
9860786Sps       r or ^R or ^L
9960786Sps              Repaint the screen.
10060786Sps
101161475Sdelphij       R      Repaint the screen, discarding any buffered  input.   Useful  if
102161475Sdelphij              the file is changing while it is being viewed.
10360786Sps
104161475Sdelphij       F      Scroll  forward, and keep trying to read when the end of file is
105161475Sdelphij              reached.  Normally this command would be used  when  already  at
106161475Sdelphij              the  end of the file.  It is a way to monitor the tail of a file
107161475Sdelphij              which is growing while it is being  viewed.   (The  behavior  is
10860786Sps              similar to the "tail -f" command.)
10960786Sps
11060786Sps       g or < or ESC-<
111161475Sdelphij              Go to line N in the file, default 1 (beginning of file).  (Warn-
112161475Sdelphij              ing: this may be slow if N is large.)
11360786Sps
11460786Sps       G or > or ESC->
115161475Sdelphij              Go to line N in the file, default the end of the  file.   (Warn-
116161475Sdelphij              ing:  this  may  be slow if N is large, or if N is not specified
117161475Sdelphij              and standard input, rather than a file, is being read.)
11860786Sps
119161475Sdelphij       p or % Go to a position N percent into the file.  N should be between 0
120170256Sdelphij              and 100, and may contain a decimal point.
12160786Sps
122170256Sdelphij       P      Go to the line containing byte offset N in the file.
123170256Sdelphij
124161475Sdelphij       {      If a left curly bracket appears in the top line displayed on the
125161475Sdelphij              screen, the { command  will  go  to  the  matching  right  curly
126161475Sdelphij              bracket.   The matching right curly bracket is positioned on the
127161475Sdelphij              bottom line of the screen.  If there is more than one left curly
128161475Sdelphij              bracket  on  the top line, a number N may be used to specify the
129161475Sdelphij              N-th bracket on the line.
13060786Sps
131161475Sdelphij       }      If a right curly bracket appears in the bottom line displayed on
132161475Sdelphij              the  screen,  the  }  command will go to the matching left curly
133161475Sdelphij              bracket.  The matching left curly bracket is positioned  on  the
134161475Sdelphij              top  line  of the screen.  If there is more than one right curly
135161475Sdelphij              bracket on the top line, a number N may be used to  specify  the
136161475Sdelphij              N-th bracket on the line.
13760786Sps
138161475Sdelphij       (      Like {, but applies to parentheses rather than curly brackets.
13960786Sps
140161475Sdelphij       )      Like }, but applies to parentheses rather than curly brackets.
14160786Sps
142161475Sdelphij       [      Like  {, but applies to square brackets rather than curly brack-
143161475Sdelphij              ets.
14460786Sps
145161475Sdelphij       ]      Like }, but applies to square brackets rather than curly  brack-
146161475Sdelphij              ets.
14760786Sps
148161475Sdelphij       ESC-^F Followed  by two characters, acts like {, but uses the two char-
149161475Sdelphij              acters as open and close brackets, respectively.   For  example,
150161475Sdelphij              "ESC  ^F < >" could be used to go forward to the > which matches
151161475Sdelphij              the < in the top displayed line.
15260786Sps
153161475Sdelphij       ESC-^B Followed by two characters, acts like }, but uses the two  char-
154161475Sdelphij              acters  as  open and close brackets, respectively.  For example,
155161475Sdelphij              "ESC ^B < >" could be used to go backward to the < which matches
156161475Sdelphij              the > in the bottom displayed line.
15760786Sps
158161475Sdelphij       m      Followed  by  any  lowercase  letter, marks the current position
159161475Sdelphij              with that letter.
16060786Sps
161161475Sdelphij       '      (Single quote.)  Followed by any lowercase  letter,  returns  to
162161475Sdelphij              the position which was previously marked with that letter.  Fol-
163161475Sdelphij              lowed by another single quote, returns to the position at  which
164161475Sdelphij              the last "large" movement command was executed.  Followed by a ^
165161475Sdelphij              or $, jumps to the beginning or end of  the  file  respectively.
166161475Sdelphij              Marks  are  preserved when a new file is examined, so the ' com-
167161475Sdelphij              mand can be used to switch between input files.
16860786Sps
16960786Sps       ^X^X   Same as single quote.
17060786Sps
17160786Sps       /pattern
172161475Sdelphij              Search forward in the file for the N-th line containing the pat-
173161475Sdelphij              tern.  N defaults to 1.  The pattern is a regular expression, as
174161475Sdelphij              recognized by the regular expression library  supplied  by  your
175161475Sdelphij              system.  The search starts at the second line displayed (but see
17660786Sps              the -a and -j options, which change this).
17760786Sps
178161475Sdelphij              Certain characters are special if entered at  the  beginning  of
179161475Sdelphij              the  pattern;  they modify the type of search rather than become
180161475Sdelphij              part of the pattern:
18160786Sps
18260786Sps              ^N or !
183161475Sdelphij                     Search for lines which do NOT match the pattern.
18460786Sps
18560786Sps              ^E or *
186161475Sdelphij                     Search multiple files.  That is, if  the  search  reaches
187161475Sdelphij                     the  END of the current file without finding a match, the
188161475Sdelphij                     search continues in the next file  in  the  command  line
18960786Sps                     list.
19060786Sps
19160786Sps              ^F or @
192161475Sdelphij                     Begin  the  search at the first line of the FIRST file in
193161475Sdelphij                     the command line list, regardless of  what  is  currently
194161475Sdelphij                     displayed  on  the screen or the settings of the -a or -j
19560786Sps                     options.
19660786Sps
197161475Sdelphij              ^K     Highlight any text which matches the pattern on the  cur-
198170256Sdelphij                     rent  screen,  but  don't  move  to the first match (KEEP
199170256Sdelphij                     current position).
20060786Sps
201161475Sdelphij              ^R     Don't interpret regular expression  metacharacters;  that
202161475Sdelphij                     is, do a simple textual comparison.
20360786Sps
20463128Sps       ?pattern
205161475Sdelphij              Search  backward  in  the  file for the N-th line containing the
206161475Sdelphij              pattern.  The search starts at the line immediately  before  the
207161475Sdelphij              top line displayed.
20863128Sps
20960786Sps              Certain characters are special as in the / command:
21060786Sps
21160786Sps              ^N or !
212161475Sdelphij                     Search for lines which do NOT match the pattern.
21360786Sps
21460786Sps              ^E or *
215161475Sdelphij                     Search  multiple  files.   That is, if the search reaches
216161475Sdelphij                     the beginning of  the  current  file  without  finding  a
217161475Sdelphij                     match,  the  search continues in the previous file in the
218161475Sdelphij                     command line list.
21960786Sps
22060786Sps              ^F or @
221161475Sdelphij                     Begin the search at the last line of the last file in the
222161475Sdelphij                     command  line  list, regardless of what is currently dis-
223161475Sdelphij                     played on the screen or the settings  of  the  -a  or  -j
22460786Sps                     options.
22560786Sps
22660786Sps              ^K     As in forward searches.
22760786Sps
22860786Sps              ^R     As in forward searches.
22960786Sps
23060786Sps       ESC-/pattern
23160786Sps              Same as "/*".
23260786Sps
23360786Sps       ESC-?pattern
23460786Sps              Same as "?*".
23560786Sps
236161475Sdelphij       n      Repeat  previous  search, for N-th line containing the last pat-
237161475Sdelphij              tern.  If the previous search was modified by ^N, the search  is
238161475Sdelphij              made  for the N-th line NOT containing the pattern.  If the pre-
239161475Sdelphij              vious search was modified by ^E, the  search  continues  in  the
240161475Sdelphij              next  (or  previous)  file if not satisfied in the current file.
241161475Sdelphij              If the previous search was modified by ^R, the  search  is  done
242161475Sdelphij              without  using  regular  expressions.  There is no effect if the
243161475Sdelphij              previous search was modified by ^F or ^K.
24460786Sps
245161475Sdelphij       N      Repeat previous search, but in the reverse direction.
24660786Sps
247161475Sdelphij       ESC-n  Repeat previous  search,  but  crossing  file  boundaries.   The
248161475Sdelphij              effect is as if the previous search were modified by *.
24960786Sps
250161475Sdelphij       ESC-N  Repeat  previous search, but in the reverse direction and cross-
251161475Sdelphij              ing file boundaries.
25260786Sps
253161475Sdelphij       ESC-u  Undo search highlighting.   Turn  off  highlighting  of  strings
254161475Sdelphij              matching the current search pattern.  If highlighting is already
255161475Sdelphij              off because of a previous ESC-u command, turn highlighting  back
256161475Sdelphij              on.   Any  search  command  will also turn highlighting back on.
257161475Sdelphij              (Highlighting can also be disabled by toggling the -G option; in
258161475Sdelphij              that case search commands do not turn highlighting back on.)
25960786Sps
26060786Sps       :e [filename]
261161475Sdelphij              Examine  a  new file.  If the filename is missing, the "current"
262161475Sdelphij              file (see the :n and :p commands below) from the list  of  files
263161475Sdelphij              in  the  command line is re-examined.  A percent sign (%) in the
264161475Sdelphij              filename is replaced by the name of the current file.   A  pound
265161475Sdelphij              sign  (#)  is  replaced  by  the name of the previously examined
266161475Sdelphij              file.   However,  two  consecutive  percent  signs  are   simply
267161475Sdelphij              replaced with a single percent sign.  This allows you to enter a
268161475Sdelphij              filename that contains a percent sign in the  name.   Similarly,
269161475Sdelphij              two  consecutive  pound  signs  are replaced with a single pound
270161475Sdelphij              sign.  The filename is inserted into the command  line  list  of
271161475Sdelphij              files  so  that it can be seen by subsequent :n and :p commands.
272161475Sdelphij              If the filename consists of several files, they are all inserted
273161475Sdelphij              into  the  list  of files and the first one is examined.  If the
274161475Sdelphij              filename contains one or more spaces, the entire filename should
275161475Sdelphij              be enclosed in double quotes (also see the -" option).
27660786Sps
27760786Sps       ^X^V or E
278161475Sdelphij              Same  as :e.  Warning: some systems use ^V as a special literal-
279161475Sdelphij              ization character.  On such systems, you may not be able to  use
280161475Sdelphij              ^V.
28160786Sps
282161475Sdelphij       :n     Examine  the next file (from the list of files given in the com-
283161475Sdelphij              mand line).  If a number N is specified, the N-th next  file  is
284161475Sdelphij              examined.
28560786Sps
286161475Sdelphij       :p     Examine the previous file in the command line list.  If a number
287161475Sdelphij              N is specified, the N-th previous file is examined.
28860786Sps
289161475Sdelphij       :x     Examine the first file in the command line list.  If a number  N
290161475Sdelphij              is specified, the N-th file in the list is examined.
29160786Sps
29260786Sps       :d     Remove the current file from the list of files.
29360786Sps
294161475Sdelphij       t      Go  to the next tag, if there were more than one matches for the
295161475Sdelphij              current tag.  See the -t option for more details about tags.
29660786Sps
297161475Sdelphij       T      Go to the previous tag, if there were more than one matches  for
298161475Sdelphij              the current tag.
29960786Sps
30089019Sps       = or ^G or :f
301161475Sdelphij              Prints  some  information about the file being viewed, including
302161475Sdelphij              its name and the line number and byte offset of the bottom  line
303161475Sdelphij              being  displayed.  If possible, it also prints the length of the
304161475Sdelphij              file, the number of lines in the file and  the  percent  of  the
305161475Sdelphij              file above the last displayed line.
30660786Sps
307161475Sdelphij       -      Followed  by one of the command line option letters (see OPTIONS
308161475Sdelphij              below), this will change the setting of that option and print  a
309161475Sdelphij              message  describing  the  new  setting.   If a ^P (CONTROL-P) is
310161475Sdelphij              entered immediately after the dash, the setting of the option is
311161475Sdelphij              changed  but  no message is printed.  If the option letter has a
312161475Sdelphij              numeric value (such as -b or -h), or a string value (such as  -P
313161475Sdelphij              or  -t), a new value may be entered after the option letter.  If
314161475Sdelphij              no new value is entered, a message describing the  current  set-
315161475Sdelphij              ting is printed and nothing is changed.
31660786Sps
317161475Sdelphij       --     Like  the  -  command, but takes a long option name (see OPTIONS
318161475Sdelphij              below) rather than a  single  option  letter.   You  must  press
319161475Sdelphij              RETURN after typing the option name.  A ^P immediately after the
320161475Sdelphij              second dash suppresses printing of a message describing the  new
321161475Sdelphij              setting, as in the - command.
32260786Sps
323161475Sdelphij       -+     Followed  by  one  of  the command line option letters this will
324161475Sdelphij              reset the option to its default  setting  and  print  a  message
325170256Sdelphij              describing  the  new  setting.  (The "-+[4mX[24m" command does the same
326170256Sdelphij              thing as "-+[4mX[24m" on the command line.)  This  does  not  work  for
32760786Sps              string-valued options.
32860786Sps
329161475Sdelphij       --+    Like  the -+ command, but takes a long option name rather than a
330161475Sdelphij              single option letter.
33160786Sps
332161475Sdelphij       -!     Followed by one of the command line option  letters,  this  will
333161475Sdelphij              reset  the  option  to the "opposite" of its default setting and
334161475Sdelphij              print a message describing the new setting.  This does not  work
335161475Sdelphij              for numeric or string-valued options.
33660786Sps
337161475Sdelphij       --!    Like  the -! command, but takes a long option name rather than a
338161475Sdelphij              single option letter.
33960786Sps
340161475Sdelphij       _      (Underscore.)  Followed by one of the command line  option  let-
341161475Sdelphij              ters,  this  will print a message describing the current setting
342161475Sdelphij              of that option.  The setting of the option is not changed.
34360786Sps
344161475Sdelphij       __     (Double underscore.)  Like the _ (underscore) command, but takes
345161475Sdelphij              a long option name rather than a single option letter.  You must
346161475Sdelphij              press RETURN after typing the option name.
34760786Sps
348161475Sdelphij       +cmd   Causes the specified cmd to be executed each time a new file  is
349170256Sdelphij              examined.  For example, +G causes [4mless[24m to initially display each
350161475Sdelphij              file starting at the end rather than the beginning.
35160786Sps
352170256Sdelphij       V      Prints the version number of [4mless[24m being run.
35360786Sps
35460786Sps       q or Q or :q or :Q or ZZ
355170256Sdelphij              Exits [4mless.[0m
35660786Sps
357161475Sdelphij       The following four commands may or may not be valid, depending on  your
358161475Sdelphij       particular installation.
35960786Sps
36060786Sps
361161475Sdelphij       v      Invokes  an  editor  to edit the current file being viewed.  The
362161475Sdelphij              editor is taken from the environment variable VISUAL if defined,
363161475Sdelphij              or  EDITOR if VISUAL is not defined, or defaults to "vi" if nei-
364161475Sdelphij              ther VISUAL nor EDITOR is defined.  See also the  discussion  of
36560786Sps              LESSEDIT under the section on PROMPTS below.
36660786Sps
36760786Sps       ! shell-command
368161475Sdelphij              Invokes  a shell to run the shell-command given.  A percent sign
369161475Sdelphij              (%) in the command is replaced by the name of the current  file.
370161475Sdelphij              A pound sign (#) is replaced by the name of the previously exam-
371161475Sdelphij              ined file.  "!!" repeats the last shell command.   "!"  with  no
372161475Sdelphij              shell  command  simply  invokes  a  shell.  On Unix systems, the
373161475Sdelphij              shell is taken from the environment variable SHELL, or  defaults
374161475Sdelphij              to  "sh".   On  MS-DOS and OS/2 systems, the shell is the normal
375161475Sdelphij              command processor.
37660786Sps
37760786Sps       | <m> shell-command
378161475Sdelphij              <m> represents any mark letter.  Pipes a section  of  the  input
379161475Sdelphij              file  to the given shell command.  The section of the file to be
380161475Sdelphij              piped is between the first line on the current  screen  and  the
381161475Sdelphij              position  marked by the letter.  <m> may also be ^ or $ to indi-
382161475Sdelphij              cate beginning or end of file respectively.  If <m> is . or new-
383161475Sdelphij              line, the current screen is piped.
38460786Sps
38560786Sps       s filename
386161475Sdelphij              Save  the  input  to  a file.  This only works if the input is a
387161475Sdelphij              pipe, not an ordinary file.
38860786Sps
38960786Sps
390170256Sdelphij[1mOPTIONS[0m
391161475Sdelphij       Command line options are described below.  Most options may be  changed
392170256Sdelphij       while [4mless[24m is running, via the "-" command.
39389019Sps
394161475Sdelphij       Most  options  may be given in one of two forms: either a dash followed
395161475Sdelphij       by a single letter, or two dashes followed by a long  option  name.   A
396161475Sdelphij       long  option  name  may  be  abbreviated as long as the abbreviation is
397161475Sdelphij       unambiguous.  For example, --quit-at-eof may be abbreviated --quit, but
398161475Sdelphij       not --qui, since both --quit-at-eof and --quiet begin with --qui.  Some
399161475Sdelphij       long option names are in uppercase, such as --QUIT-AT-EOF, as  distinct
400170256Sdelphij       from  --quit-at-eof.  Such option names need only have their first let-
401170256Sdelphij       ter capitalized; the remainder of the name may be in either case.   For
402170256Sdelphij       example, --Quit-at-eof is equivalent to --QUIT-AT-EOF.
40360786Sps
404161475Sdelphij       Options are also taken from the environment variable "LESS".  For exam-
405170256Sdelphij       ple, to avoid typing "less -options ..." each time [4mless[24m is invoked, you
406170256Sdelphij       might tell [4mcsh:[0m
40760786Sps
40860786Sps       setenv LESS "-options"
40960786Sps
410170256Sdelphij       or if you use [4msh:[0m
41160786Sps
41260786Sps       LESS="-options"; export LESS
41360786Sps
414161475Sdelphij       On  MS-DOS,  you don't need the quotes, but you should replace any per-
415161475Sdelphij       cent signs in the options string by double percent signs.
41660786Sps
417161475Sdelphij       The environment variable is parsed before the command line, so  command
418161475Sdelphij       line  options  override  the  LESS  environment variable.  If an option
419161475Sdelphij       appears in the LESS variable, it can be reset to its default  value  on
420161475Sdelphij       the command line by beginning the command line option with "-+".
42160786Sps
422161475Sdelphij       For  options like -P or -D which take a following string, a dollar sign
423161475Sdelphij       ($) must be used to signal the end of the string.  For example, to  set
424161475Sdelphij       two  -D  options  on  MS-DOS, you must have a dollar sign between them,
425161475Sdelphij       like this:
42660786Sps
42760786Sps       LESS="-Dn9.1$-Ds4.1"
42860786Sps
42960786Sps
43060786Sps       -? or --help
431170256Sdelphij              This option displays a summary of the commands accepted by  [4mless[0m
432161475Sdelphij              (the  same  as  the  h  command).   (Depending on how your shell
433161475Sdelphij              interprets the question mark, it may be necessary to  quote  the
434161475Sdelphij              question mark, thus: "-\?".)
43560786Sps
43660786Sps       -a or --search-skip-screen
437161475Sdelphij              Causes  searches  to  start after the last line displayed on the
438161475Sdelphij              screen, thus skipping all lines displayed  on  the  screen.   By
439161475Sdelphij              default,  searches  start  at  the second line on the screen (or
440161475Sdelphij              after the last found line; see the -j option).
44160786Sps
442170256Sdelphij       -b[4mn[24m or --buffers=[4mn[0m
443170256Sdelphij              Specifies the amount of buffer space  [4mless[24m  will  use  for  each
444161475Sdelphij              file,  in  units  of  kilobytes (1024 bytes).  By default 64K of
445161475Sdelphij              buffer space is used for each file (unless the file is  a  pipe;
446170256Sdelphij              see  the  -B  option).   The  -b option specifies instead that [4mn[0m
447170256Sdelphij              kilobytes of buffer space should be used for each file.  If [4mn[24m is
448161475Sdelphij              -1,  buffer space is unlimited; that is, the entire file is read
449161475Sdelphij              into memory.
45063128Sps
45160786Sps       -B or --auto-buffers
452161475Sdelphij              By default, when data is read from a pipe, buffers are allocated
453161475Sdelphij              automatically as needed.  If a large amount of data is read from
454161475Sdelphij              the pipe, this can cause a large amount of memory  to  be  allo-
455161475Sdelphij              cated.   The  -B  option  disables  this automatic allocation of
456161475Sdelphij              buffers for pipes, so that only 64K  (or  the  amount  of  space
457161475Sdelphij              specified  by the -b option) is used for the pipe.  Warning: use
458161475Sdelphij              of -B can result in  erroneous  display,  since  only  the  most
459161475Sdelphij              recently  viewed part of the file is kept in memory; any earlier
460128345Stjr              data is lost.
46160786Sps
46260786Sps       -c or --clear-screen
463161475Sdelphij              Causes full screen repaints to be  painted  from  the  top  line
464161475Sdelphij              down.   By  default,  full screen repaints are done by scrolling
465161475Sdelphij              from the bottom of the screen.
46660786Sps
46760786Sps       -C or --CLEAR-SCREEN
468170256Sdelphij              Same as -c, for compatibility with older versions of [4mless.[0m
46960786Sps
47060786Sps       -d or --dumb
471161475Sdelphij              The -d option suppresses the error message normally displayed if
472170256Sdelphij              the  terminal is dumb; that is, lacks some important capability,
473161475Sdelphij              such as the ability to clear the screen or scroll backward.  The
474170256Sdelphij              -d  option  does  not otherwise change the behavior of [4mless[24m on a
475128345Stjr              dumb terminal.
47660786Sps
477170256Sdelphij       -D[1mx[4m[22mcolor[24m or --color=[1mx[4m[22mcolor[0m
478170256Sdelphij              [MS-DOS only] Sets the color of the text displayed.  [1mx [22mis a sin-
479170256Sdelphij              gle  character  which  selects  the  type of text whose color is
480170256Sdelphij              being set: n=normal, s=standout, d=bold, u=underlined,  k=blink.
481170256Sdelphij              [4mcolor[24m  is  a  pair  of numbers separated by a period.  The first
482170256Sdelphij              number selects the foreground color and the second  selects  the
483170256Sdelphij              background  color of the text.  A single number [4mN[24m is the same as
484170256Sdelphij              [4mN.0[24m.
48560786Sps
486128345Stjr       -e or --quit-at-eof
487170256Sdelphij              Causes [4mless[24m to automatically exit the  second  time  it  reaches
488170256Sdelphij              end-of-file.   By  default, the only way to exit [4mless[24m is via the
489161475Sdelphij              "q" command.
49063128Sps
49189019Sps       -E or --QUIT-AT-EOF
492170256Sdelphij              Causes [4mless[24m to automatically exit the first time it reaches end-
493161475Sdelphij              of-file.
49460786Sps
49563128Sps       -f or --force
496161475Sdelphij              Forces non-regular files to be opened.  (A non-regular file is a
497170256Sdelphij              directory or a device special file.)  Also suppresses the  warn-
498170256Sdelphij              ing message when a binary file is opened.  By default, [4mless[24m will
499170256Sdelphij              refuse to open non-regular files.  Note that some operating sys-
500170256Sdelphij              tems will not allow directories to be read, even if -f is set.
50160786Sps
50260786Sps       -F or --quit-if-one-screen
503170256Sdelphij              Causes [4mless[24m to automatically exit if the entire file can be dis-
504161475Sdelphij              played on the first screen.
50560786Sps
50660786Sps       -g or --hilite-search
507170256Sdelphij              Normally, [4mless[24m will highlight ALL strings which match  the  last
508161475Sdelphij              search  command.   The  -g option changes this behavior to high-
509161475Sdelphij              light only the particular string which was  found  by  the  last
510170256Sdelphij              search command.  This can cause [4mless[24m to run somewhat faster than
511161475Sdelphij              the default.
51260786Sps
51360786Sps       -G or --HILITE-SEARCH
514161475Sdelphij              The -G option suppresses all highlighting of  strings  found  by
515161475Sdelphij              search commands.
51660786Sps
517170256Sdelphij       -h[4mn[24m or --max-back-scroll=[4mn[0m
518161475Sdelphij              Specifies  a  maximum number of lines to scroll backward.  If it
519170256Sdelphij              is necessary to scroll backward more than [4mn[24m lines, the screen is
520161475Sdelphij              repainted in a forward direction instead.  (If the terminal does
521161475Sdelphij              not have the ability to scroll backward, -h0 is implied.)
52260786Sps
52360786Sps       -i or --ignore-case
524161475Sdelphij              Causes searches to ignore case; that is, uppercase and lowercase
525161475Sdelphij              are  considered identical.  This option is ignored if any upper-
526161475Sdelphij              case letters appear in the search pattern; in other words, if  a
527161475Sdelphij              pattern  contains  uppercase  letters, then that search does not
528161475Sdelphij              ignore case.
52960786Sps
53060786Sps       -I or --IGNORE-CASE
531161475Sdelphij              Like -i, but searches ignore case even if the  pattern  contains
532161475Sdelphij              uppercase letters.
53360786Sps
534170256Sdelphij       -j[4mn[24m or --jump-target=[4mn[0m
535161475Sdelphij              Specifies  a line on the screen where the "target" line is to be
536161475Sdelphij              positioned.  A target line is the object of a text  search,  tag
537161475Sdelphij              search,  jump  to  a  line number, jump to a file percentage, or
538170256Sdelphij              jump to a marked position.  The screen line may be specified  by
539170256Sdelphij              a number: the top line on the screen is 1, the next is 2, and so
540161475Sdelphij              on.  The number may be negative to specify a  line  relative  to
541161475Sdelphij              the  bottom  of the screen: the bottom line on the screen is -1,
542170256Sdelphij              the second to the bottom is -2, and  so  on.   Alternately,  the
543170256Sdelphij              screen  line may be specified as a fraction of the height of the
544170256Sdelphij              screen, starting with a decimal point: .5 is in  the  middle  of
545170256Sdelphij              the  screen, .3 is three tenths down from the first line, and so
546170256Sdelphij              on.  If the line is specified as a  fraction,  the  actual  line
547170256Sdelphij              number  is  recalculated  if  the terminal window is resized, so
548170256Sdelphij              that the target line remains at the specified  fraction  of  the
549170256Sdelphij              screen  height.  If the -j option is used, searches begin at the
550170256Sdelphij              line immediately after the target line.  For example,  if  "-j4"
551170256Sdelphij              is  used,  the  target line is the fourth line on the screen, so
552170256Sdelphij              searches begin at the fifth line on the screen.
55360786Sps
55463128Sps       -J or --status-column
555161475Sdelphij              Displays a status column at the left edge of  the  screen.   The
556161475Sdelphij              status  column  shows the lines that matched the current search.
557161475Sdelphij              The status column is also used if the -w  or  -W  option  is  in
558161475Sdelphij              effect.
55963128Sps
560170256Sdelphij       -k[4mfilename[24m or --lesskey-file=[4mfilename[0m
561170256Sdelphij              Causes  [4mless[24m  to  open and interpret the named file as a [4mlesskey[0m
562161475Sdelphij              (1) file.  Multiple -k options may be specified.  If the LESSKEY
563161475Sdelphij              or  LESSKEY_SYSTEM  environment variable is set, or if a lesskey
564161475Sdelphij              file is found in a standard place (see KEY BINDINGS), it is also
565170256Sdelphij              used as a [4mlesskey[24m file.
56660786Sps
567161475Sdelphij       -K or --quit-on-intr
568170256Sdelphij              Causes  [4mless[24m  to  exit  immediately  when an interrupt character
569161475Sdelphij              (usually ^C) is typed.  Normally, an interrupt character  causes
570170256Sdelphij              [4mless[24m  to  stop  whatever  it  is doing and return to its command
571161475Sdelphij              prompt.
572161475Sdelphij
573128345Stjr       -L or --no-lessopen
574161475Sdelphij              Ignore the LESSOPEN environment variable (see the INPUT  PREPRO-
575170256Sdelphij              CESSOR section below).  This option can be set from within [4mless[24m,
576161475Sdelphij              but it will apply only to files opened subsequently, not to  the
577161475Sdelphij              file which is currently open.
578128345Stjr
57960786Sps       -m or --long-prompt
580170256Sdelphij              Causes  [4mless[24m  to  prompt verbosely (like [4mmore[24m), with the percent
581170256Sdelphij              into the file.  By default, [4mless[24m prompts with a colon.
58260786Sps
58360786Sps       -M or --LONG-PROMPT
584170256Sdelphij              Causes [4mless[24m to prompt even more verbosely than [4mmore.[0m
58560786Sps
58660786Sps       -n or --line-numbers
587161475Sdelphij              Suppresses line numbers.  The default (to use line numbers)  may
588170256Sdelphij              cause  [4mless[24m  to run more slowly in some cases, especially with a
589161475Sdelphij              very large input file.  Suppressing line  numbers  with  the  -n
590161475Sdelphij              option  will  avoid this problem.  Using line numbers means: the
591161475Sdelphij              line number will be displayed in the verbose prompt and in the =
592161475Sdelphij              command,  and the v command will pass the current line number to
593161475Sdelphij              the editor (see also  the  discussion  of  LESSEDIT  in  PROMPTS
594161475Sdelphij              below).
59560786Sps
596128345Stjr       -N or --LINE-NUMBERS
597161475Sdelphij              Causes  a  line  number to be displayed at the beginning of each
598161475Sdelphij              line in the display.
59960786Sps
600170256Sdelphij       -o[4mfilename[24m or --log-file=[4mfilename[0m
601170256Sdelphij              Causes [4mless[24m to copy its input to the named file as it  is  being
602161475Sdelphij              viewed.  This applies only when the input file is a pipe, not an
603170256Sdelphij              ordinary file.  If the file already exists, [4mless[24m  will  ask  for
604161475Sdelphij              confirmation before overwriting it.
60560786Sps
606170256Sdelphij       -O[4mfilename[24m or --LOG-FILE=[4mfilename[0m
607161475Sdelphij              The -O option is like -o, but it will overwrite an existing file
608161475Sdelphij              without asking for confirmation.
60960786Sps
610161475Sdelphij              If no log file has been specified, the -o and -O options can  be
611170256Sdelphij              used  from  within  [4mless[24m  to specify a log file.  Without a file
612161475Sdelphij              name, they will simply report the name of the log file.  The "s"
613170256Sdelphij              command is equivalent to specifying -o from within [4mless.[0m
61463128Sps
615170256Sdelphij       -p[4mpattern[24m or --pattern=[4mpattern[0m
616161475Sdelphij              The  -p  option  on the command line is equivalent to specifying
617170256Sdelphij              +/[4mpattern[24m; that is, it tells [4mless[24m to start at the  first  occur-
618170256Sdelphij              rence of [4mpattern[24m in the file.
61963128Sps
620170256Sdelphij       -P[4mprompt[24m or --prompt=[4mprompt[0m
621161475Sdelphij              Provides  a  way  to  tailor the three prompt styles to your own
622161475Sdelphij              preference.  This option would normally be put in the LESS envi-
623170256Sdelphij              ronment variable, rather than being typed in with each [4mless[24m com-
624161475Sdelphij              mand.  Such an option must either be the last option in the LESS
625161475Sdelphij              variable,  or be terminated by a dollar sign.  -Ps followed by a
626161475Sdelphij              string changes the default (short) prompt to that  string.   -Pm
627161475Sdelphij              changes  the  medium  (-m)  prompt.   -PM  changes the long (-M)
628161475Sdelphij              prompt.  -Ph changes  the  prompt  for  the  help  screen.   -P=
629161475Sdelphij              changes  the  message printed by the = command.  -Pw changes the
630161475Sdelphij              message printed while waiting for data (in the F command).   All
631161475Sdelphij              prompt  strings  consist  of  a  sequence of letters and special
632161475Sdelphij              escape sequences.  See the section on PROMPTS for more  details.
63360786Sps
63460786Sps       -q or --quiet or --silent
635161475Sdelphij              Causes  moderately  "quiet"  operation: the terminal bell is not
636161475Sdelphij              rung if an attempt is made to scroll past the end of the file or
637161475Sdelphij              before the beginning of the file.  If the terminal has a "visual
638161475Sdelphij              bell", it is used instead.  The bell will  be  rung  on  certain
639161475Sdelphij              other  errors, such as typing an invalid character.  The default
640161475Sdelphij              is to ring the terminal bell in all such cases.
64160786Sps
642128345Stjr       -Q or --QUIET or --SILENT
643161475Sdelphij              Causes totally "quiet" operation: the  terminal  bell  is  never
644161475Sdelphij              rung.
645128345Stjr
646128345Stjr       -r or --raw-control-chars
647161475Sdelphij              Causes "raw" control characters to be displayed.  The default is
648161475Sdelphij              to display control characters  using  the  caret  notation;  for
649161475Sdelphij              example, a control-A (octal 001) is displayed as "^A".  Warning:
650170256Sdelphij              when the -r option is used, [4mless[24m cannot keep track of the actual
651161475Sdelphij              appearance  of  the screen (since this depends on how the screen
652161475Sdelphij              responds to each type of control character).  Thus, various dis-
653161475Sdelphij              play  problems may result, such as long lines being split in the
654161475Sdelphij              wrong place.
65560786Sps
65663128Sps       -R or --RAW-CONTROL-CHARS
657161475Sdelphij              Like -r, but only ANSI "color" escape sequences  are  output  in
658161475Sdelphij              "raw" form.  Unlike -r, the screen appearance is maintained cor-
659161475Sdelphij              rectly  in  most  cases.   ANSI  "color"  escape  sequences  are
660161475Sdelphij              sequences of the form:
66163128Sps
66263128Sps                   ESC [ ... m
66363128Sps
664161475Sdelphij              where  the  "..." is zero or more color specification characters
665161475Sdelphij              For the purpose of keeping  track  of  screen  appearance,  ANSI
666161475Sdelphij              color  escape sequences are assumed to not move the cursor.  You
667170256Sdelphij              can make [4mless[24m think that characters other than "m" can end  ANSI
668161475Sdelphij              color  escape  sequences  by  setting  the  environment variable
669161475Sdelphij              LESSANSIENDCHARS to the list of characters which can end a color
670170256Sdelphij              escape  sequence.   And  you can make [4mless[24m think that characters
671161475Sdelphij              other than the standard ones may appear between the ESC and  the
672161475Sdelphij              m  by  setting  the environment variable LESSANSIMIDCHARS to the
673161475Sdelphij              list of characters which can appear.
67460786Sps
67560786Sps       -s or --squeeze-blank-lines
676161475Sdelphij              Causes consecutive blank lines to  be  squeezed  into  a  single
677170256Sdelphij              blank line.  This is useful when viewing [4mnroff[24m output.
67860786Sps
67960786Sps       -S or --chop-long-lines
680161475Sdelphij              Causes  lines  longer than the screen width to be chopped rather
681161475Sdelphij              than folded.  That is, the portion of a long line that does  not
682161475Sdelphij              fit  in  the  screen width is not shown.  The default is to fold
683161475Sdelphij              long lines; that is, display the remainder on the next line.
68460786Sps
685170256Sdelphij       -t[4mtag[24m or --tag=[4mtag[0m
686161475Sdelphij              The -t option, followed immediately by a TAG, will edit the file
687161475Sdelphij              containing  that tag.  For this to work, tag information must be
688161475Sdelphij              available; for example, there may  be  a  file  in  the  current
689170256Sdelphij              directory called "tags", which was previously built by [4mctags[24m (1)
690161475Sdelphij              or an equivalent command.  If the environment variable LESSGLOB-
691161475Sdelphij              ALTAGS  is set, it is taken to be the name of a command compati-
692170256Sdelphij              ble with [4mglobal[24m (1), and that command is executed  to  find  the
693161475Sdelphij              tag.  (See http://www.gnu.org/software/global/global.html).  The
694170256Sdelphij              -t option may also be specified from within [4mless[24m  (using  the  -
695161475Sdelphij              command)  as a way of examining a new file.  The command ":t" is
696170256Sdelphij              equivalent to specifying -t from within [4mless.[0m
69760786Sps
698170256Sdelphij       -T[4mtagsfile[24m or --tag-file=[4mtagsfile[0m
69989019Sps              Specifies a tags file to be used instead of "tags".
70060786Sps
70189019Sps       -u or --underline-special
702161475Sdelphij              Causes backspaces and carriage returns to be treated  as  print-
703161475Sdelphij              able  characters;  that  is,  they are sent to the terminal when
704161475Sdelphij              they appear in the input.
70560786Sps
70689019Sps       -U or --UNDERLINE-SPECIAL
707161475Sdelphij              Causes backspaces, tabs and carriage returns to  be  treated  as
708161475Sdelphij              control  characters;  that  is, they are handled as specified by
709161475Sdelphij              the -r option.
71060786Sps
711161475Sdelphij              By default, if neither -u nor  -U  is  given,  backspaces  which
712161475Sdelphij              appear  adjacent  to  an  underscore  character are treated spe-
713161475Sdelphij              cially: the underlined text is displayed  using  the  terminal's
714161475Sdelphij              hardware  underlining capability.  Also, backspaces which appear
715161475Sdelphij              between two identical  characters  are  treated  specially:  the
716161475Sdelphij              overstruck  text  is printed using the terminal's hardware bold-
717161475Sdelphij              face capability.  Other backspaces are deleted, along  with  the
718161475Sdelphij              preceding character.  Carriage returns immediately followed by a
719161475Sdelphij              newline are deleted.  other  carriage  returns  are  handled  as
720161475Sdelphij              specified  by the -r option.  Text which is overstruck or under-
721161475Sdelphij              lined can be searched for if neither -u nor -U is in effect.
72260786Sps
72360786Sps       -V or --version
724170256Sdelphij              Displays the version number of [4mless.[0m
72560786Sps
72660786Sps       -w or --hilite-unread
727161475Sdelphij              Temporarily highlights the first  "new"  line  after  a  forward
728161475Sdelphij              movement of a full page.  The first "new" line is the line imme-
729161475Sdelphij              diately following the line  previously  at  the  bottom  of  the
730161475Sdelphij              screen.  Also highlights the target line after a g or p command.
731161475Sdelphij              The highlight is removed at the next command which causes  move-
732161475Sdelphij              ment.   The  entire line is highlighted, unless the -J option is
733161475Sdelphij              in effect, in which case only the status column is  highlighted.
73460786Sps
73560786Sps       -W or --HILITE-UNREAD
736161475Sdelphij              Like -w, but temporarily highlights the first new line after any
737161475Sdelphij              forward movement command larger than one line.
73860786Sps
739170256Sdelphij       -x[4mn[24m,... or --tabs=[4mn[24m,...
740170256Sdelphij              Sets tab stops.  If only one [4mn[24m is specified, tab stops  are  set
741170256Sdelphij              at  multiples  of [4mn[24m.  If multiple values separated by commas are
742170256Sdelphij              specified, tab stops  are  set  at  those  positions,  and  then
743170256Sdelphij              continue  with  the  same spacing as the last two.  For example,
744170256Sdelphij              [4m-x9,17[24m will set tabs at positions  9,  17,  25,  33,  etc.   The
745170256Sdelphij              default for [4mn[24m is 8.
74660786Sps
74789019Sps       -X or --no-init
748161475Sdelphij              Disables sending the termcap initialization and deinitialization
749161475Sdelphij              strings to the terminal.  This is  sometimes  desirable  if  the
750161475Sdelphij              deinitialization  string does something unnecessary, like clear-
751161475Sdelphij              ing the screen.
75260786Sps
75389019Sps       --no-keypad
754161475Sdelphij              Disables sending the keypad initialization and  deinitialization
755161475Sdelphij              strings to the terminal.  This is sometimes useful if the keypad
756161475Sdelphij              strings make the numeric keypad behave in an undesirable manner.
75760786Sps
758170256Sdelphij       -y[4mn[24m or --max-forw-scroll=[4mn[0m
759161475Sdelphij              Specifies a maximum number of lines to scroll forward.  If it is
760170256Sdelphij              necessary to scroll forward more than [4mn[24m  lines,  the  screen  is
761161475Sdelphij              repainted  instead.   The -c or -C option may be used to repaint
762161475Sdelphij              from the top of the screen if desired.  By default, any  forward
76389019Sps              movement causes scrolling.
76460786Sps
765170256Sdelphij       -[z][4mn[24m or --window=[4mn[0m
766170256Sdelphij              Changes  the  default  scrolling  window  size  to [4mn[24m lines.  The
767161475Sdelphij              default is one screenful.  The z and w commands can also be used
768161475Sdelphij              to  change the window size.  The "z" may be omitted for compati-
769170256Sdelphij              bility with some versions of [4mmore.[24m  If the number [4mn[24m is negative,
770170256Sdelphij              it  indicates  [4mn[24m  lines  less than the current screen size.  For
771170256Sdelphij              example, if the screen is 24 lines, [4m-z-4[24m sets the scrolling win-
772170256Sdelphij              dow  to  20  lines.   If  the screen is resized to 40 lines, the
773170256Sdelphij              scrolling window automatically changes to 36 lines.
77463128Sps
775170256Sdelphij       -[4m"cc[24m or --quotes=[4mcc[0m
776161475Sdelphij              Changes the filename quoting character.  This may  be  necessary
777161475Sdelphij              if  you are trying to name a file which contains both spaces and
778161475Sdelphij              quote characters.  Followed by a single character, this  changes
779161475Sdelphij              the  quote  character to that character.  Filenames containing a
780161475Sdelphij              space should then be surrounded by that character rather than by
781161475Sdelphij              double  quotes.   Followed  by  two characters, changes the open
782161475Sdelphij              quote to the first character, and the close quote to the  second
783161475Sdelphij              character.  Filenames containing a space should then be preceded
784161475Sdelphij              by the open quote character and  followed  by  the  close  quote
785161475Sdelphij              character.   Note  that  even  after  the  quote  characters are
786161475Sdelphij              changed, this option remains -" (a dash  followed  by  a  double
787161475Sdelphij              quote).
78860786Sps
789128345Stjr       -~ or --tilde
790161475Sdelphij              Normally lines after end of file are displayed as a single tilde
791161475Sdelphij              (~).  This option causes lines after end of file to be displayed
792161475Sdelphij              as blank lines.
79360786Sps
79463128Sps       -# or --shift
795161475Sdelphij              Specifies the default number of positions to scroll horizontally
796161475Sdelphij              in the RIGHTARROW and LEFTARROW commands.  If the number  speci-
797161475Sdelphij              fied  is  zero,  it  sets the default number of positions to one
798161475Sdelphij              half of the screen width.
79963128Sps
800161475Sdelphij       --     A command line argument of "--" marks the end  of  option  argu-
801161475Sdelphij              ments.   Any  arguments  following this are interpreted as file-
802161475Sdelphij              names.  This can be useful when viewing a file whose name begins
803161475Sdelphij              with a "-" or "+".
80460786Sps
805170256Sdelphij       +      If  a  command  line option begins with [1m+[22m, the remainder of that
806170256Sdelphij              option is taken to be an initial command to [4mless.[24m  For  example,
807170256Sdelphij              +G  tells  [4mless[24m  to start at the end of the file rather than the
808161475Sdelphij              beginning, and +/xyz tells it to start at the  first  occurrence
809161475Sdelphij              of  "xyz"  in  the file.  As a special case, +<number> acts like
810161475Sdelphij              +<number>g; that is, it starts the display at the specified line
811161475Sdelphij              number  (however,  see  the caveat under the "g" command above).
812161475Sdelphij              If the option starts with ++, the  initial  command  applies  to
813161475Sdelphij              every  file being viewed, not just the first one.  The + command
814161475Sdelphij              described previously may also be used to set (or change) an ini-
815161475Sdelphij              tial command for every file.
81660786Sps
81760786Sps
818170256Sdelphij[1mLINE EDITING[0m
819161475Sdelphij       When  entering command line at the bottom of the screen (for example, a
820170256Sdelphij       filename for the :e command, or the pattern for a search command), cer-
821170256Sdelphij       tain  keys  can  be used to manipulate the command line.  Most commands
822161475Sdelphij       have an alternate form in [ brackets ] which can be used if a key  does
823161475Sdelphij       not  exist  on a particular keyboard.  (The bracketed forms do not work
824161475Sdelphij       in the MS-DOS version.)  Any of these special keys may be entered  lit-
825161475Sdelphij       erally  by  preceding it with the "literal" character, either ^V or ^A.
826161475Sdelphij       A backslash itself may also be entered literally by entering two  back-
827161475Sdelphij       slashes.
82860786Sps
82963128Sps       LEFTARROW [ ESC-h ]
83063128Sps              Move the cursor one space to the left.
83160786Sps
832128345Stjr       RIGHTARROW [ ESC-l ]
833128345Stjr              Move the cursor one space to the right.
83489019Sps
835128345Stjr       ^LEFTARROW [ ESC-b or ESC-LEFTARROW ]
836161475Sdelphij              (That  is, CONTROL and LEFTARROW simultaneously.)  Move the cur-
837161475Sdelphij              sor one word to the left.
83889019Sps
839128345Stjr       ^RIGHTARROW [ ESC-w or ESC-RIGHTARROW ]
840161475Sdelphij              (That is, CONTROL and RIGHTARROW simultaneously.)  Move the cur-
841161475Sdelphij              sor one word to the right.
84260786Sps
84360786Sps       HOME [ ESC-0 ]
84460786Sps              Move the cursor to the beginning of the line.
84560786Sps
84660786Sps       END [ ESC-$ ]
84760786Sps              Move the cursor to the end of the line.
84860786Sps
84960786Sps       BACKSPACE
850161475Sdelphij              Delete  the  character  to the left of the cursor, or cancel the
851161475Sdelphij              command if the command line is empty.
85260786Sps
85360786Sps       DELETE or [ ESC-x ]
85460786Sps              Delete the character under the cursor.
85560786Sps
85660786Sps       ^BACKSPACE [ ESC-BACKSPACE ]
857161475Sdelphij              (That is, CONTROL and  BACKSPACE  simultaneously.)   Delete  the
858161475Sdelphij              word to the left of the cursor.
85960786Sps
86060786Sps       ^DELETE [ ESC-X or ESC-DELETE ]
861161475Sdelphij              (That  is,  CONTROL and DELETE simultaneously.)  Delete the word
862161475Sdelphij              under the cursor.
86360786Sps
86463128Sps       UPARROW [ ESC-k ]
86563128Sps              Retrieve the previous command line.
86660786Sps
86763128Sps       DOWNARROW [ ESC-j ]
86863128Sps              Retrieve the next command line.
86960786Sps
870161475Sdelphij       TAB    Complete the partial filename to the left of the cursor.  If  it
871161475Sdelphij              matches  more than one filename, the first match is entered into
872161475Sdelphij              the command line.  Repeated  TABs  will  cycle  thru  the  other
873161475Sdelphij              matching filenames.  If the completed filename is a directory, a
874161475Sdelphij              "/" is appended to the filename.  (On MS-DOS systems, a  "\"  is
875161475Sdelphij              appended.)   The  environment variable LESSSEPARATOR can be used
876161475Sdelphij              to specify a different character to append to a directory  name.
87760786Sps
87863128Sps       BACKTAB [ ESC-TAB ]
879161475Sdelphij              Like, TAB, but cycles in the reverse direction thru the matching
880161475Sdelphij              filenames.
88160786Sps
882161475Sdelphij       ^L     Complete the partial filename to the left of the cursor.  If  it
883161475Sdelphij              matches more than one filename, all matches are entered into the
884161475Sdelphij              command line (if they fit).
88560786Sps
886128345Stjr       ^U (Unix and OS/2) or ESC (MS-DOS)
887161475Sdelphij              Delete the entire command line, or cancel  the  command  if  the
888161475Sdelphij              command line is empty.  If you have changed your line-kill char-
889161475Sdelphij              acter in Unix to something other than ^U, that character is used
890161475Sdelphij              instead of ^U.
891128345Stjr
892128345Stjr
893170256Sdelphij[1mKEY BINDINGS[0m
894170256Sdelphij       You  may define your own [4mless[24m commands by using the program [4mlesskey[24m (1)
895161475Sdelphij       to create a lesskey file.  This file specifies a set  of  command  keys
896170256Sdelphij       and  an  action  associated with each key.  You may also use [4mlesskey[24m to
897161475Sdelphij       change the line-editing keys (see LINE EDITING), and to set environment
898170256Sdelphij       variables.   If the environment variable LESSKEY is set, [4mless[24m uses that
899170256Sdelphij       as the name of the lesskey file.  Otherwise, [4mless[24m looks in  a  standard
900170256Sdelphij       place  for  the lesskey file: On Unix systems, [4mless[24m looks for a lesskey
901170256Sdelphij       file called "$HOME/.less".  On MS-DOS and Windows systems,  [4mless[24m  looks
902161475Sdelphij       for  a lesskey file called "$HOME/_less", and if it is not found there,
903161475Sdelphij       then looks for a lesskey file called "_less" in any directory specified
904170256Sdelphij       in  the  PATH  environment variable.  On OS/2 systems, [4mless[24m looks for a
905161475Sdelphij       lesskey file called "$HOME/less.ini", and if  it  is  not  found,  then
906161475Sdelphij       looks  for  a lesskey file called "less.ini" in any directory specified
907161475Sdelphij       in the INIT environment variable, and if it not found there, then looks
908161475Sdelphij       for  a lesskey file called "less.ini" in any directory specified in the
909170256Sdelphij       PATH environment variable.   See  the  [4mlesskey[24m  manual  page  for  more
910161475Sdelphij       details.
91160786Sps
912161475Sdelphij       A  system-wide lesskey file may also be set up to provide key bindings.
913161475Sdelphij       If a key is defined in both a local lesskey file and in the system-wide
914161475Sdelphij       file,  key bindings in the local file take precedence over those in the
915161475Sdelphij       system-wide file.  If the environment variable LESSKEY_SYSTEM  is  set,
916170256Sdelphij       [4mless[24m uses that as the name of the system-wide lesskey file.  Otherwise,
917170256Sdelphij       [4mless[24m looks in a standard place for the  system-wide  lesskey  file:  On
918161475Sdelphij       Unix  systems,  the system-wide lesskey file is /usr/local/etc/sysless.
919170256Sdelphij       (However, if [4mless[24m was built with a  different  sysconf  directory  than
920161475Sdelphij       /usr/local/etc, that directory is where the sysless file is found.)  On
921161475Sdelphij       MS-DOS and Windows systems, the system-wide lesskey  file  is  c:\_sys-
922161475Sdelphij       less.  On OS/2 systems, the system-wide lesskey file is c:\sysless.ini.
92360786Sps
92460786Sps
925170256Sdelphij[1mINPUT PREPROCESSOR[0m
926170256Sdelphij       You may define an "input preprocessor" for [4mless.[24m  Before [4mless[24m  opens  a
927161475Sdelphij       file, it first gives your input preprocessor a chance to modify the way
928161475Sdelphij       the contents of the file are displayed.  An input preprocessor is  sim-
929161475Sdelphij       ply  an executable program (or shell script), which writes the contents
930161475Sdelphij       of the file to a different file, called the replacement file.  The con-
931161475Sdelphij       tents  of  the replacement file are then displayed in place of the con-
932161475Sdelphij       tents of the original file.  However, it will appear to the user as  if
933170256Sdelphij       the  original  file  is opened; that is, [4mless[24m will display the original
934161475Sdelphij       filename as the name of the current file.
93560786Sps
936161475Sdelphij       An input preprocessor receives one command line argument, the  original
937161475Sdelphij       filename,  as  entered  by  the user.  It should create the replacement
938161475Sdelphij       file, and when finished, print the name of the replacement file to  its
939161475Sdelphij       standard  output.  If the input preprocessor does not output a replace-
940170256Sdelphij       ment filename, [4mless[24m uses the original file, as normal.  The input  pre-
941161475Sdelphij       processor  is  not  called  when  viewing standard input.  To set up an
942161475Sdelphij       input preprocessor, set the LESSOPEN environment variable to a  command
943161475Sdelphij       line  which  will  invoke  your  input preprocessor.  This command line
944161475Sdelphij       should include one  occurrence  of  the  string  "%s",  which  will  be
945161475Sdelphij       replaced  by  the  filename  when  the  input  preprocessor  command is
94689019Sps       invoked.
94789019Sps
948170256Sdelphij       When [4mless[24m closes a file opened in such a way, it will call another pro-
949161475Sdelphij       gram,  called  the  input  postprocessor, which may perform any desired
950161475Sdelphij       clean-up action (such as  deleting  the  replacement  file  created  by
951161475Sdelphij       LESSOPEN).  This program receives two command line arguments, the orig-
952161475Sdelphij       inal filename as entered by the user, and the name of  the  replacement
953161475Sdelphij       file.   To set up an input postprocessor, set the LESSCLOSE environment
954161475Sdelphij       variable to a command line which will invoke your input  postprocessor.
955161475Sdelphij       It  may  include  two  occurrences  of  the  string  "%s"; the first is
956161475Sdelphij       replaced with the original name of the file and  the  second  with  the
957161475Sdelphij       name of the replacement file, which was output by LESSOPEN.
95860786Sps
959161475Sdelphij       For  example, on many Unix systems, these two scripts will allow you to
960170256Sdelphij       keep files in compressed format, but still let [4mless[24m view them directly:
96160786Sps
96260786Sps       lessopen.sh:
96360786Sps            #! /bin/sh
96460786Sps            case "$1" in
965161475Sdelphij            *.Z) uncompress -
96660786Sps                 if [ -s /tmp/less.$$ ]; then
96760786Sps                      echo /tmp/less.$$
96860786Sps                 else
96960786Sps                      rm -f /tmp/less.$$
97060786Sps                 fi
97160786Sps                 ;;
97260786Sps            esac
97360786Sps
97460786Sps       lessclose.sh:
97560786Sps            #! /bin/sh
97660786Sps            rm $2
97760786Sps
978161475Sdelphij       To  use these scripts, put them both where they can be executed and set
979161475Sdelphij       LESSOPEN="lessopen.sh %s",  and  LESSCLOSE="lessclose.sh %s %s".   More
980161475Sdelphij       complex  LESSOPEN  and LESSCLOSE scripts may be written to accept other
981161475Sdelphij       types of compressed files, and so on.
98260786Sps
983161475Sdelphij       It is also possible to set up an input preprocessor to  pipe  the  file
984170256Sdelphij       data  directly to [4mless,[24m rather than putting the data into a replacement
985161475Sdelphij       file.  This avoids the need to decompress the entire file before start-
986161475Sdelphij       ing to view it.  An input preprocessor that works this way is called an
987161475Sdelphij       input pipe.  An input pipe, instead of writing the name of  a  replace-
988161475Sdelphij       ment  file  on  its  standard output, writes the entire contents of the
989161475Sdelphij       replacement file on its standard output.  If the input  pipe  does  not
990161475Sdelphij       write  any characters on its standard output, then there is no replace-
991170256Sdelphij       ment file and [4mless[24m uses the original file, as normal.  To use an  input
992161475Sdelphij       pipe,  make  the first character in the LESSOPEN environment variable a
993161475Sdelphij       vertical bar (|) to signify that the input  preprocessor  is  an  input
994161475Sdelphij       pipe.
99589019Sps
996161475Sdelphij       For  example, on many Unix systems, this script will work like the pre-
997161475Sdelphij       vious example scripts:
99889019Sps
99960786Sps       lesspipe.sh:
100060786Sps            #! /bin/sh
100160786Sps            case "$1" in
100260786Sps            *.Z) uncompress -c $1  2>/dev/null
100360786Sps                 ;;
100460786Sps            esac
100560786Sps
1006161475Sdelphij       To  use  this  script,  put  it  where  it  can  be  executed  and  set
1007161475Sdelphij       LESSOPEN="|lesspipe.sh  %s".   When  an input pipe is used, a LESSCLOSE
1008161475Sdelphij       postprocessor can be used, but it is usually not necessary since  there
1009161475Sdelphij       is no replacement file to clean up.  In this case, the replacement file
1010161475Sdelphij       name passed to the LESSCLOSE postprocessor is "-".
101160786Sps
101260786Sps
1013170256Sdelphij[1mNATIONAL CHARACTER SETS[0m
101460786Sps       There are three types of characters in the input file:
101560786Sps
101660786Sps       normal characters
101760786Sps              can be displayed directly to the screen.
101860786Sps
101960786Sps       control characters
1020161475Sdelphij              should not be displayed directly, but are expected to  be  found
1021161475Sdelphij              in ordinary text files (such as backspace and tab).
102260786Sps
102360786Sps       binary characters
1024161475Sdelphij              should  not  be  displayed  directly  and are not expected to be
1025161475Sdelphij              found in text files.
102660786Sps
1027161475Sdelphij       A "character set" is simply a description of which characters are to be
1028161475Sdelphij       considered  normal,  control,  and binary.  The LESSCHARSET environment
1029161475Sdelphij       variable may be used to select a character set.   Possible  values  for
1030161475Sdelphij       LESSCHARSET are:
103160786Sps
1032161475Sdelphij       ascii  BS,  TAB, NL, CR, and formfeed are control characters, all chars
1033161475Sdelphij              with values between 32 and 126 are normal, and  all  others  are
1034161475Sdelphij              binary.
103560786Sps
103689019Sps       iso8859
1037161475Sdelphij              Selects  an  ISO 8859 character set.  This is the same as ASCII,
1038161475Sdelphij              except characters between 160 and  255  are  treated  as  normal
1039161475Sdelphij              characters.
104060786Sps
104189019Sps       latin1 Same as iso8859.
104260786Sps
104389019Sps       latin9 Same as iso8859.
104460786Sps
104589019Sps       dos    Selects a character set appropriate for MS-DOS.
104660786Sps
104789019Sps       ebcdic Selects an EBCDIC character set.
104860786Sps
104989019Sps       IBM-1047
1050161475Sdelphij              Selects  an  EBCDIC  character set used by OS/390 Unix Services.
1051161475Sdelphij              This is the EBCDIC analogue of latin1.  You get similar  results
1052161475Sdelphij              by setting either LESSCHARSET=IBM-1047 or LC_CTYPE=en_US in your
1053161475Sdelphij              environment.
105460786Sps
105589019Sps       koi8-r Selects a Russian character set.
105660786Sps
1057161475Sdelphij       next   Selects a character set appropriate for NeXT computers.
105889019Sps
1059170256Sdelphij       utf-8  Selects the UTF-8 encoding  of  the  ISO  10646  character  set.
1060170256Sdelphij              UTF-8  is  special  in that it supports multi-byte characters in
1061170256Sdelphij              the input file.  It is the  only  character  set  that  supports
1062170256Sdelphij              multi-byte characters.
106389019Sps
1064161475Sdelphij       windows
1065170256Sdelphij              Selects  a  character  set appropriate for Microsoft Windows (cp
1066161475Sdelphij              1251).
106760786Sps
1068170256Sdelphij       In special cases, it may be desired to tailor [4mless[24m to use  a  character
1069170256Sdelphij       set  other  than  the ones definable by LESSCHARSET.  In this case, the
1070161475Sdelphij       environment variable LESSCHARDEF can be used to define a character set.
1071170256Sdelphij       It  should be set to a string where each character in the string repre-
1072170256Sdelphij       sents one character in the character set.  The character  "."  is  used
1073161475Sdelphij       for a normal character, "c" for control, and "b" for binary.  A decimal
1074170256Sdelphij       number may be used for repetition.  For example, "bccc4b."  would  mean
1075170256Sdelphij       character  0  is  binary,  1,  2  and  3 are control, 4, 5, 6 and 7 are
1076161475Sdelphij       binary, and 8 is normal.  All characters after the last are taken to be
1077170256Sdelphij       the  same  as  the  last,  so characters 9 through 255 would be normal.
1078170256Sdelphij       (This is an example, and does not necessarily represent any real  char-
1079161475Sdelphij       acter set.)
108060786Sps
1081170256Sdelphij       This  table  shows the value of LESSCHARDEF which is equivalent to each
1082161475Sdelphij       of the possible values for LESSCHARSET:
108389019Sps
1084128345Stjr            ascii     8bcccbcc18b95.b
1085128345Stjr            dos       8bcccbcc12bc5b95.b.
1086128345Stjr            ebcdic    5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b
1087128345Stjr                      9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b.
1088128345Stjr            IBM-1047  4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc
1089128345Stjr                      191.b
1090128345Stjr            iso8859   8bcccbcc18b95.33b.
1091128345Stjr            koi8-r    8bcccbcc18b95.b128.
109260786Sps            latin1    8bcccbcc18b95.33b.
109360786Sps            next      8bcccbcc18b95.bb125.bb
109460786Sps
1095170256Sdelphij       If neither LESSCHARSET nor LESSCHARDEF is set, but any of  the  strings
1096170256Sdelphij       "UTF-8",  "UTF8",  "utf-8" or "utf8" is found in the LC_ALL, LC_TYPE or
1097161475Sdelphij       LANG environment variables, then the default character set is utf-8.
109860786Sps
1099170256Sdelphij       If that string is not found, but your  system  supports  the  [4msetlocale[0m
1100170256Sdelphij       interface,  [4mless[24m  will  use  setlocale  to determine the character set.
1101170256Sdelphij       setlocale is controlled by setting the  LANG  or  LC_CTYPE  environment
1102161475Sdelphij       variables.
110389019Sps
1104170256Sdelphij       Finally,  if the [4msetlocale[24m interface is also not available, the default
1105161475Sdelphij       character set is latin1.
110689019Sps
1107170256Sdelphij       Control and  binary  characters  are  displayed  in  standout  (reverse
1108161475Sdelphij       video).  Each such character is displayed in caret notation if possible
1109170256Sdelphij       (e.g. ^A for control-A).  Caret notation is used only if inverting  the
1110161475Sdelphij       0100 bit results in a normal printable character.  Otherwise, the char-
1111170256Sdelphij       acter is displayed as a hex number in angle brackets.  This format  can
1112170256Sdelphij       be  changed by setting the LESSBINFMT environment variable.  LESSBINFMT
1113161475Sdelphij       may begin with a "*" and one character to select the display attribute:
1114170256Sdelphij       "*k"  is  blinking, "*d" is bold, "*u" is underlined, "*s" is standout,
1115170256Sdelphij       and "*n" is normal.  If LESSBINFMT does not begin with  a  "*",  normal
1116170256Sdelphij       attribute  is  assumed.   The remainder of LESSBINFMT is a string which
1117170256Sdelphij       may include one printf-style escape sequence (a % followed by x, X,  o,
1118170256Sdelphij       d,  etc.).   For  example, if LESSBINFMT is "*u[%x]", binary characters
1119170256Sdelphij       are displayed in underlined hexadecimal surrounded  by  brackets.   The
1120170256Sdelphij       default  if  no LESSBINFMT is specified is "*s<%X>".  The default if no
1121170256Sdelphij       LESSBINFMT is specified is "*s<%02X>".  Warning: the result of  expand-
1122161475Sdelphij       ing the character via LESSBINFMT must be less than 31 characters.
112360786Sps
1124161475Sdelphij       When the character set is utf-8, the LESSUTFBINFMT environment variable
1125161475Sdelphij       acts similarly to LESSBINFMT but it applies to Unicode code points that
1126170256Sdelphij       were  successfully  decoded but are unsuitable for display (e.g., unas-
1127170256Sdelphij       signed code points).  Its default  value  is  "<U+%04lX>".   Note  that
1128170256Sdelphij       LESSUTFBINFMT  and  LESSBINFMT  share  their  display attribute setting
1129170256Sdelphij       ("*x") so specifying one will affect both; LESSUTFBINFMT is read  after
1130170256Sdelphij       LESSBINFMT  so  its  setting,  if any, will have priority.  Problematic
1131170256Sdelphij       octets in a UTF-8 file (octets of a truncated  sequence,  octets  of  a
1132170256Sdelphij       complete  but  non-shortest  form  sequence,  illegal octets, and stray
1133170256Sdelphij       trailing octets) are displayed individually using LESSBINFMT so  as  to
1134161475Sdelphij       facilitate diagnostic of how the UTF-8 file is ill-formed.
113560786Sps
1136161475Sdelphij
1137170256Sdelphij[1mPROMPTS[0m
1138170256Sdelphij       The  -P option allows you to tailor the prompt to your preference.  The
1139170256Sdelphij       string given to the -P option replaces  the  specified  prompt  string.
1140161475Sdelphij       Certain characters in the string are interpreted specially.  The prompt
1141170256Sdelphij       mechanism is rather complicated to provide flexibility, but  the  ordi-
1142170256Sdelphij       nary  user need not understand the details of constructing personalized
1143161475Sdelphij       prompt strings.
114460786Sps
1145170256Sdelphij       A percent sign followed by a single character is expanded according  to
1146161475Sdelphij       what the following character is:
114760786Sps
1148170256Sdelphij       %b[4mX[24m    Replaced  by the byte offset into the current input file.  The b
1149170256Sdelphij              is followed by a single character (shown as [4mX[24m above) which spec-
1150170256Sdelphij              ifies  the line whose byte offset is to be used.  If the charac-
1151170256Sdelphij              ter is a "t", the byte offset of the top line in the display  is
1152161475Sdelphij              used, an "m" means use the middle line, a "b" means use the bot-
1153170256Sdelphij              tom line, a "B" means use the line just after the  bottom  line,
1154170256Sdelphij              and  a  "j"  means use the "target" line, as specified by the -j
1155161475Sdelphij              option.
115660786Sps
115760786Sps       %B     Replaced by the size of the current input file.
115860786Sps
1159161475Sdelphij       %c     Replaced by the column number of the text appearing in the first
1160161475Sdelphij              column of the screen.
116160786Sps
1162170256Sdelphij       %d[4mX[24m    Replaced  by  the  page number of a line in the input file.  The
1163170256Sdelphij              line to be used is determined by the [4mX[24m, as with the %b option.
116460786Sps
1165170256Sdelphij       %D     Replaced by the number of pages in the input  file,  or  equiva-
1166161475Sdelphij              lently, the page number of the last line in the input file.
116760786Sps
1168170256Sdelphij       %E     Replaced  by the name of the editor (from the VISUAL environment
1169170256Sdelphij              variable, or the EDITOR environment variable if  VISUAL  is  not
1170161475Sdelphij              defined).  See the discussion of the LESSEDIT feature below.
117160786Sps
117260786Sps       %f     Replaced by the name of the current input file.
117360786Sps
1174170256Sdelphij       %i     Replaced  by  the index of the current file in the list of input
1175161475Sdelphij              files.
117660786Sps
1177170256Sdelphij       %l[4mX[24m    Replaced by the line number of a line in the  input  file.   The
1178170256Sdelphij              line to be used is determined by the [4mX[24m, as with the %b option.
117960786Sps
1180170256Sdelphij       %L     Replaced  by the line number of the last line in the input file.
118160786Sps
118260786Sps       %m     Replaced by the total number of input files.
118360786Sps
1184170256Sdelphij       %p[4mX[24m    Replaced by the percent into the current input  file,  based  on
1185170256Sdelphij              byte  offsets.  The line used is determined by the [4mX[24m as with the
1186161475Sdelphij              %b option.
118760786Sps
1188170256Sdelphij       %P[4mX[24m    Replaced by the percent into the current input  file,  based  on
1189170256Sdelphij              line  numbers.  The line used is determined by the [4mX[24m as with the
1190161475Sdelphij              %b option.
119160786Sps
119289019Sps       %s     Same as %B.
119360786Sps
1194170256Sdelphij       %t     Causes any trailing spaces to be removed.  Usually used  at  the
1195161475Sdelphij              end of the string, but may appear anywhere.
119660786Sps
1197161475Sdelphij       %x     Replaced by the name of the next input file in the list.
119860786Sps
1199161475Sdelphij       If any item is unknown (for example, the file size if input is a pipe),
1200161475Sdelphij       a question mark is printed instead.
120160786Sps
1202170256Sdelphij       The format of the prompt string can be  changed  depending  on  certain
1203170256Sdelphij       conditions.   A  question mark followed by a single character acts like
1204170256Sdelphij       an "IF": depending on the following character, a  condition  is  evalu-
1205170256Sdelphij       ated.   If the condition is true, any characters following the question
1206170256Sdelphij       mark and condition character, up to  a  period,  are  included  in  the
1207170256Sdelphij       prompt.   If  the condition is false, such characters are not included.
1208170256Sdelphij       A colon appearing between the question mark and the period can be  used
1209161475Sdelphij       to establish an "ELSE": any characters between the colon and the period
1210170256Sdelphij       are included in the string if and only if the IF  condition  is  false.
1211161475Sdelphij       Condition characters (which follow a question mark) may be:
121260786Sps
1213170256Sdelphij       ?a     True  if any characters have been included in the prompt so far.
121460786Sps
1215170256Sdelphij       ?b[4mX[24m    True if the byte offset of the specified line is known.
121660786Sps
121760786Sps       ?B     True if the size of current input file is known.
121860786Sps
1219161475Sdelphij       ?c     True if the text is horizontally shifted (%c is not zero).
122060786Sps
1221170256Sdelphij       ?d[4mX[24m    True if the page number of the specified line is known.
122260786Sps
122360786Sps       ?e     True if at end-of-file.
122460786Sps
1225170256Sdelphij       ?f     True if there is an input filename (that is, if input is  not  a
1226161475Sdelphij              pipe).
122760786Sps
1228170256Sdelphij       ?l[4mX[24m    True if the line number of the specified line is known.
122963128Sps
1230161475Sdelphij       ?L     True if the line number of the last line in the file is known.
123163128Sps
123289019Sps       ?m     True if there is more than one input file.
123363128Sps
1234161475Sdelphij       ?n     True if this is the first prompt in a new input file.
123563128Sps
1236170256Sdelphij       ?p[4mX[24m    True  if  the percent into the current input file, based on byte
1237161475Sdelphij              offsets, of the specified line is known.
123863128Sps
1239170256Sdelphij       ?P[4mX[24m    True if the percent into the current input file, based  on  line
1240161475Sdelphij              numbers, of the specified line is known.
124163128Sps
1242128345Stjr       ?s     Same as "?B".
124360786Sps
1244170256Sdelphij       ?x     True  if  there  is  a  next input file (that is, if the current
1245161475Sdelphij              input file is not the last one).
124660786Sps
1247170256Sdelphij       Any characters other than  the  special  ones  (question  mark,  colon,
1248170256Sdelphij       period,  percent,  and  backslash) become literally part of the prompt.
1249170256Sdelphij       Any of the special characters may be included in the  prompt  literally
1250161475Sdelphij       by preceding it with a backslash.
125160786Sps
125260786Sps       Some examples:
125360786Sps
125460786Sps       ?f%f:Standard input.
125560786Sps
1256170256Sdelphij       This  prompt prints the filename, if known; otherwise the string "Stan-
1257161475Sdelphij       dard input".
125860786Sps
125960786Sps       ?f%f .?ltLine %lt:?pt%pt\%:?btByte %bt:-...
126060786Sps
1261170256Sdelphij       This prompt would print the filename, if known.  The filename  is  fol-
1262170256Sdelphij       lowed  by  the  line  number, if known, otherwise the percent if known,
1263170256Sdelphij       otherwise the byte offset if known.   Otherwise,  a  dash  is  printed.
1264170256Sdelphij       Notice  how  each  question  mark  has a matching period, and how the %
1265161475Sdelphij       after the %pt is included literally by escaping it with a backslash.
126660786Sps
126760786Sps       ?n?f%f .?m(file %i of %m) ..?e(END) ?x- Next\: %x..%t
126860786Sps
1269170256Sdelphij       This prints the filename if this is the first prompt in  a  file,  fol-
1270170256Sdelphij       lowed  by  the  "file  N  of N" message if there is more than one input
1271170256Sdelphij       file.  Then, if we are at end-of-file, the string  "(END)"  is  printed
1272170256Sdelphij       followed  by  the name of the next file, if there is one.  Finally, any
1273161475Sdelphij       trailing spaces are truncated.  This is the default prompt.  For refer-
1274170256Sdelphij       ence,  here  are  the  defaults  for  the  other two prompts (-m and -M
1275170256Sdelphij       respectively).  Each is broken into  two  lines  here  for  readability
1276161475Sdelphij       only.
127763128Sps
127889019Sps       ?n?f%f .?m(file %i of %m) ..?e(END) ?x- Next\: %x.:
127989019Sps            ?pB%pB\%:byte %bB?s/%s...%t
128063128Sps
128189019Sps       ?f%f .?n?m(file %i of %m) ..?ltlines %lt-%lb?L/%L. :
128289019Sps            byte %bB?s/%s. .?e(END) ?x- Next\: %x.:?pB%pB\%..%t
128363128Sps
128489019Sps       And here is the default message produced by the = command:
128563128Sps
128689019Sps       ?f%f .?m(file %i of %m) .?ltlines %lt-%lb?L/%L. .
1287128345Stjr            byte %bB?s/%s. ?e(END) :?pB%pB\%..%t
1288128345Stjr
1289170256Sdelphij       The  prompt expansion features are also used for another purpose: if an
1290170256Sdelphij       environment variable LESSEDIT is defined, it is used as the command  to
1291170256Sdelphij       be  executed  when  the  v  command is invoked.  The LESSEDIT string is
1292170256Sdelphij       expanded in the same way as the prompt strings.  The default value  for
1293128345Stjr       LESSEDIT is:
1294128345Stjr
129560786Sps            %E ?lm+%lm. %f
129660786Sps
1297161475Sdelphij       Note that this expands to the editor name, followed by a + and the line
1298170256Sdelphij       number, followed by the file name.  If your editor does not accept  the
1299170256Sdelphij       "+linenumber"  syntax,  or  has other differences in invocation syntax,
1300161475Sdelphij       the LESSEDIT variable can be changed to modify this default.
130160786Sps
130260786Sps
1303170256Sdelphij[1mSECURITY[0m
1304170256Sdelphij       When the environment variable LESSSECURE is set to 1, [4mless[24m  runs  in  a
1305161475Sdelphij       "secure" mode.  This means these features are disabled:
130660786Sps
130760786Sps              !      the shell command
130860786Sps
130960786Sps              |      the pipe command
131060786Sps
131160786Sps              :e     the examine command.
131260786Sps
131360786Sps              v      the editing command
131460786Sps
131560786Sps              s  -o  log files
131660786Sps
131760786Sps              -k     use of lesskey files
131860786Sps
131960786Sps              -t     use of tags files
132060786Sps
132160786Sps                     metacharacters in filenames, such as *
132260786Sps
132360786Sps                     filename completion (TAB, ^L)
132460786Sps
1325161475Sdelphij       Less can also be compiled to be permanently in "secure" mode.
132660786Sps
132760786Sps
1328170256Sdelphij[1mCOMPATIBILITY WITH MORE[0m
1329170256Sdelphij       If the environment variable LESS_IS_MORE is set to 1, or if the program
1330170256Sdelphij       is invoked via a file link named "more", [4mless[24m behaves (mostly) in  con-
1331170256Sdelphij       formance  with  the  POSIX "more" command specification.  In this mode,
1332170256Sdelphij       less behaves differently in these ways:
1333170256Sdelphij
1334170256Sdelphij       The -e option works differently.  If the -e option  is  not  set,  [4mless[0m
1335170256Sdelphij       behaves  as  if  the -E option were set.  If the -e option is set, [4mless[0m
1336170256Sdelphij       behaves as if the -e and -F options were set.
1337170256Sdelphij
1338170256Sdelphij       The -m option works differently.  If the -m  option  is  not  set,  the
1339170256Sdelphij       medium  prompt  is used, and it is prefixed with the string "--More--".
1340170256Sdelphij       If the -m option is set, the short prompt is used.
1341170256Sdelphij
1342170256Sdelphij       The -n option acts like the -z option.  The normal behavior of  the  -n
1343170256Sdelphij       option is unavailable in this mode.
1344170256Sdelphij
1345170256Sdelphij       The  parameter  to  the  -p option is taken to be a [4mless[24m command rather
1346170256Sdelphij       than a search pattern.
1347170256Sdelphij
1348170256Sdelphij       The LESS environment variable is  ignored,  and  the  MORE  environment
1349170256Sdelphij       variable is used in its place.
1350170256Sdelphij
1351170256Sdelphij
1352170256Sdelphij[1mENVIRONMENT VARIABLES[0m
1353161475Sdelphij       Environment variables may be specified either in the system environment
1354170256Sdelphij       as usual, or in a [4mlesskey[24m  (1)  file.   If  environment  variables  are
1355170256Sdelphij       defined  in  more  than one place, variables defined in a local lesskey
1356170256Sdelphij       file take precedence over variables defined in the system  environment,
1357161475Sdelphij       which take precedence over variables defined in the system-wide lesskey
1358161475Sdelphij       file.
135960786Sps
1360128345Stjr       COLUMNS
1361161475Sdelphij              Sets the number of columns on the screen.  Takes precedence over
1362170256Sdelphij              the  number  of columns specified by the TERM variable.  (But if
1363161475Sdelphij              you  have  a  windowing  system  which  supports  TIOCGWINSZ  or
1364170256Sdelphij              WIOCGETD,  the  window  system's  idea  of the screen size takes
1365161475Sdelphij              precedence over the LINES and COLUMNS environment variables.)
1366128345Stjr
136763128Sps       EDITOR The name of the editor (used for the v command).
136860786Sps
1369170256Sdelphij       HOME   Name of the user's home directory (used to find a  lesskey  file
1370161475Sdelphij              on Unix and OS/2 systems).
137160786Sps
137260786Sps       HOMEDRIVE, HOMEPATH
1373170256Sdelphij              Concatenation  of  the  HOMEDRIVE and HOMEPATH environment vari-
1374161475Sdelphij              ables is the name of the user's home directory if the HOME vari-
1375161475Sdelphij              able is not set (only in the Windows version).
137660786Sps
1377170256Sdelphij       INIT   Name  of  the user's init directory (used to find a lesskey file
1378161475Sdelphij              on OS/2 systems).
137960786Sps
138060786Sps       LANG   Language for determining the character set.
138160786Sps
138260786Sps       LC_CTYPE
138360786Sps              Language for determining the character set.
138460786Sps
1385170256Sdelphij       LESS   Options which are passed to [4mless[24m automatically.
138660786Sps
138760786Sps       LESSANSIENDCHARS
1388170256Sdelphij              Characters which may end an ANSI color escape sequence  (default
1389161475Sdelphij              "m").
139060786Sps
1391161475Sdelphij       LESSANSIMIDCHARS
1392170256Sdelphij              Characters  which  may  appear between the ESC character and the
1393170256Sdelphij              end  character  in  an  ANSI  color  escape  sequence   (default
1394161475Sdelphij              "0123456789;[?!"'#%()*+ ".
1395161475Sdelphij
139660786Sps       LESSBINFMT
1397161475Sdelphij              Format for displaying non-printable, non-control characters.
139860786Sps
139960786Sps       LESSCHARDEF
140060786Sps              Defines a character set.
140160786Sps
140289019Sps       LESSCHARSET
140389019Sps              Selects a predefined character set.
140463128Sps
140589019Sps       LESSCLOSE
1406161475Sdelphij              Command line to invoke the (optional) input-postprocessor.
140763128Sps
140889019Sps       LESSECHO
1409161475Sdelphij              Name of the lessecho program (default "lessecho").  The lessecho
1410170256Sdelphij              program is needed to expand metacharacters, such as * and ?,  in
1411161475Sdelphij              filenames on Unix systems.
141263128Sps
1413161475Sdelphij       LESSEDIT
1414170256Sdelphij              Editor  prototype  string (used for the v command).  See discus-
1415161475Sdelphij              sion under PROMPTS.
141663128Sps
1417161475Sdelphij       LESSGLOBALTAGS
1418170256Sdelphij              Name of the command used by the -t option to find  global  tags.
1419170256Sdelphij              Normally should be set to "global" if your system has the [4mglobal[0m
1420161475Sdelphij              (1) command.  If not set, global tags are not used.
142163128Sps
1422161475Sdelphij       LESSHISTFILE
1423170256Sdelphij              Name of the history file used to remember  search  commands  and
1424170256Sdelphij              shell  commands  between  invocations of [4mless.[24m  If set to "-" or
1425170256Sdelphij              "/dev/null", a  history  file  is  not  used.   The  default  is
1426170256Sdelphij              "$HOME/.lesshst"  on  Unix  systems, "$HOME/_lesshst" on DOS and
1427170256Sdelphij              Windows systems, or "$HOME/lesshst.ini"  or  "$INIT/lesshst.ini"
1428170256Sdelphij              on OS/2 systems.
142963128Sps
1430161475Sdelphij       LESSHISTSIZE
1431161475Sdelphij              The maximum number of commands to save in the history file.  The
1432161475Sdelphij              default is 100.
143363128Sps
143460786Sps       LESSKEY
143560786Sps              Name of the default lesskey(1) file.
143660786Sps
143760786Sps       LESSKEY_SYSTEM
143860786Sps              Name of the default system-wide lesskey(1) file.
143960786Sps
144060786Sps       LESSMETACHARS
1441161475Sdelphij              List of characters which are considered "metacharacters" by  the
1442161475Sdelphij              shell.
144360786Sps
144460786Sps       LESSMETAESCAPE
1445161475Sdelphij              Prefix  which  less will add before each metacharacter in a com-
1446161475Sdelphij              mand sent to the shell.  If LESSMETAESCAPE is an  empty  string,
1447161475Sdelphij              commands  containing  metacharacters  will  not be passed to the
1448161475Sdelphij              shell.
144960786Sps
145060786Sps       LESSOPEN
1451161475Sdelphij              Command line to invoke the (optional) input-preprocessor.
145260786Sps
145360786Sps       LESSSECURE
1454161475Sdelphij              Runs less in "secure" mode.  See discussion under SECURITY.
145560786Sps
145660786Sps       LESSSEPARATOR
1457161475Sdelphij              String to be appended to a directory name  in  filename  comple-
1458161475Sdelphij              tion.
145960786Sps
1460161475Sdelphij       LESSUTFBINFMT
1461161475Sdelphij              Format for displaying non-printable Unicode code points.
146260786Sps
1463170256Sdelphij       LESS_IS_MORE
1464170256Sdelphij              Emulate the [4mmore[24m (1) command.
1465170256Sdelphij
1466161475Sdelphij       LINES  Sets  the  number of lines on the screen.  Takes precedence over
1467161475Sdelphij              the number of lines specified by the TERM variable.  (But if you
1468161475Sdelphij              have  a  windowing system which supports TIOCGWINSZ or WIOCGETD,
1469161475Sdelphij              the window system's idea of the  screen  size  takes  precedence
1470161475Sdelphij              over the LINES and COLUMNS environment variables.)
147163128Sps
1472161475Sdelphij       PATH   User's  search  path  (used to find a lesskey file on MS-DOS and
1473161475Sdelphij              OS/2 systems).
147463128Sps
1475161475Sdelphij       SHELL  The shell used to execute the ! command, as well  as  to  expand
1476161475Sdelphij              filenames.
1477161475Sdelphij
1478170256Sdelphij       TERM   The type of terminal on which [4mless[24m is being run.
147963128Sps
1480128345Stjr       VISUAL The name of the editor (used for the v command).
148160786Sps
148260786Sps
1483170256Sdelphij[1mSEE ALSO[0m
1484128345Stjr       lesskey(1)
148560786Sps
148660786Sps
1487170256Sdelphij[1mWARNINGS[0m
1488161475Sdelphij       The  =  command and prompts (unless changed by -P) report the line num-
1489161475Sdelphij       bers of the lines at the top and bottom of the screen, but the byte and
1490161475Sdelphij       percent of the line after the one at the bottom of the screen.
149160786Sps
1492161475Sdelphij       On  certain  older  terminals (the so-called "magic cookie" terminals),
1493161475Sdelphij       search highlighting will cause an erroneous display.   On  such  termi-
1494161475Sdelphij       nals,  search  highlighting  is  disabled  by default to avoid possible
1495161475Sdelphij       problems.
149660786Sps
1497170256Sdelphij       When searching in a binary file, text which follows a null byte may not
1498170256Sdelphij       be  found.   This  problem  does  not occur when searching with regular
1499170256Sdelphij       expressions turned off via ^R, and also does not  occur  when  [4mless[24m  is
1500170256Sdelphij       compiled to use the PCRE regular expression library.
1501170256Sdelphij
1502161475Sdelphij       In certain cases, when search highlighting is enabled and a search pat-
1503170256Sdelphij       tern begins with a ^, more text than the matching string may  be  high-
1504161475Sdelphij       lighted.  (This problem does not occur when less is compiled to use the
1505161475Sdelphij       POSIX regular expression package.)
150660786Sps
1507170256Sdelphij       On some systems, [4msetlocale[24m claims that ASCII characters 0 thru  31  are
1508170256Sdelphij       control  characters rather than binary characters.  This causes [4mless[24m to
1509161475Sdelphij       treat some binary files as ordinary, non-binary files.   To  workaround
1510161475Sdelphij       this  problem,  set the environment variable LESSCHARSET to "ascii" (or
151163128Sps       whatever character set is appropriate).
151260786Sps
1513161475Sdelphij       This manual is too long.
151460786Sps
1515170256Sdelphij       See http://www.greenwoodsoftware.com/less for the latest list of  known
1516170256Sdelphij       bugs in less.
151760786Sps
1518161475Sdelphij
1519170256Sdelphij[1mCOPYRIGHT[0m
1520170256Sdelphij       Copyright (C) 1984-2007  Mark Nudelman
152160786Sps
1522161475Sdelphij       less  is  part of the GNU project and is free software.  You can redis-
1523161475Sdelphij       tribute it and/or modify it under the terms of either (1) the GNU  Gen-
1524161475Sdelphij       eral  Public  License  as published by the Free Software Foundation; or
1525161475Sdelphij       (2) the Less License.  See the file README in the less distribution for
1526161475Sdelphij       more details regarding redistribution.  You should have received a copy
1527161475Sdelphij       of the GNU General Public License along with the source for  less;  see
1528161475Sdelphij       the  file  COPYING.   If not, write to the Free Software Foundation, 59
1529161475Sdelphij       Temple Place, Suite 330, Boston, MA  02111-1307, USA.  You should  also
1530161475Sdelphij       have received a copy of the Less License; see the file LICENSE.
153160786Sps
1532161475Sdelphij       less is distributed in the hope that it will be useful, but WITHOUT ANY
1533161475Sdelphij       WARRANTY; without even the implied warranty of MERCHANTABILITY or  FIT-
1534161475Sdelphij       NESS  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
1535161475Sdelphij       more details.
153660786Sps
153760786Sps
1538170256Sdelphij[1mAUTHOR[0m
153989019Sps       Mark Nudelman <markn@greenwoodsoftware.com>
1540170256Sdelphij       Send bug reports or comments to the above address or to
1541170256Sdelphij       bug-less@gnu.org.
1542170256Sdelphij       For more information, see the less homepage at
1543170256Sdelphij       http://www.greenwoodsoftware.com/less.
154460786Sps
154560786Sps
154660786Sps
1547170256Sdelphij                           Version 403: 25 May 2007                    LESS(1)
1548