[BACK]Return to less.man CVS log [TXT][DIR] Up to [local] / src / usr.bin / less

Annotation of src/usr.bin/less/less.man, Revision 1.1.1.1

1.1       etheisen    1:
                      2:
                      3:
                      4: LESS(1)                  USER COMMANDS                    LESS(1)
                      5:
                      6:
                      7:
                      8: NAME
                      9:      less - opposite of more
                     10:
                     11: SYNOPSIS
                     12:      less -?
                     13:      less -V
                     14:      less [-[+]aBcCdeEfgGiImMnNqQrsSuUVwX]
                     15:           [-b _b_u_f_s] [-h _l_i_n_e_s] [-j _l_i_n_e] [-k _k_e_y_f_i_l_e]
                     16:           [-{oO} _l_o_g_f_i_l_e] [-p _p_a_t_t_e_r_n] [-P _p_r_o_m_p_t] [-t _t_a_g]
                     17:           [-T _t_a_g_s_f_i_l_e] [-x _t_a_b] [-y _l_i_n_e_s] [-[z] _l_i_n_e_s]
                     18:           [+[+]_c_m_d] [_f_i_l_e_n_a_m_e]...
                     19:
                     20:
                     21: DESCRIPTION
                     22:      _L_e_s_s is a program similar to  _m_o_r_e  (1),  but  which  allows
                     23:      backward  movement  in the file as well as forward movement.
                     24:      Also, _l_e_s_s does not have  to  read  the  entire  input  file
                     25:      before starting, so with large input files it starts up fas-
                     26:      ter than text editors like _v_i (1).  _L_e_s_s  uses  termcap  (or
                     27:      terminfo  on  some  systems),  so it can run on a variety of
                     28:      terminals.  There is even limited support for hardcopy  ter-
                     29:      minals.   (On  a  hardcopy  terminal,  lines which should be
                     30:      printed at the top of the screen are prefixed with a caret.)
                     31:
                     32:      Commands are based on both _m_o_r_e and _v_i. Commands may be pre-
                     33:      ceded  by  a  decimal  number,  called N in the descriptions
                     34:      below.  The number is used by some commands, as indicated.
                     35:
                     36:
                     37: COMMANDS
                     38:      In the following  descriptions,  ^X  means  control-X.   ESC
                     39:      stands  for  the ESCAPE key; for example ESC-v means the two
                     40:      character sequence "ESCAPE", then "v".
                     41:
                     42:      h or H
                     43:           Help: display a summary of these commands.  If you for-
                     44:           get all the other commands, remember this one.
                     45:
                     46:      SPACE or ^V or f or ^F
                     47:           Scroll forward N lines, default one window (see  option
                     48:           -z below).  If N is more than the screen size, only the
                     49:           final screenful is displayed.   Warning:  some  systems
                     50:           use ^V as a special literalization character.
                     51:
                     52:      z    Like SPACE, but if N is specified, it becomes  the  new
                     53:           window size.
                     54:
                     55:      RETURN or ^N or e or ^E or j or ^J
                     56:           Scroll forward N lines, default 1.  The entire N  lines
                     57:           are displayed, even if N is more than the screen size.
                     58:
                     59:
                     60:
                     61:
                     62:
                     63:                                                                 1
                     64:
                     65:
                     66:
                     67:
                     68:
                     69:
                     70: LESS(1)                  USER COMMANDS                    LESS(1)
                     71:
                     72:
                     73:
                     74:      d or ^D
                     75:           Scroll forward N lines, default one half of the  screen
                     76:           size.   If  N  is specified, it becomes the new default
                     77:           for subsequent d and u commands.
                     78:
                     79:      b or ^B or ESC-v
                     80:           Scroll backward N lines, default one window (see option
                     81:           -z below).  If N is more than the screen size, only the
                     82:           final screenful is displayed.
                     83:
                     84:      w    Like ESC-v, but if N is specified, it becomes  the  new
                     85:           window size.
                     86:
                     87:      y or ^Y or ^P or k or ^K
                     88:           Scroll backward N lines, default 1.  The entire N lines
                     89:           are  displayed, even if N is more than the screen size.
                     90:           Warning: some systems use ^Y as a special  job  control
                     91:           character.
                     92:
                     93:      u or ^U
                     94:           Scroll backward N lines, default one half of the screen
                     95:           size.   If  N  is specified, it becomes the new default
                     96:           for subsequent d and u commands.
                     97:
                     98:      r or ^R or ^L
                     99:           Repaint the screen.
                    100:
                    101:      R    Repaint the  screen,  discarding  any  buffered  input.
                    102:           Useful  if  the  file  is  changing  while  it is being
                    103:           viewed.
                    104:
                    105:      F    Scroll forward, and keep trying to read when the end of
                    106:           file  is  reached.  Normally this command would be used
                    107:           when already at the end of the file.  It is  a  way  to
                    108:           monitor the tail of a file which is growing while it is
                    109:           being viewed.  (The behavior is similar  to  the  "tail
                    110:           -f" command.)
                    111:
                    112:      g or < or ESC-<
                    113:           Go to line N in  the  file,  default  1  (beginning  of
                    114:           file).  (Warning: this may be slow if N is large.)
                    115:
                    116:      G or > or ESC->
                    117:           Go to line N in the file, default the end of the  file.
                    118:           (Warning:  this  may  be slow if N is large, or if N is
                    119:           not specified and standard input, rather than  a  file,
                    120:           is being read.)
                    121:
                    122:      p or %
                    123:           Go to a position N percent into the file.  N should  be
                    124:           between  0  and  100.  (This works if standard input is
                    125:           being read, but only if _l_e_s_s has already  read  to  the
                    126:
                    127:
                    128:
                    129:                                                                 2
                    130:
                    131:
                    132:
                    133:
                    134:
                    135:
                    136: LESS(1)                  USER COMMANDS                    LESS(1)
                    137:
                    138:
                    139:
                    140:           end  of  the  file.   It is always fast, but not always
                    141:           useful.)
                    142:
                    143:      {    If a  left  curly  bracket  appears  in  the  top  line
                    144:           displayed  on  the screen, the { command will go to the
                    145:           matching right curly bracket.  The matching right curly
                    146:           bracket is positioned on the bottom line of the screen.
                    147:           If there is more than one left curly bracket on the top
                    148:           line,  a  number  N  may  be  used  to specify the N-th
                    149:           bracket on the line.
                    150:
                    151:      }    If a right curly bracket appears  in  the  bottom  line
                    152:           displayed  on  the screen, the } command will go to the
                    153:           matching left curly bracket.  The matching  left  curly
                    154:           bracket  is  positioned  on the top line of the screen.
                    155:           If there is more than one right curly  bracket  on  the
                    156:           top  line,  a  number N may be used to specify the N-th
                    157:           bracket on the line.
                    158:
                    159:      (    Like {, but applies to parentheses  rather  than  curly
                    160:           brackets.
                    161:
                    162:      )    Like }, but applies to parentheses  rather  than  curly
                    163:           brackets.
                    164:
                    165:      [    Like {, but applies  to  square  brackets  rather  than
                    166:           curly brackets.
                    167:
                    168:      ]    Like }, but applies  to  square  brackets  rather  than
                    169:           curly brackets.
                    170:
                    171:      ESC-^F
                    172:           Followed by two characters, acts like {, but  uses  the
                    173:           two  characters  as  open  and  close brackets, respec-
                    174:           tively.  For example, "ESC ^F < >" could be used to  go
                    175:           forward  to  the  >  which  matches  the  <  in the top
                    176:           displayed line.
                    177:
                    178:      ESC-^B
                    179:           Followed by two characters, acts like }, but  uses  the
                    180:           two  characters  as  open  and  close brackets, respec-
                    181:           tively.  For example, "ESC ^B < >" could be used to  go
                    182:           backward  to  the  <  which matches the > in the bottom
                    183:           displayed line.
                    184:
                    185:      m    Followed by any lowercase  letter,  marks  the  current
                    186:           position with that letter.
                    187:
                    188:      '    (Single  quote.)  Followed  by  any  lowercase  letter,
                    189:           returns  to  the  position  which was previously marked
                    190:           with that letter.  Followed by  another  single  quote,
                    191:           returns  to  the  position  at  which  the last "large"
                    192:
                    193:
                    194:
                    195:                                                                 3
                    196:
                    197:
                    198:
                    199:
                    200:
                    201:
                    202: LESS(1)                  USER COMMANDS                    LESS(1)
                    203:
                    204:
                    205:
                    206:           movement command was executed.  Followed by a ^  or  $,
                    207:           jumps to the beginning or end of the file respectively.
                    208:           Marks are preserved when a new file is examined, so the
                    209:           ' command can be used to switch between input files.
                    210:
                    211:      ^X^X Same as single quote.
                    212:
                    213:      /pattern
                    214:           Search forward in the file for the N-th line containing
                    215:           the  pattern.  N defaults to 1.  The pattern is a regu-
                    216:           lar expression, as recognized by _e_d. The search  starts
                    217:           at  the  second  line  displayed (but see the -a and -j
                    218:           options, which change this).
                    219:
                    220:           Certain characters are special if entered at the begin-
                    221:           ning  of  the  pattern;  they modify the type of search
                    222:           rather than become part of the pattern:
                    223:
                    224:           !    Search for lines which do NOT match the pattern.
                    225:
                    226:           *    Search multiple files.  That  is,  if  the  search
                    227:                reaches  the end of the current file without find-
                    228:                ing a match, the search continues in the next file
                    229:                in the command line list.
                    230:
                    231:           @    Begin the search at the first line  of  the  first
                    232:                file  in the command line list, regardless of what
                    233:                is currently displayed on the screen or  the  set-
                    234:                tings of the -a or -j options.
                    235:
                    236:      ?pattern
                    237:           Search backward in the file for the N-th line  contain-
                    238:           ing the pattern.  The search starts at the line immedi-
                    239:           ately before the top line displayed.
                    240:
                    241:           Certain characters are special as in the / command:
                    242:
                    243:           !    Search for lines which do NOT match the pattern.
                    244:
                    245:           *    Search multiple files.  That  is,  if  the  search
                    246:                reaches  the beginning of the current file without
                    247:                finding a match, the search continues in the  pre-
                    248:                vious file in the command line list.
                    249:
                    250:           @    Begin the search at the last line of the last file
                    251:                in  the  command  line list, regardless of what is
                    252:                currently displayed on the screen or the  settings
                    253:                of the -a or -j options.
                    254:
                    255:      ESC-/pattern
                    256:           Same as "/*".
                    257:
                    258:
                    259:
                    260:
                    261:                                                                 4
                    262:
                    263:
                    264:
                    265:
                    266:
                    267:
                    268: LESS(1)                  USER COMMANDS                    LESS(1)
                    269:
                    270:
                    271:
                    272:      ESC-?pattern
                    273:           Same as "?*".
                    274:
                    275:      n    Repeat previous search, for N-th  line  containing  the
                    276:           last  pattern.   If the previous search was modified by
                    277:           !, the search is made for the N-th line NOT  containing
                    278:           the pattern.  If the previous search was modified by *,
                    279:           the search continues in the next (or previous) file  if
                    280:           not  satisfied in the current file.  There is no effect
                    281:           if the previous search was modified by @.
                    282:
                    283:      N    Repeat previous search, but in the reverse direction.
                    284:
                    285:      ESC-n
                    286:           Repeat previous search, but crossing  file  boundaries.
                    287:           The  effect  is as if the previous search were modified
                    288:           by *.
                    289:
                    290:      ESC-N
                    291:           Repeat previous search, but in  the  reverse  direction
                    292:           and crossing file boundaries.
                    293:
                    294:      ESC-u
                    295:           Undo search highlighting.   Turn  off  highlighting  of
                    296:           strings   matching   the  current  search  pattern.  If
                    297:           highlighting is already off because of a previous ESC-u
                    298:           command, turn highlighting back on.  Any search command
                    299:           will also turn highlighting back on.  (Highlighting can
                    300:           also  be disabled by toggling the -G flag; in that case
                    301:           search commands do not turn highlighting back on.)
                    302:
                    303:      :e [filename]
                    304:           Examine a new file.  If the filename  is  missing,  the
                    305:           "current"  file (see the :n and :p commands below) from
                    306:           the list of files in the command line  is  re-examined.
                    307:           A  percent  sign (%) in the filename is replaced by the
                    308:           name of the current file. A pound sign (#) is  replaced
                    309:           by  the  name  of  the  previously  examined file.  The
                    310:           filename is inserted into  the  command  line  list  of
                    311:           files  so  that  it can be seen by subsequent :n and :p
                    312:           commands.  If the filename consists of  several  files,
                    313:           they  are  all  inserted into the list of files and the
                    314:           first one is examined.
                    315:
                    316:      ^X^V or E
                    317:           Same as :e.  Warning: some systems use ^V as a  special
                    318:           literalization character.
                    319:
                    320:      :n   Examine the next file (from the list of files given  in
                    321:           the  command line).  If a number N is specified, the N-
                    322:           th next file is examined.
                    323:
                    324:
                    325:
                    326:
                    327:                                                                 5
                    328:
                    329:
                    330:
                    331:
                    332:
                    333:
                    334: LESS(1)                  USER COMMANDS                    LESS(1)
                    335:
                    336:
                    337:
                    338:      :p   Examine the previous file in the command line list.  If
                    339:           a  number  N  is  specified,  the N-th previous file is
                    340:           examined.
                    341:
                    342:      :x   Examine the first file in the command line list.  If  a
                    343:           number  N  is  specified,  the N-th file in the list is
                    344:           examined.
                    345:
                    346:      = or ^G or :f
                    347:           Prints some information about the  file  being  viewed,
                    348:           including  its name and the line number and byte offset
                    349:           of the bottom line being displayed.   If  possible,  it
                    350:           also prints the length of the file, the number of lines
                    351:           in the file and the percent of the file above the  last
                    352:           displayed line.
                    353:
                    354:      -    Followed by one of the command line option letters (see
                    355:           below), this will change the setting of that option and
                    356:           print a message describing the  new  setting.   If  the
                    357:           option  letter  has a numeric value (such as -b or -h),
                    358:           or a string value (such as -P or -t), a new  value  may
                    359:           be entered after the option letter.  If no new value is
                    360:           entered, a message describing the  current  setting  is
                    361:           printed and nothing is changed.
                    362:
                    363:      -+   Followed by one of the command line option letters (see
                    364:           below),  this will reset the option to its default set-
                    365:           ting and print a message describing  the  new  setting.
                    366:           (The  "-+_X" command does the same thing as "-+_X" on the
                    367:           command line.) This does  not  work  for  string-valued
                    368:           options.
                    369:
                    370:      --   Followed by one of the command line option letters (see
                    371:           below), this will reset the option to the "opposite" of
                    372:           its default setting and print a message describing  the
                    373:           new setting.  (The "--_X" command does the same thing as
                    374:           "-_X" on the command  line.)  This  does  not  work  for
                    375:           numeric or string-valued options.
                    376:
                    377:      _    (Underscore.) Followed  by  one  of  the  command  line
                    378:           option  letters  (see below), this will print a message
                    379:           describing the current setting  of  that  option.   The
                    380:           setting of the option is not changed.
                    381:
                    382:      +cmd Causes the specified cmd to be executed each time a new
                    383:           file  is examined.  For example, +G causes _l_e_s_s to ini-
                    384:           tially display each file starting  at  the  end  rather
                    385:           than the beginning.
                    386:
                    387:      V    Prints the version number of _l_e_s_s being run.
                    388:
                    389:
                    390:
                    391:
                    392:
                    393:                                                                 6
                    394:
                    395:
                    396:
                    397:
                    398:
                    399:
                    400: LESS(1)                  USER COMMANDS                    LESS(1)
                    401:
                    402:
                    403:
                    404:      q or :q or :Q or ZZ
                    405:           Exits _l_e_s_s.
                    406:
                    407:      The following three  commands  may  or  may  not  be  valid,
                    408:      depending on your particular installation.
                    409:
                    410:      v    Invokes an  editor  to  edit  the  current  file  being
                    411:           viewed.  The editor is taken from the environment vari-
                    412:           able VISUAL if defined, or  EDITOR  if  VISUAL  is  not
                    413:           defined, or defaults to "vi" if neither VISUAL nor EDI-
                    414:           TOR is defined.  See also the  discussion  of  LESSEDIT
                    415:           under the section on PROMPTS below.
                    416:
                    417:      ! shell-command
                    418:           Invokes a shell to run the shell-command given.  A per-
                    419:           cent sign (%) in the command is replaced by the name of
                    420:           the current file. A pound sign (#) is replaced  by  the
                    421:           name of the previously examined file.  "!!" repeats the
                    422:           last shell command.  "!" with no shell  command  simply
                    423:           invokes a shell.  In all cases, the shell is taken from
                    424:           the environment variable SHELL, or defaults to "sh".
                    425:
                    426:      | <m> shell-command
                    427:           <m> represents any mark letter.  Pipes a section of the
                    428:           input  file to the given shell command.  The section of
                    429:           the file to be piped is between the first line  on  the
                    430:           current  screen  and the position marked by the letter.
                    431:           <m> may also be ^ or $ to indicate beginning or end  of
                    432:           file respectively.  If <m> is . or newline, the current
                    433:           screen is piped.
                    434:
                    435: OPTIONS
                    436:      Command line options are described below.  Most options  may
                    437:      be changed while _l_e_s_s is running, via the "-" command.
                    438:
                    439:      Options are also taken from the environment variable "LESS".
                    440:      For  example,  to avoid typing "less -options ..." each time
                    441:      _l_e_s_s is invoked, you might tell _c_s_h:
                    442:
                    443:      setenv LESS "-options"
                    444:
                    445:      or if you use _s_h:
                    446:
                    447:      LESS="-options"; export LESS
                    448:
                    449:      The environment variable is parsed before the command  line,
                    450:      so  command line options override the LESS environment vari-
                    451:      able.  If an option appears in the LESS variable, it can  be
                    452:      reset  to  its  default on the command line by beginning the
                    453:      command line option with "-+".
                    454:
                    455:      A dollar sign ($) may be used to signal the end of an option
                    456:
                    457:
                    458:
                    459:                                                                 7
                    460:
                    461:
                    462:
                    463:
                    464:
                    465:
                    466: LESS(1)                  USER COMMANDS                    LESS(1)
                    467:
                    468:
                    469:
                    470:      string.   This  is  important only for options like -P which
                    471:      take a following string.
                    472:
                    473:      -?   This option displays a summary of the commands accepted
                    474:           by _l_e_s_s (the same as the h command).  If this option is
                    475:           given, all other options are ignored,  and  _l_e_s_s  exits
                    476:           after  the  help  screen  is viewed.  (Depending on how
                    477:           your shell interprets the  question  mark,  it  may  be
                    478:           necessary to quote the question mark, thus: "-\?".)
                    479:
                    480:      -a   Causes searches to start after the last line  displayed
                    481:           on the screen, thus skipping all lines displayed on the
                    482:           screen.  By default, searches start at the second  line
                    483:           on the screen (or after the last found line; see the -j
                    484:           option).
                    485:
                    486:      -b_n  Specifies the number of buffers _l_e_s_s will use for  each
                    487:           file.   Buffers  are  1K, and by default 10 buffers are
                    488:           used for each file (except if the file is a  pipe;  see
                    489:           the  -B  option).   The  number _n specifies a different
                    490:           number of buffers to use.
                    491:
                    492:      -B   By default, when data is read from a pipe, buffers  are
                    493:           allocated  automatically  as needed.  If a large amount
                    494:           of data is read from the pipe, this can cause  a  large
                    495:           amount  of  memory to be allocated.  The -B option dis-
                    496:           ables this automatic allocation of buffers  for  pipes,
                    497:           so  that only the number of buffers specified by the -b
                    498:           option are used.  Warning: use  of  -B  can  result  in
                    499:           erroneous  display, since only the most recently viewed
                    500:           part of the file is kept in memory; any earlier data is
                    501:           lost.
                    502:
                    503:      -c   Causes full screen repaints to be painted from the  top
                    504:           line  down.   By default, full screen repaints are done
                    505:           by scrolling from the bottom of the screen.
                    506:
                    507:      -C   The -C option is like -c, but  the  screen  is  cleared
                    508:           before it is repainted.
                    509:
                    510:      -d   The -d option suppresses  the  error  message  normally
                    511:           displayed  if the terminal is dumb; that is, lacks some
                    512:           important capability, such as the ability to clear  the
                    513:           screen or scroll backward.  The -d option does not oth-
                    514:           erwise change the behavior of _l_e_s_s on a dumb terminal).
                    515:
                    516:      -Dx_c_o_l_o_r
                    517:           [MS-DOS only] Sets the color of the text displayed.   x
                    518:           is  a  single  character which selects the type of text
                    519:           whose color is being set: n=normal, s=standout, d=bold,
                    520:           u=underlined,  k=blink.   _c_o_l_o_r  is  a  pair of numbers
                    521:           separated by a period. The  first  number  selects  the
                    522:
                    523:
                    524:
                    525:                                                                 8
                    526:
                    527:
                    528:
                    529:
                    530:
                    531:
                    532: LESS(1)                  USER COMMANDS                    LESS(1)
                    533:
                    534:
                    535:
                    536:           foreground  color and the second selects the background
                    537:           color of the text.  A single number _N is  the  same  as
                    538:           _N._0.
                    539:
                    540:      -e   Causes _l_e_s_s to automatically exit the  second  time  it
                    541:           reaches  end-of-file.  By default, the only way to exit
                    542:           _l_e_s_s is via the "q" command.
                    543:
                    544:      -E   Causes _l_e_s_s to automatically exit  the  first  time  it
                    545:           reaches end-of-file.
                    546:
                    547:      -f   Forces non-regular files to be opened.  (A  non-regular
                    548:           file  is  a  directory  or a device special file.) Also
                    549:           suppresses the warning message when a  binary  file  is
                    550:           opened.   By  default,  _l_e_s_s  will  refuse to open non-
                    551:           regular files.
                    552:
                    553:      -g   Normally, _l_e_s_s will highlight ALL strings  which  match
                    554:           the  last  search  command.   The  -g flag changes this
                    555:           behavior to highlight only the particular string  which
                    556:           was  found  by the last search command.  This can cause
                    557:           _l_e_s_s to run somewhat faster than the default.
                    558:
                    559:      -G   The -G flag  suppresses  all  highlighting  of  strings
                    560:           found by search commands.
                    561:
                    562:      -h_n  Specifies a maximum number of lines to scroll backward.
                    563:           If  it  is  necessary  to  scroll  backward more than _n
                    564:           lines, the screen is repainted in a  forward  direction
                    565:           instead.  (If the terminal does not have the ability to
                    566:           scroll backward, -h0 is implied.)
                    567:
                    568:      -i   Causes searches to ignore case; that is, uppercase  and
                    569:           lowercase  are  considered  identical.   This option is
                    570:           ignored if any uppercase letters appear in  the  search
                    571:           pattern;  in  other words, if a pattern contains upper-
                    572:           case letters, then that search does not ignore case.
                    573:
                    574:      -I   Like -i, but searches ignore case even if  the  pattern
                    575:           contains uppercase letters.
                    576:
                    577:      -j_n  Specifies a line on the screen where the "target"  line
                    578:           is  to be positioned.  A target line is the object of a
                    579:           text search, tag search, jump to a line number, jump to
                    580:           a  file  percentage, or jump to a marked position.  The
                    581:           screen line is specified by a number: the top  line  on
                    582:           the  screen is 1, the next is 2, and so on.  The number
                    583:           may be negative to specify a line relative to the  bot-
                    584:           tom of the screen: the bottom line on the screen is -1,
                    585:           the second to the bottom is -2, and so on.  If  the  -j
                    586:           option  is used, searches begin at the line immediately
                    587:           after the target line.  For example, if "-j4" is  used,
                    588:
                    589:
                    590:
                    591:                                                                 9
                    592:
                    593:
                    594:
                    595:
                    596:
                    597:
                    598: LESS(1)                  USER COMMANDS                    LESS(1)
                    599:
                    600:
                    601:
                    602:           the  target  line  is the fourth line on the screen, so
                    603:           searches begin at the fifth line on the screen.
                    604:
                    605:      -k_f_i_l_e_n_a_m_e
                    606:           Causes _l_e_s_s to open and interpret the named file  as  a
                    607:           _l_e_s_s_k_e_y  (1)  file.   Multiple -k options may be speci-
                    608:           fied.  If a file called .less exists in the user's home
                    609:           directory, this file is also used as a _l_e_s_s_k_e_y file.
                    610:
                    611:      -m   Causes _l_e_s_s to prompt verbosely (like _m_o_r_e),  with  the
                    612:           percent into the file.  By default, _l_e_s_s prompts with a
                    613:           colon.
                    614:
                    615:      -M   Causes _l_e_s_s to prompt even more verbosely than _m_o_r_e.
                    616:
                    617:      -n   Suppresses line numbers.   The  default  (to  use  line
                    618:           numbers)  may  cause  _l_e_s_s  to  run more slowly in some
                    619:           cases,  especially  with  a  very  large  input   file.
                    620:           Suppressing  line  numbers  with the -n flag will avoid
                    621:           this problem.   Using  line  numbers  means:  the  line
                    622:           number  will  be displayed in the verbose prompt and in
                    623:           the = command, and the v command will pass the  current
                    624:           line  number  to the editor (see also the discussion of
                    625:           LESSEDIT in PROMPTS below).
                    626:
                    627:      -N   Causes a line number to be displayed at  the  beginning
                    628:           of each line in the display.
                    629:
                    630:      -o_f_i_l_e_n_a_m_e
                    631:           Causes _l_e_s_s to copy its input to the named file  as  it
                    632:           is being viewed.  This applies only when the input file
                    633:           is a pipe, not an ordinary file.  If the  file  already
                    634:           exists, _l_e_s_s will ask for confirmation before overwrit-
                    635:           ing it.
                    636:
                    637:      -O_f_i_l_e_n_a_m_e
                    638:           The -O option is like -o,  but  it  will  overwrite  an
                    639:           existing file without asking for confirmation.
                    640:
                    641:           If no log file  has  been  specified,  the  -o  and  -O
                    642:           options  can  be used from within _l_e_s_s to specify a log
                    643:           file.  Without a file name, they will simply report the
                    644:           name of the log file.  The "s" command is equivalent to
                    645:           specifying -o from within _l_e_s_s.
                    646:
                    647:      -p_p_a_t_t_e_r_n
                    648:           The -p option on the  command  line  is  equivalent  to
                    649:           specifying  +/_p_a_t_t_e_r_n;  that is, it tells _l_e_s_s to start
                    650:           at the first occurrence of _p_a_t_t_e_r_n in the file.
                    651:
                    652:      -P_p_r_o_m_p_t
                    653:           Provides a way to tailor the  three  prompt  styles  to
                    654:
                    655:
                    656:
                    657:                                                                10
                    658:
                    659:
                    660:
                    661:
                    662:
                    663:
                    664: LESS(1)                  USER COMMANDS                    LESS(1)
                    665:
                    666:
                    667:
                    668:           your own preference.  This option would normally be put
                    669:           in the LESS environment  variable,  rather  than  being
                    670:           typed  in  with each _l_e_s_s command.  Such an option must
                    671:           either be the last option in the LESS variable,  or  be
                    672:           terminated  by  a dollar sign.  -P followed by a string
                    673:           changes the default (short) prompt to that string.  -Pm
                    674:           changes  the  medium (-m) prompt to the string, and -PM
                    675:           changes the long (-M) prompt.  Also,  -P=  changes  the
                    676:           message  printed  by the = command to the given string.
                    677:           All prompt strings consist of a sequence of letters and
                    678:           special  escape  sequences.  See the section on PROMPTS
                    679:           for more details.
                    680:
                    681:      -q   Causes moderately "quiet" operation: the terminal  bell
                    682:           is  not  rung  if an attempt is made to scroll past the
                    683:           end of the file or before the beginning  of  the  file.
                    684:           If  the  terminal  has  a  "visual  bell",  it  is used
                    685:           instead.  The  bell  will  be  rung  on  certain  other
                    686:           errors,  such  as  typing  an  invalid  character.  The
                    687:           default is to ring the terminal bell in all such cases.
                    688:
                    689:      -Q   Causes totally "quiet" operation: the terminal bell  is
                    690:           never rung.
                    691:
                    692:      -r   Causes "raw" control characters to be  displayed.   The
                    693:           default  is  to  display  control  characters using the
                    694:           caret notation; for example, a control-A (octal 001) is
                    695:           displayed  as "^A".  Warning: when the -r flag is used,
                    696:           _l_e_s_s cannot keep track of the actual appearance of  the
                    697:           screen  (since  this depends on how the screen responds
                    698:           to each type  of  control  character).   Thus,  various
                    699:           display  problems  may result, such as long lines being
                    700:           split in the wrong place.
                    701:
                    702:      -s   Causes consecutive blank lines to be  squeezed  into  a
                    703:           single  blank  line.  This is useful when viewing _n_r_o_f_f
                    704:           output.
                    705:
                    706:      -S   Causes lines longer than the screen width to be chopped
                    707:           rather  than  folded.  That is, the remainder of a long
                    708:           line is simply discarded.  The default is to fold  long
                    709:           lines; that is, display the remainder on the next line.
                    710:
                    711:      -t_t_a_g
                    712:           The -t option, followed immediately by a TAG, will edit
                    713:           the  file containing that tag.  For this to work, there
                    714:           must be a file called "tags" in the current  directory,
                    715:           which  was  previously  built by the _c_t_a_g_s (1) command.
                    716:           This option may also  be  specified  from  within  _l_e_s_s
                    717:           (using the - command) as a way of examining a new file.
                    718:           The command ":t" is equivalent to  specifying  -t  from
                    719:           within _l_e_s_s.
                    720:
                    721:
                    722:
                    723:                                                                11
                    724:
                    725:
                    726:
                    727:
                    728:
                    729:
                    730: LESS(1)                  USER COMMANDS                    LESS(1)
                    731:
                    732:
                    733:
                    734:      -T_t_a_g_s_f_i_l_e
                    735:           Specifies a tags file to be used instead of "tags".
                    736:
                    737:      -u   Causes backspaces and carriage returns to be treated as
                    738:           printable  characters;  that  is,  they are sent to the
                    739:           terminal when they appear in the input.
                    740:
                    741:      -U   Causes backspaces and carriage returns to be treated as
                    742:           control characters; that is, they are handled as speci-
                    743:           fied by the -r option.
                    744:
                    745:           By default, if neither -u nor -U is  given,  backspaces
                    746:           which  appear  adjacent  to an underscore character are
                    747:           treated specially: the  underlined  text  is  displayed
                    748:           using  the  terminal's hardware underlining capability.
                    749:           Also, backspaces which  appear  between  two  identical
                    750:           characters  are  treated specially: the overstruck text
                    751:           is printed using the terminal's hardware boldface capa-
                    752:           bility.   Other  backspaces are deleted, along with the
                    753:           preceding character.  Carriage returns immediately fol-
                    754:           lowed by a newline are deleted.  Other carriage returns
                    755:           are handled as specified by the -r option.  Text  which
                    756:           is overstruck or underlined can be searched for if nei-
                    757:           ther -u nor -U is in effect.
                    758:
                    759:      -V   Displays the version number of _l_e_s_s.
                    760:
                    761:      -w   Causes blank lines to be used to represent  lines  past
                    762:           the end of the file.  By default, a tilde character (~)
                    763:           is used.
                    764:
                    765:      -x_n  Sets tab stops every _n positions.  The default for _n is
                    766:           8.
                    767:
                    768:      -X   Disables sending the termcap initialization and  deini-
                    769:           tialization strings to the terminal.  This is sometimes
                    770:           desirable if the deinitialization string does something
                    771:           unnecessary, like clearing the screen.
                    772:
                    773:      -y_n  Specifies a maximum number of lines to scroll  forward.
                    774:           If it is necessary to scroll forward more than _n lines,
                    775:           the screen is repainted instead.  The -c or  -C  option
                    776:           may  be  used  to repaint from the top of the screen if
                    777:           desired.   By  default,  any  forward  movement  causes
                    778:           scrolling.
                    779:
                    780:      -[z]_n
                    781:           Changes the default scrolling window size to  _n  lines.
                    782:           The default is one screenful.  The z and w commands can
                    783:           also be used to change the window size.  The "z" may be
                    784:           omitted for compatibility with _m_o_r_e. If the number _n is
                    785:           negative, it indicates _n lines less  than  the  current
                    786:
                    787:
                    788:
                    789:                                                                12
                    790:
                    791:
                    792:
                    793:
                    794:
                    795:
                    796: LESS(1)                  USER COMMANDS                    LESS(1)
                    797:
                    798:
                    799:
                    800:           screen  size.   For example, if the screen is 24 lines,
                    801:           -_z-_4 sets the scrolling window to  20  lines.   If  the
                    802:           screen  is  resized  to  40 lines, the scrolling window
                    803:           automatically changes to 36 lines.
                    804:
                    805:      +    If a command line option begins with +,  the  remainder
                    806:           of  that  option  is  taken to be an initial command to
                    807:           _l_e_s_s. For example, +G tells _l_e_s_s to start at the end of
                    808:           the  file rather than the beginning, and +/xyz tells it
                    809:           to start at the first occurrence of "xyz" in the  file.
                    810:           As a special case, +<number> acts like +<number>g; that
                    811:           is, it starts the display at the specified line  number
                    812:           (however,  see the caveat under the "g" command above).
                    813:           If the option  starts  with  ++,  the  initial  command
                    814:           applies  to every file being viewed, not just the first
                    815:           one.  The + command described previously  may  also  be
                    816:           used  to  set  (or change) an initial command for every
                    817:           file.
                    818:
                    819:
                    820: LINE EDITING
                    821:      When entering command line at the bottom of the screen  (for
                    822:      example, a filename for the :e command, or the pattern for a
                    823:      search command), certain keys can be used to manipulate  the
                    824:      command  line.   Most  commands  have an alternate form in [
                    825:      brackets ] which can be used if a key does not  exist  on  a
                    826:      particular keyboard. (The bracketed forms do not work in the
                    827:      MS-DOS version.) Any of these special keys  may  be  entered
                    828:      literally  by  preceding  it  with  the "literal" character,
                    829:      either ^V or ^A.  A backslash itself  may  also  be  entered
                    830:      literally by entering two backslashes.
                    831:
                    832:      LEFTARROW [ ESC-h ]
                    833:           Move the cursor one space to the left.
                    834:
                    835:      RIGHTARROW [ ESC-l ]
                    836:           Move the cursor one space to the right.
                    837:
                    838:      ^LEFTARROW [ ESC-b or ESC-LEFTARROW ]
                    839:           (That is, CONTROL and LEFTARROW  simultaneously.)  Move
                    840:           the cursor one word to the left.
                    841:
                    842:      ^RIGHTARROW [ ESC-w or ESC-RIGHTARROW ]
                    843:           (That is, CONTROL and RIGHTARROW simultaneously.)  Move
                    844:           the cursor one word to the right.
                    845:
                    846:      HOME [ ESC-0 ]
                    847:           Move the cursor to the beginning of the line.
                    848:
                    849:      END [ ESC-$ ]
                    850:           Move the cursor to the end of the line.
                    851:
                    852:
                    853:
                    854:
                    855:                                                                13
                    856:
                    857:
                    858:
                    859:
                    860:
                    861:
                    862: LESS(1)                  USER COMMANDS                    LESS(1)
                    863:
                    864:
                    865:
                    866:      BACKSPACE
                    867:           Delete the character to the left of the cursor, or can-
                    868:           cel the command if the command line is empty.
                    869:
                    870:      DELETE or [ ESC-x ]
                    871:           Delete the character under the cursor.
                    872:
                    873:      ^BACKSPACE [ ESC-BACKSPACE ]
                    874:           (That is, CONTROL and BACKSPACE simultaneously.) Delete
                    875:           the word to the left of the cursor.
                    876:
                    877:      ^DELETE [ ESC-X or ESC-DELETE ]
                    878:           (That is, CONTROL and  DELETE  simultaneously.)  Delete
                    879:           the word under the cursor.
                    880:
                    881:      UPARROW [ ESC-k ]
                    882:           Retrieve the previous command line.
                    883:
                    884:      DOWNARROW [ ESC-j ]
                    885:           Retrieve the next command line.
                    886:
                    887:      TAB  Complete the partial filename to the left of  the  cur-
                    888:           sor.   If  it matches more than one filename, the first
                    889:           match is entered into the command line.  Repeated  TABs
                    890:           will cycle thru the other matching filenames.
                    891:
                    892:      BACKTAB [ ESC-TAB ]
                    893:           Like, TAB, but cycles in the reverse direction thru the
                    894:           matching filenames.
                    895:
                    896:      ^L   Complete the partial filename to the left of  the  cur-
                    897:           sor.  If it matches more than one filename, all matches
                    898:           are entered into the command line (if they fit).
                    899:
                    900:      ^U (Unix) or ESC (MS-DOS)
                    901:           Delete the entire command line, or cancel  the  command
                    902:           if the command line is empty.  If you have changed your
                    903:           line-kill character in Unix to something other than ^U,
                    904:           that character is used instead of ^U.
                    905:
                    906:
                    907: KEY BINDINGS
                    908:      You may define your own _l_e_s_s commands by using  the  program
                    909:      _l_e_s_s_k_e_y  (1)  to  create  a file called ".less" in your home
                    910:      directory.  This file specifies a set of command keys and an
                    911:      action  associated  with each key.  You may also use _l_e_s_s_k_e_y
                    912:      to change the line-editing keys (see LINE EDITING).  See the
                    913:      _l_e_s_s_k_e_y manual page for more details.
                    914:
                    915:
                    916: INPUT PREPROCESSOR
                    917:      You may define an "input preprocessor" for _l_e_s_s. Before _l_e_s_s
                    918:
                    919:
                    920:
                    921:                                                                14
                    922:
                    923:
                    924:
                    925:
                    926:
                    927:
                    928: LESS(1)                  USER COMMANDS                    LESS(1)
                    929:
                    930:
                    931:
                    932:      opens  a  file,  it  first  gives  your input preprocessor a
                    933:      chance to modify the  way  the  contents  of  the  file  are
                    934:      displayed.   An  input  preprocessor is simply an executable
                    935:      program (or shell script), which writes the contents of  the
                    936:      file  to a different file, called the replacement file.  The
                    937:      contents of the replacement file are then displayed in place
                    938:      of  the  contents  of  the  original file.  However, it will
                    939:      appear to the user as if the original file is  opened;  that
                    940:      is,  _l_e_s_s  will display the original filename as the name of
                    941:      the current file.
                    942:
                    943:      An input preprocessor receives one  command  line  argument,
                    944:      the  original  filename,  as entered by the user.  It should
                    945:      create the replacement file, and when  finished,  print  the
                    946:      name of the replacement file to its standard output.  If the
                    947:      input preprocessor does not output a  replacement  filename,
                    948:      _l_e_s_s  uses  the original file, as normal.  The input prepro-
                    949:      cessor is not called when viewing standard input.  To set up
                    950:      an input preprocessor, set the LESSOPEN environment variable
                    951:      to a command line which will invoke your input preprocessor.
                    952:      This  command  line  should  include  one  occurrence of the
                    953:      string "%s", which will be replaced by the filename when the
                    954:      input preprocessor command is invoked.
                    955:
                    956:      When _l_e_s_s closes a file opened in such a way, it  will  call
                    957:      another  program,  called the input postprocessor, which may
                    958:      perform any desired clean-up action (such  as  deleting  the
                    959:      replacement   file   created  by  LESSOPEN).   This  program
                    960:      receives two command line arguments, the  original  filename
                    961:      as  entered  by  the  user,  and the name of the replacement
                    962:      file.  To set up an input postprocessor, set  the  LESSCLOSE
                    963:      environment  variable  to  a  command line which will invoke
                    964:      your input postprocessor.  It may include two occurrences of
                    965:      the  string  "%s";  the  first is replaced with the original
                    966:      name of the file  and  the  second  with  the  name  of  the
                    967:      replacement file, which was output by LESSOPEN.
                    968:
                    969:      For example, on many Unix systems, these  two  scripts  will
                    970:      allow  you to keep files in compressed format, but still let
                    971:      _l_e_s_s view them directly:
                    972:
                    973:      lessopen.sh:
                    974:           #! /bin/sh
                    975:           case "$1" in
                    976:           *.Z) uncompress -c $1  >/tmp/less.$$  2>/dev/null
                    977:                if [ -s /tmp/less.$$ ]; then
                    978:                     echo /tmp/less.$$
                    979:                else
                    980:                     rm -f /tmp/less.$$
                    981:                fi
                    982:                ;;
                    983:           esac
                    984:
                    985:
                    986:
                    987:                                                                15
                    988:
                    989:
                    990:
                    991:
                    992:
                    993:
                    994: LESS(1)                  USER COMMANDS                    LESS(1)
                    995:
                    996:
                    997:
                    998:      lessclose.sh:
                    999:           #! /bin/sh
                   1000:           rm $2
                   1001:
                   1002:      To use these scripts, put them both where they can  be  exe-
                   1003:      cuted     and     set     LESSOPEN="lessopen.sh %s",     and
                   1004:      LESSCLOSE="lessclose.sh %s %s".  More complex  LESSOPEN  and
                   1005:      LESSCLOSE  scripts  may  be written to accept other types of
                   1006:      compressed files, and so on.
                   1007:
                   1008:      It is also possible to set up an input preprocessor to  pipe
                   1009:      the file data directly to _l_e_s_s, rather than putting the data
                   1010:      into a replacement file.  This avoids the need to decompress
                   1011:      the  entire  file  before  starting  to  view  it.  An input
                   1012:      preprocessor that works this way is called  an  input  pipe.
                   1013:      An  input pipe, instead of writing the name of a replacement
                   1014:      file on its standard output, writes the entire  contents  of
                   1015:      the  replacement  file on its standard output.  If the input
                   1016:      pipe does not write any characters on its  standard  output,
                   1017:      then there is no replacement file and _l_e_s_s uses the original
                   1018:      file, as normal.  To use an input pipe, make the first char-
                   1019:      acter  in  the  LESSOPEN environment variable a vertical bar
                   1020:      (|) to signify that the input preprocessor is an input pipe.
                   1021:
                   1022:      For example, on many Unix systems,  this  script  will  work
                   1023:      like the previous example scripts:
                   1024:
                   1025:      lesspipe.sh:
                   1026:           !# /bin/sh
                   1027:           case "$1" in
                   1028:           *.Z) uncompress -c $1  2>/dev/null
                   1029:                ;;
                   1030:           esac
                   1031:
                   1032:      To use this script, put it where it can be executed and  set
                   1033:      LESSOPEN="|lesspipe.sh  %s".   When an input pipe is used, a
                   1034:      LESSCLOSE postprocessor can be used, but it is  usually  not
                   1035:      necessary  since  there  is no replacement file to clean up.
                   1036:      In this case, the replacement file name passed to the  LESS-
                   1037:      CLOSE postprocessor is "-".
                   1038:
                   1039:
                   1040: NATIONAL CHARACTER SETS
                   1041:      There are three types of characters in the input file:
                   1042:
                   1043:      normal characters
                   1044:           can be displayed directly to the screen.
                   1045:
                   1046:      control characters
                   1047:           should not be displayed directly, but are  expected  to
                   1048:           be  found in ordinary text files (such as backspace and
                   1049:           tab).
                   1050:
                   1051:
                   1052:
                   1053:                                                                16
                   1054:
                   1055:
                   1056:
                   1057:
                   1058:
                   1059:
                   1060: LESS(1)                  USER COMMANDS                    LESS(1)
                   1061:
                   1062:
                   1063:
                   1064:      binary characters
                   1065:           should not be displayed directly and are  not  expected
                   1066:           to be found in text files.
                   1067:
                   1068:      A "character set" is simply a description of  which  charac-
                   1069:      ters  are to be considered normal, control, and binary.  The
                   1070:      LESSCHARSET environment variable may be  used  to  select  a
                   1071:      character set.  Possible values for LESSCHARSET are:
                   1072:
                   1073:      ascii
                   1074:           The default  character  set.   BS,  TAB,  NL,  CR,  and
                   1075:           formfeed  are control characters, all chars with values
                   1076:           between 127 and 255 are binary, and all others are nor-
                   1077:           mal.
                   1078:
                   1079:      latin1
                   1080:           Selects the ISO 8859/1 character set.  latin-1  is  the
                   1081:           same  as  ASCII,  except characters between 161 and 255
                   1082:           are treated as normal characters.
                   1083:
                   1084:      dos  Selects a character set appropriate for MS-DOS.
                   1085:
                   1086:      koi8-r
                   1087:           Selects a Russian character set.
                   1088:
                   1089:      next Selects a character set appropriate for NeXT computers.
                   1090:
                   1091:      In special cases, it may be desired to tailor _l_e_s_s to use  a
                   1092:      character  set other than the ones definable by LESSCHARSET.
                   1093:      In this case, the environment variable  LESSCHARDEF  can  be
                   1094:      used  to  define  a  character  set.   It should be set to a
                   1095:      string where each character in  the  string  represents  one
                   1096:      character  in  the character set.  The character "." is used
                   1097:      for a normal character, "c" for control, and "b" for binary.
                   1098:      A  decimal  number may be used for repetition.  For example,
                   1099:      "bccc4b." would mean character 0 is binary, 1, 2 and  3  are
                   1100:      control,  4,  5,  6  and 7 are binary, and 8 is normal.  All
                   1101:      characters after the last are taken to be the  same  as  the
                   1102:      last, so characters 9 through 255 would be normal.  (This is
                   1103:      an example, and does  not  necessarily  represent  any  real
                   1104:      character set.)
                   1105:
                   1106:      This  table  shows  the  value  of  LESSCHARDEF   which   is
                   1107:      equivalent to each of the possible values for LESSCHARSET:
                   1108:
                   1109:           ascii     8bcccbcc18b95.b
                   1110:           latin1    8bcccbcc18b95.33b.
                   1111:           dos       8bcccbcc12bc5b95.b.
                   1112:           koi8-r    8bcccbcc18b95.b128.
                   1113:           next      8bcccbcc18b95.bb125.bb
                   1114:
                   1115:
                   1116:
                   1117:
                   1118:
                   1119:                                                                17
                   1120:
                   1121:
                   1122:
                   1123:
                   1124:
                   1125:
                   1126: LESS(1)                  USER COMMANDS                    LESS(1)
                   1127:
                   1128:
                   1129:
                   1130:      If neither LESSCHARSET nor LESSCHARDEF is set, but your sys-
                   1131:      tem  supports  the _s_e_t_l_o_c_a_l_e interface, _l_e_s_s will use setlo-
                   1132:      cale to determine the  character  set.   setlocale  is  con-
                   1133:      trolled  by  setting  the LANG or LC_CTYPE environment vari-
                   1134:      ables.
                   1135:
                   1136:      Control and binary  characters  are  displayed  in  standout
                   1137:      (reverse  video).  Each such character is displayed in caret
                   1138:      notation if possible (e.g. ^A for control-A).   Caret  nota-
                   1139:      tion  is  used  only  if inverting the 0100 bit results in a
                   1140:      normal printable character.   Otherwise,  the  character  is
                   1141:      displayed  as  a  hex number in angle brackets.  This format
                   1142:      can be changed by setting the LESSBINFMT  environment  vari-
                   1143:      able.   LESSBINFMT may begin with a "*" and one character to
                   1144:      select the display attribute:  "*k"  is  blinking,  "*d"  is
                   1145:      bold,  "*u"  is underlined, "*s" is standout.  If LESSBINFMT
                   1146:      does not begin with a "*", normal attribute is assumed.  The
                   1147:      remainder  of  LESSBINFMT  is a string which may include one
                   1148:      printf-style escape sequence (a % followed by x,  X,  o,  d,
                   1149:      etc.).  For example, if LESSBINFMT is "*u[%x]", binary char-
                   1150:      acters are displayed in underlined hexadecimal surrounded by
                   1151:      brackets.   The  default  if  no  LESSBINFMT is specified is
                   1152:      "*d<%X>".
                   1153:
                   1154:
                   1155: PROMPTS
                   1156:      The -P option allows  you  to  tailor  the  prompt  to  your
                   1157:      preference.   The string given to the -P option replaces the
                   1158:      specified prompt string.  Certain characters in  the  string
                   1159:      are  interpreted  specially.  The prompt mechanism is rather
                   1160:      complicated to provide flexibility, but  the  ordinary  user
                   1161:      need not understand the details of constructing personalized
                   1162:      prompt strings.
                   1163:
                   1164:      A percent sign followed by a single  character  is  expanded
                   1165:      according to what the following character is:
                   1166:
                   1167:      %b_X  Replaced by the byte  offset  into  the  current  input
                   1168:           file.   The  b is followed by a single character (shown
                   1169:           as _X above) which specifies the line whose byte  offset
                   1170:           is  to  be  used.   If the character is a "t", the byte
                   1171:           offset of the top line in the display is used,  an  "m"
                   1172:           means  use  the middle line, a "b" means use the bottom
                   1173:           line, a "B" means use the line just  after  the  bottom
                   1174:           line,  and a "j" means use the "target" line, as speci-
                   1175:           fied by the -j option.
                   1176:
                   1177:      %B   Replaced by the size of the current input file.
                   1178:
                   1179:      %E   Replaced by the name of the  editor  (from  the  VISUAL
                   1180:           environment  variable,  or the EDITOR environment vari-
                   1181:           able if VISUAL is not defined).  See the discussion  of
                   1182:
                   1183:
                   1184:
                   1185:                                                                18
                   1186:
                   1187:
                   1188:
                   1189:
                   1190:
                   1191:
                   1192: LESS(1)                  USER COMMANDS                    LESS(1)
                   1193:
                   1194:
                   1195:
                   1196:           the LESSEDIT feature below.
                   1197:
                   1198:      %f   Replaced by the name of the current input file.
                   1199:
                   1200:      %i   Replaced by the index of the current file in  the  list
                   1201:           of input files.
                   1202:
                   1203:      %l_X  Replaced by the line number of  a  line  in  the  input
                   1204:           file.   The  line to be used is determined by the _X, as
                   1205:           with the %b option.
                   1206:
                   1207:      %L   Replaced by the line number of the  last  line  in  the
                   1208:           input file.
                   1209:
                   1210:      %m   Replaced by the total number of input files.
                   1211:
                   1212:      %p_X  Replaced by the percent into the  current  input  file.
                   1213:           The  line  used  is  determined by the _X as with the %b
                   1214:           option.
                   1215:
                   1216:      %s   Same as %B.
                   1217:
                   1218:      %t   Causes any trailing spaces to be removed.  Usually used
                   1219:           at the end of the string, but may appear anywhere.
                   1220:
                   1221:      %x   Replaced by the name of the  next  input  file  in  the
                   1222:           list.
                   1223:
                   1224:      If any item is unknown (for example, the file size if  input
                   1225:      is a pipe), a question mark is printed instead.
                   1226:
                   1227:      The format of the prompt string can be changed depending  on
                   1228:      certain  conditions.   A  question mark followed by a single
                   1229:      character acts like an  "IF":  depending  on  the  following
                   1230:      character,  a  condition  is evaluated.  If the condition is
                   1231:      true, any characters following the question mark and  condi-
                   1232:      tion  character, up to a period, are included in the prompt.
                   1233:      If the condition is false, such characters are not included.
                   1234:      A  colon  appearing between the question mark and the period
                   1235:      can be used to establish an "ELSE": any  characters  between
                   1236:      the  colon  and the period are included in the string if and
                   1237:      only if the IF condition  is  false.   Condition  characters
                   1238:      (which follow a question mark) may be:
                   1239:
                   1240:      ?a   True if any characters have been included in the prompt
                   1241:           so far.
                   1242:
                   1243:      ?b_X  True if the byte offset of the specified line is known.
                   1244:
                   1245:      ?B   True if the size of current input file is known.
                   1246:
                   1247:      ?e   True if at end-of-file.
                   1248:
                   1249:
                   1250:
                   1251:                                                                19
                   1252:
                   1253:
                   1254:
                   1255:
                   1256:
                   1257:
                   1258: LESS(1)                  USER COMMANDS                    LESS(1)
                   1259:
                   1260:
                   1261:
                   1262:      ?f   True if there is an input filename (that is,  if  input
                   1263:           is not a pipe).
                   1264:
                   1265:      ?l_X  True if the line number of the specified line is known.
                   1266:
                   1267:      ?L   True if the line number of the last line in the file is
                   1268:           known.
                   1269:
                   1270:      ?m   True if there is more than one input file.
                   1271:
                   1272:      ?n   True if this is the first prompt in a new input file.
                   1273:
                   1274:      ?p_X  True if the percent into the current input file of  the
                   1275:           specified line is known.
                   1276:
                   1277:      ?s   Same as "?B".
                   1278:
                   1279:      ?x   True if there is a next input file  (that  is,  if  the
                   1280:           current input file is not the last one).
                   1281:
                   1282:      Any characters other than the special ones  (question  mark,
                   1283:      colon, period, percent, and backslash) become literally part
                   1284:      of the  prompt.   Any  of  the  special  characters  may  be
                   1285:      included  in  the  prompt  literally  by preceding it with a
                   1286:      backslash.
                   1287:
                   1288:      Some examples:
                   1289:
                   1290:      ?f%f:Standard input.
                   1291:
                   1292:      This prompt prints the filename,  if  known;  otherwise  the
                   1293:      string "Standard input".
                   1294:
                   1295:      ?f%f .?ltLine %lt:?pt%pt\%:?btByte %bt:-...
                   1296:
                   1297:      This  prompt  would  print  the  filename,  if  known.   The
                   1298:      filename is followed by the line number, if known, otherwise
                   1299:      the percent if known, otherwise the byte  offset  if  known.
                   1300:      Otherwise, a dash is printed.  Notice how each question mark
                   1301:      has a matching period, and  how  the  %  after  the  %pt  is
                   1302:      included literally by escaping it with a backslash.
                   1303:
                   1304:      ?n?f%f .?m(file %i of %m) ..?e(END) ?x- Next\: %x..%t
                   1305:
                   1306:      This prints the filename if this is the first  prompt  in  a
                   1307:      file, followed by the "file N of N" message if there is more
                   1308:      than one input file.  Then, if we are  at  end-of-file,  the
                   1309:      string  "(END)"  is printed followed by the name of the next
                   1310:      file, if there is one.  Finally,  any  trailing  spaces  are
                   1311:      truncated.  This is the default prompt.  For reference, here
                   1312:      are the defaults for  the  other  two  prompts  (-m  and  -M
                   1313:      respectively).   Each  is  broken  into  two  lines here for
                   1314:
                   1315:
                   1316:
                   1317:                                                                20
                   1318:
                   1319:
                   1320:
                   1321:
                   1322:
                   1323:
                   1324: LESS(1)                  USER COMMANDS                    LESS(1)
                   1325:
                   1326:
                   1327:
                   1328:      readability only.
                   1329:
                   1330:      ?n?f%f .?m(file %i of %m) ..?e(END) ?x- Next\: %x.:
                   1331:           ?pB%pB\%:byte %bB?s/%s...%t
                   1332:
                   1333:      ?f%f .?n?m(file %i of %m) ..?ltline %lt?L/%L. :byte %bB?s/%s. .
                   1334:           ?e(END) ?x- Next\: %x.:?pB%pB\%..%t
                   1335:
                   1336:      And here is the default message produced by the = command:
                   1337:
                   1338:      ?f%f .?m(file %i of %m) .?ltline %lt?L/%L. .
                   1339:           byte %bB?s/%s. ?e(END) :?pB%pB\%..%t
                   1340:
                   1341:      The prompt expansion features are also used for another pur-
                   1342:      pose:  if an environment variable LESSEDIT is defined, it is
                   1343:      used as the command to be executed when  the  v  command  is
                   1344:      invoked.  The LESSEDIT string is expanded in the same way as
                   1345:      the prompt strings.  The default value for LESSEDIT is:
                   1346:
                   1347:           %E ?lm+%lm. %f
                   1348:
                   1349:      Note that this expands to the editor name, followed by  a  +
                   1350:      and  the  line  number,  followed by the file name.  If your
                   1351:      editor does not accept  the  "+linenumber"  syntax,  or  has
                   1352:      other  differences  in invocation syntax, the LESSEDIT vari-
                   1353:      able can be changed to modify this default.
                   1354:
                   1355:
                   1356: ENVIRONMENT VARIABLES
                   1357:      COLUMNS
                   1358:           Sets the number of columns on the screen.   Takes  pre-
                   1359:           cedence  over  the  number  of columns specified by the
                   1360:           TERM variable.  (But if you  have  a  windowing  system
                   1361:           which  supports  TIOCGWINSZ  or  WIOCGETD,  the  window
                   1362:           system's idea of the screen size takes precedence  over
                   1363:           the LINES and COLUMNS environment variables.)
                   1364:
                   1365:      EDITOR
                   1366:           The name of the editor (used for the v command).
                   1367:
                   1368:      HOME Name of the user's home directory (used to find a .less
                   1369:           file).
                   1370:
                   1371:      LANG Language for determining the character set.
                   1372:
                   1373:      LC_CTYPE
                   1374:           Language for determining the character set.
                   1375:
                   1376:      LESS Flags which are passed to _l_e_s_s automatically.
                   1377:
                   1378:      LESSBINFMT
                   1379:           Format  for   displaying   non-printable,   non-control
                   1380:
                   1381:
                   1382:
                   1383:                                                                21
                   1384:
                   1385:
                   1386:
                   1387:
                   1388:
                   1389:
                   1390: LESS(1)                  USER COMMANDS                    LESS(1)
                   1391:
                   1392:
                   1393:
                   1394:           characters.
                   1395:
                   1396:      LESSCHARDEF
                   1397:           Defines a character set.
                   1398:
                   1399:      LESSCHARSET
                   1400:           Selects a predefined character set.
                   1401:
                   1402:      LESSCLOSE
                   1403:           Command  line   to   invoke   the   (optional)   input-
                   1404:           postprocessor.
                   1405:
                   1406:      LESSEDIT
                   1407:           Editor prototype string (used for the v command).   See
                   1408:           discussion under PROMPTS.
                   1409:
                   1410:      LESSHELP
                   1411:           Name of the help file.
                   1412:
                   1413:      LESSOPEN
                   1414:           Command  line   to   invoke   the   (optional)   input-
                   1415:           preprocessor.
                   1416:
                   1417:      LINES
                   1418:           Sets the number of lines on  the  screen.   Takes  pre-
                   1419:           cedence  over the number of lines specified by the TERM
                   1420:           variable.
                   1421:
                   1422:      SHELL
                   1423:           The shell used to execute the ! command, as well as  to
                   1424:           expand filenames.
                   1425:
                   1426:      TERM The type of terminal on which _l_e_s_s is being run.
                   1427:
                   1428:      VISUAL
                   1429:           The name of the editor (used for the v command).
                   1430:
                   1431:
                   1432: SEE ALSO
                   1433:      lesskey(1)
                   1434:
                   1435:
                   1436: WARNINGS
                   1437:      The = command and prompts (unless changed by -P) report  the
                   1438:      line  number  of  the line at the top of the screen, but the
                   1439:      byte and percent of the line at the bottom of the screen.
                   1440:
                   1441:      If the :e command is used to name more than  one  file,  and
                   1442:      one  of  the named files has been viewed previously, the new
                   1443:      files may be entered into the list in an unexpected order.
                   1444:
                   1445:
                   1446:
                   1447:
                   1448:
                   1449:                                                                22
                   1450:
                   1451:
                   1452:
                   1453:
                   1454:
                   1455:
                   1456: LESS(1)                  USER COMMANDS                    LESS(1)
                   1457:
                   1458:
                   1459:
                   1460:      On certain older terminals  (the  so-called  "magic  cookie"
                   1461:      terminals),  search  highlighting  will  cause  an erroneous
                   1462:      display.  On such terminals, search highlighting is disabled
                   1463:      by default to avoid possible problems.
                   1464:
                   1465:      In certain cases, when search highlighting is enabled and  a
                   1466:      search  pattern begins with a ^, more text than the matching
                   1467:      string may be highlighted.
                   1468:
                   1469:
                   1470:
                   1471: COPYRIGHT
                   1472:      Copyright (c) 1984,1985,1989,1994,1995  Mark Nudelman
                   1473:
                   1474:
                   1475:
                   1476:
                   1477:
                   1478:
                   1479:
                   1480:
                   1481:
                   1482:
                   1483:
                   1484:
                   1485:
                   1486:
                   1487:
                   1488:
                   1489:
                   1490:
                   1491:
                   1492:
                   1493:
                   1494:
                   1495:
                   1496:
                   1497:
                   1498:
                   1499:
                   1500:
                   1501:
                   1502:
                   1503:
                   1504:
                   1505:
                   1506:
                   1507:
                   1508:
                   1509:
                   1510:
                   1511:
                   1512:
                   1513:
                   1514:
                   1515:                                                                23
                   1516:
                   1517:
                   1518: