less.man revision 191930
1145519SdarrenrLESS(1) LESS(1) 2145510Sdarrenr 3145510Sdarrenr 4145510Sdarrenr 5145510Sdarrenr[1mNAME[0m 6145510Sdarrenr less - opposite of more 7145510Sdarrenr 8146277Sdarrenr[1mSYNOPSIS[0m 9146277Sdarrenr [1mless -?[0m 10145510Sdarrenr [1mless --help[0m 11145510Sdarrenr [1mless -V[0m 12145510Sdarrenr [1mless --version[0m 13145510Sdarrenr [1mless [-[+]aBcCdeEfFgGiIJKLmMnNqQrRsSuUVwWX~][0m 14145510Sdarrenr [1m[-b [4m[22mspace[24m[1m] [-h [4m[22mlines[24m[1m] [-j [4m[22mline[24m[1m] [-k [4m[22mkeyfile[24m[1m][0m 15145510Sdarrenr [1m[-{oO} [4m[22mlogfile[24m[1m] [-p [4m[22mpattern[24m[1m] [-P [4m[22mprompt[24m[1m] [-t [4m[22mtag[24m[1m][0m 16145510Sdarrenr [1m[-T [4m[22mtagsfile[24m[1m] [-x [4m[22mtab[24m[1m,...] [-y [4m[22mlines[24m[1m] [-[z] [4m[22mlines[24m[1m][0m 17145510Sdarrenr [1m[-# [4m[22mshift[24m[1m] [+[+][4m[22mcmd[24m[1m] [--] [[4m[22mfilename[24m[1m]...[0m 18145510Sdarrenr (See the OPTIONS section for alternate option syntax with long option 19145510Sdarrenr names.) 20145510Sdarrenr 21145510Sdarrenr 22145510Sdarrenr[1mDESCRIPTION[0m 23145510Sdarrenr [4mLess[24m is a program similar to [4mmore[24m (1), but which allows backward move- 24145510Sdarrenr ment in the file as well as forward movement. Also, [4mless[24m does not have 25145510Sdarrenr to read the entire input file before starting, so with large input 26145510Sdarrenr files it starts up faster than text editors like [4mvi[24m (1). [4mLess[24m uses 27145510Sdarrenr termcap (or terminfo on some systems), so it can run on a variety of 28145510Sdarrenr terminals. There is even limited support for hardcopy terminals. (On 29145510Sdarrenr a hardcopy terminal, lines which should be printed at the top of the 30145510Sdarrenr screen are prefixed with a caret.) 31145510Sdarrenr 32145510Sdarrenr Commands are based on both [4mmore[24m and [4mvi.[24m Commands may be preceded by a 33145510Sdarrenr decimal number, called N in the descriptions below. The number is used 34145510Sdarrenr by some commands, as indicated. 35145510Sdarrenr 36145510Sdarrenr 37145510Sdarrenr[1mCOMMANDS[0m 38145510Sdarrenr In the following descriptions, ^X means control-X. ESC stands for the 39145510Sdarrenr ESCAPE key; for example ESC-v means the two character sequence 40145510Sdarrenr "ESCAPE", then "v". 41145510Sdarrenr 42145510Sdarrenr h or H Help: display a summary of these commands. If you forget all 43145510Sdarrenr the other commands, remember this one. 44145510Sdarrenr 45145510Sdarrenr SPACE or ^V or f or ^F 46145510Sdarrenr Scroll forward N lines, default one window (see option -z 47145510Sdarrenr below). If N is more than the screen size, only the final 48145510Sdarrenr screenful is displayed. Warning: some systems use ^V as a spe- 49145510Sdarrenr cial literalization character. 50145510Sdarrenr 51145510Sdarrenr z Like SPACE, but if N is specified, it becomes the new window 52145510Sdarrenr size. 53145510Sdarrenr 54145510Sdarrenr ESC-SPACE 55145510Sdarrenr Like SPACE, but scrolls a full screenful, even if it reaches 56145510Sdarrenr end-of-file in the process. 57145510Sdarrenr 58145510Sdarrenr RETURN or ^N or e or ^E or j or ^J 59145510Sdarrenr Scroll forward N lines, default 1. The entire N lines are dis- 60145510Sdarrenr played, even if N is more than the screen size. 61145510Sdarrenr 62153881Sguido d or ^D 63145510Sdarrenr Scroll forward N lines, default one half of the screen size. If 64145510Sdarrenr N is specified, it becomes the new default for subsequent d and 65145510Sdarrenr u commands. 66145510Sdarrenr 67145510Sdarrenr b or ^B or ESC-v 68145510Sdarrenr Scroll backward N lines, default one window (see option -z 69145510Sdarrenr below). If N is more than the screen size, only the final 70145510Sdarrenr screenful is displayed. 71145510Sdarrenr 72145510Sdarrenr w Like ESC-v, but if N is specified, it becomes the new window 73145510Sdarrenr size. 74145510Sdarrenr 75145510Sdarrenr y or ^Y or ^P or k or ^K 76145510Sdarrenr Scroll backward N lines, default 1. The entire N lines are dis- 77145510Sdarrenr played, even if N is more than the screen size. Warning: some 78145510Sdarrenr systems use ^Y as a special job control character. 79145510Sdarrenr 80145510Sdarrenr u or ^U 81145510Sdarrenr Scroll backward N lines, default one half of the screen size. 82145510Sdarrenr If N is specified, it becomes the new default for subsequent d 83145510Sdarrenr and u commands. 84161357Sguido 85161357Sguido ESC-) or RIGHTARROW 86161357Sguido Scroll horizontally right N characters, default half the screen 87161357Sguido width (see the -# option). If a number N is specified, it 88145510Sdarrenr becomes the default for future RIGHTARROW and LEFTARROW com- 89145510Sdarrenr mands. While the text is scrolled, it acts as though the -S 90145510Sdarrenr option (chop lines) were in effect. 91145510Sdarrenr 92145510Sdarrenr ESC-( or LEFTARROW 93145510Sdarrenr Scroll horizontally left N characters, default half the screen 94145510Sdarrenr width (see the -# option). If a number N is specified, it 95145510Sdarrenr becomes the default for future RIGHTARROW and LEFTARROW com- 96145510Sdarrenr mands. 97145510Sdarrenr 98145510Sdarrenr r or ^R or ^L 99145510Sdarrenr Repaint the screen. 100161357Sguido 101145510Sdarrenr R Repaint the screen, discarding any buffered input. Useful if 102145510Sdarrenr the file is changing while it is being viewed. 103145510Sdarrenr 104145510Sdarrenr F Scroll forward, and keep trying to read when the end of file is 105145510Sdarrenr reached. Normally this command would be used when already at 106145510Sdarrenr the end of the file. It is a way to monitor the tail of a file 107145510Sdarrenr which is growing while it is being viewed. (The behavior is 108145510Sdarrenr similar to the "tail -f" command.) 109161357Sguido 110145510Sdarrenr g or < or ESC-< 111145510Sdarrenr Go to line N in the file, default 1 (beginning of file). (Warn- 112145510Sdarrenr ing: this may be slow if N is large.) 113145510Sdarrenr 114145510Sdarrenr G or > or ESC-> 115145510Sdarrenr Go to line N in the file, default the end of the file. (Warn- 116145510Sdarrenr ing: this may be slow if N is large, or if N is not specified 117145510Sdarrenr and standard input, rather than a file, is being read.) 118145510Sdarrenr 119145510Sdarrenr p or % Go to a position N percent into the file. N should be between 0 120145510Sdarrenr and 100, and may contain a decimal point. 121145510Sdarrenr 122145510Sdarrenr P Go to the line containing byte offset N in the file. 123145510Sdarrenr 124145510Sdarrenr { If a left curly bracket appears in the top line displayed on the 125145510Sdarrenr screen, the { command will go to the matching right curly 126145510Sdarrenr bracket. The matching right curly bracket is positioned on the 127145510Sdarrenr bottom line of the screen. If there is more than one left curly 128145510Sdarrenr bracket on the top line, a number N may be used to specify the 129145510Sdarrenr N-th bracket on the line. 130145510Sdarrenr 131145510Sdarrenr } If a right curly bracket appears in the bottom line displayed on 132145510Sdarrenr the screen, the } command will go to the matching left curly 133145510Sdarrenr bracket. The matching left curly bracket is positioned on the 134145510Sdarrenr top line of the screen. If there is more than one right curly 135145510Sdarrenr bracket on the top line, a number N may be used to specify the 136145510Sdarrenr N-th bracket on the line. 137145510Sdarrenr 138145510Sdarrenr ( Like {, but applies to parentheses rather than curly brackets. 139145510Sdarrenr 140145510Sdarrenr ) Like }, but applies to parentheses rather than curly brackets. 141145510Sdarrenr 142145510Sdarrenr [ Like {, but applies to square brackets rather than curly brack- 143145510Sdarrenr ets. 144153881Sguido 145145510Sdarrenr ] Like }, but applies to square brackets rather than curly brack- 146145510Sdarrenr ets. 147145510Sdarrenr 148145510Sdarrenr ESC-^F Followed by two characters, acts like {, but uses the two char- 149145510Sdarrenr acters as open and close brackets, respectively. For example, 150145510Sdarrenr "ESC ^F < >" could be used to go forward to the > which matches 151145510Sdarrenr the < in the top displayed line. 152145510Sdarrenr 153145510Sdarrenr ESC-^B Followed by two characters, acts like }, but uses the two char- 154145510Sdarrenr acters as open and close brackets, respectively. For example, 155145510Sdarrenr "ESC ^B < >" could be used to go backward to the < which matches 156145510Sdarrenr the > in the bottom displayed line. 157145510Sdarrenr 158145510Sdarrenr m Followed by any lowercase letter, marks the current position 159145510Sdarrenr with that letter. 160145510Sdarrenr 161145510Sdarrenr ' (Single quote.) Followed by any lowercase letter, returns to 162145510Sdarrenr the position which was previously marked with that letter. Fol- 163145510Sdarrenr lowed by another single quote, returns to the position at which 164145510Sdarrenr the last "large" movement command was executed. Followed by a ^ 165145510Sdarrenr or $, jumps to the beginning or end of the file respectively. 166145510Sdarrenr Marks are preserved when a new file is examined, so the ' com- 167145510Sdarrenr mand can be used to switch between input files. 168145510Sdarrenr 169145510Sdarrenr ^X^X Same as single quote. 170145510Sdarrenr 171145510Sdarrenr /pattern 172145510Sdarrenr Search forward in the file for the N-th line containing the pat- 173145510Sdarrenr tern. N defaults to 1. The pattern is a regular expression, as 174145510Sdarrenr recognized by the regular expression library supplied by your 175145510Sdarrenr system. The search starts at the second line displayed (but see 176145510Sdarrenr the -a and -j options, which change this). 177145510Sdarrenr 178145510Sdarrenr Certain characters are special if entered at the beginning of 179145510Sdarrenr the pattern; they modify the type of search rather than become 180145510Sdarrenr part of the pattern: 181145510Sdarrenr 182145510Sdarrenr ^N or ! 183145510Sdarrenr Search for lines which do NOT match the pattern. 184145510Sdarrenr 185145510Sdarrenr ^E or * 186161357Sguido Search multiple files. That is, if the search reaches 187145510Sdarrenr the END of the current file without finding a match, the 188145510Sdarrenr search continues in the next file in the command line 189145510Sdarrenr list. 190145510Sdarrenr 191145510Sdarrenr ^F or @ 192145510Sdarrenr Begin the search at the first line of the FIRST file in 193145510Sdarrenr the command line list, regardless of what is currently 194145510Sdarrenr displayed on the screen or the settings of the -a or -j 195145510Sdarrenr options. 196145510Sdarrenr 197145510Sdarrenr ^K Highlight any text which matches the pattern on the cur- 198145510Sdarrenr rent screen, but don't move to the first match (KEEP cur- 199145510Sdarrenr rent position). 200145510Sdarrenr 201145510Sdarrenr ^R Don't interpret regular expression metacharacters; that 202145510Sdarrenr is, do a simple textual comparison. 203145510Sdarrenr 204145510Sdarrenr ?pattern 205145510Sdarrenr Search backward in the file for the N-th line containing the 206145510Sdarrenr pattern. The search starts at the line immediately before the 207145510Sdarrenr top line displayed. 208145510Sdarrenr 209145510Sdarrenr Certain characters are special as in the / command: 210145510Sdarrenr 211145510Sdarrenr ^N or ! 212145510Sdarrenr Search for lines which do NOT match the pattern. 213145510Sdarrenr 214145510Sdarrenr ^E or * 215145510Sdarrenr Search multiple files. That is, if the search reaches 216145510Sdarrenr the beginning of the current file without finding a 217145510Sdarrenr match, the search continues in the previous file in the 218145510Sdarrenr command line list. 219145510Sdarrenr 220145510Sdarrenr ^F or @ 221145510Sdarrenr Begin the search at the last line of the last file in the 222145510Sdarrenr command line list, regardless of what is currently dis- 223145510Sdarrenr played on the screen or the settings of the -a or -j 224145510Sdarrenr options. 225145510Sdarrenr 226145510Sdarrenr ^K As in forward searches. 227145510Sdarrenr 228145510Sdarrenr ^R As in forward searches. 229145510Sdarrenr 230145510Sdarrenr ESC-/pattern 231145510Sdarrenr Same as "/*". 232145510Sdarrenr 233145510Sdarrenr ESC-?pattern 234145510Sdarrenr Same as "?*". 235145510Sdarrenr 236145510Sdarrenr n Repeat previous search, for N-th line containing the last pat- 237145510Sdarrenr tern. If the previous search was modified by ^N, the search is 238145510Sdarrenr made for the N-th line NOT containing the pattern. If the pre- 239145510Sdarrenr vious search was modified by ^E, the search continues in the 240145510Sdarrenr next (or previous) file if not satisfied in the current file. 241145510Sdarrenr If the previous search was modified by ^R, the search is done 242145510Sdarrenr without using regular expressions. There is no effect if the 243145510Sdarrenr previous search was modified by ^F or ^K. 244145510Sdarrenr 245145510Sdarrenr N Repeat previous search, but in the reverse direction. 246145510Sdarrenr 247145510Sdarrenr ESC-n Repeat previous search, but crossing file boundaries. The 248145510Sdarrenr effect is as if the previous search were modified by *. 249145510Sdarrenr 250145510Sdarrenr ESC-N Repeat previous search, but in the reverse direction and cross- 251145510Sdarrenr ing file boundaries. 252145510Sdarrenr 253145510Sdarrenr ESC-u Undo search highlighting. Turn off highlighting of strings 254145510Sdarrenr matching the current search pattern. If highlighting is already 255145510Sdarrenr off because of a previous ESC-u command, turn highlighting back 256145510Sdarrenr on. Any search command will also turn highlighting back on. 257145510Sdarrenr (Highlighting can also be disabled by toggling the -G option; in 258145510Sdarrenr that case search commands do not turn highlighting back on.) 259145510Sdarrenr 260145510Sdarrenr &pattern 261145510Sdarrenr Display only lines which match the pattern; lines which do not 262145510Sdarrenr match the pattern are not displayed. If pattern is empty (if 263145510Sdarrenr you type & immediately followed by ENTER), any filtering is 264145510Sdarrenr turned off, and all lines are displayed. While filtering is in 265161357Sguido effect, an ampersand is displayed at the beginning of the 266145510Sdarrenr prompt, as a reminder that some lines in the file may be hidden. 267145510Sdarrenr 268145510Sdarrenr Certain characters are special as in the / command: 269145510Sdarrenr 270145510Sdarrenr ^N or ! 271145510Sdarrenr Display only lines which do NOT match the pattern. 272145510Sdarrenr 273145510Sdarrenr ^R Don't interpret regular expression metacharacters; that 274145510Sdarrenr is, do a simple textual comparison. 275145510Sdarrenr 276145510Sdarrenr :e [filename] 277145510Sdarrenr Examine a new file. If the filename is missing, the "current" 278145510Sdarrenr file (see the :n and :p commands below) from the list of files 279145510Sdarrenr in the command line is re-examined. A percent sign (%) in the 280145510Sdarrenr filename is replaced by the name of the current file. A pound 281145510Sdarrenr sign (#) is replaced by the name of the previously examined 282145510Sdarrenr file. However, two consecutive percent signs are simply 283145510Sdarrenr replaced with a single percent sign. This allows you to enter a 284145510Sdarrenr filename that contains a percent sign in the name. Similarly, 285145510Sdarrenr two consecutive pound signs are replaced with a single pound 286145510Sdarrenr sign. The filename is inserted into the command line list of 287145510Sdarrenr files so that it can be seen by subsequent :n and :p commands. 288145510Sdarrenr If the filename consists of several files, they are all inserted 289145510Sdarrenr into the list of files and the first one is examined. If the 290145510Sdarrenr filename contains one or more spaces, the entire filename should 291145510Sdarrenr be enclosed in double quotes (also see the -" option). 292145510Sdarrenr 293145510Sdarrenr ^X^V or E 294145510Sdarrenr Same as :e. Warning: some systems use ^V as a special literal- 295161357Sguido ization character. On such systems, you may not be able to use 296145510Sdarrenr ^V. 297145510Sdarrenr 298145510Sdarrenr :n Examine the next file (from the list of files given in the com- 299145510Sdarrenr mand line). If a number N is specified, the N-th next file is 300145510Sdarrenr examined. 301145510Sdarrenr 302145510Sdarrenr :p Examine the previous file in the command line list. If a number 303145510Sdarrenr N is specified, the N-th previous file is examined. 304145510Sdarrenr 305145510Sdarrenr :x Examine the first file in the command line list. If a number N 306145510Sdarrenr is specified, the N-th file in the list is examined. 307145510Sdarrenr 308145510Sdarrenr :d Remove the current file from the list of files. 309145510Sdarrenr 310145510Sdarrenr t Go to the next tag, if there were more than one matches for the 311145510Sdarrenr current tag. See the -t option for more details about tags. 312145510Sdarrenr 313145510Sdarrenr T Go to the previous tag, if there were more than one matches for 314145510Sdarrenr the current tag. 315145510Sdarrenr 316145510Sdarrenr = or ^G or :f 317145510Sdarrenr Prints some information about the file being viewed, including 318145510Sdarrenr its name and the line number and byte offset of the bottom line 319145510Sdarrenr being displayed. If possible, it also prints the length of the 320145510Sdarrenr file, the number of lines in the file and the percent of the 321145510Sdarrenr file above the last displayed line. 322145510Sdarrenr 323145510Sdarrenr - Followed by one of the command line option letters (see OPTIONS 324145510Sdarrenr below), this will change the setting of that option and print a 325145510Sdarrenr message describing the new setting. If a ^P (CONTROL-P) is 326145510Sdarrenr entered immediately after the dash, the setting of the option is 327145510Sdarrenr changed but no message is printed. If the option letter has a 328145510Sdarrenr numeric value (such as -b or -h), or a string value (such as -P 329145510Sdarrenr or -t), a new value may be entered after the option letter. If 330145510Sdarrenr no new value is entered, a message describing the current set- 331145510Sdarrenr ting is printed and nothing is changed. 332145510Sdarrenr 333145510Sdarrenr -- Like the - command, but takes a long option name (see OPTIONS 334145510Sdarrenr below) rather than a single option letter. You must press 335145510Sdarrenr RETURN after typing the option name. A ^P immediately after the 336145510Sdarrenr second dash suppresses printing of a message describing the new 337145510Sdarrenr setting, as in the - command. 338145510Sdarrenr 339145510Sdarrenr -+ Followed by one of the command line option letters this will 340145510Sdarrenr reset the option to its default setting and print a message 341145510Sdarrenr describing the new setting. (The "-+[4mX[24m" command does the same 342145510Sdarrenr thing as "-+[4mX[24m" on the command line.) This does not work for 343145510Sdarrenr string-valued options. 344145510Sdarrenr 345145510Sdarrenr --+ Like the -+ command, but takes a long option name rather than a 346145510Sdarrenr single option letter. 347145510Sdarrenr 348145510Sdarrenr -! Followed by one of the command line option letters, this will 349145510Sdarrenr reset the option to the "opposite" of its default setting and 350145510Sdarrenr print a message describing the new setting. This does not work 351145510Sdarrenr for numeric or string-valued options. 352145510Sdarrenr 353145510Sdarrenr --! Like the -! command, but takes a long option name rather than a 354145510Sdarrenr single option letter. 355145510Sdarrenr 356145510Sdarrenr _ (Underscore.) Followed by one of the command line option let- 357145510Sdarrenr ters, this will print a message describing the current setting 358145510Sdarrenr of that option. The setting of the option is not changed. 359145510Sdarrenr 360145510Sdarrenr __ (Double underscore.) Like the _ (underscore) command, but takes 361145510Sdarrenr a long option name rather than a single option letter. You must 362145510Sdarrenr press RETURN after typing the option name. 363145510Sdarrenr 364145510Sdarrenr +cmd Causes the specified cmd to be executed each time a new file is 365145510Sdarrenr examined. For example, +G causes [4mless[24m to initially display each 366145510Sdarrenr file starting at the end rather than the beginning. 367145510Sdarrenr 368145510Sdarrenr V Prints the version number of [4mless[24m being run. 369145510Sdarrenr 370145510Sdarrenr q or Q or :q or :Q or ZZ 371145510Sdarrenr Exits [4mless.[0m 372145510Sdarrenr 373145510Sdarrenr The following four commands may or may not be valid, depending on your 374145510Sdarrenr particular installation. 375145510Sdarrenr 376145510Sdarrenr 377145510Sdarrenr v Invokes an editor to edit the current file being viewed. The 378145510Sdarrenr editor is taken from the environment variable VISUAL if defined, 379145510Sdarrenr or EDITOR if VISUAL is not defined, or defaults to "vi" if nei- 380145510Sdarrenr ther VISUAL nor EDITOR is defined. See also the discussion of 381145510Sdarrenr LESSEDIT under the section on PROMPTS below. 382145510Sdarrenr 383145510Sdarrenr ! shell-command 384145510Sdarrenr Invokes a shell to run the shell-command given. A percent sign 385145510Sdarrenr (%) in the command is replaced by the name of the current file. 386145510Sdarrenr A pound sign (#) is replaced by the name of the previously exam- 387145510Sdarrenr ined file. "!!" repeats the last shell command. "!" with no 388145510Sdarrenr shell command simply invokes a shell. On Unix systems, the 389145510Sdarrenr shell is taken from the environment variable SHELL, or defaults 390145510Sdarrenr to "sh". On MS-DOS and OS/2 systems, the shell is the normal 391145510Sdarrenr command processor. 392145510Sdarrenr 393145510Sdarrenr | <m> shell-command 394145510Sdarrenr <m> represents any mark letter. Pipes a section of the input 395145510Sdarrenr file to the given shell command. The section of the file to be 396145510Sdarrenr piped is between the first line on the current screen and the 397145510Sdarrenr position marked by the letter. <m> may also be ^ or $ to indi- 398145510Sdarrenr cate beginning or end of file respectively. If <m> is . or new- 399145510Sdarrenr line, the current screen is piped. 400145510Sdarrenr 401145510Sdarrenr s filename 402145510Sdarrenr Save the input to a file. This only works if the input is a 403145510Sdarrenr pipe, not an ordinary file. 404145510Sdarrenr 405145510Sdarrenr 406145510Sdarrenr[1mOPTIONS[0m 407145510Sdarrenr Command line options are described below. Most options may be changed 408145510Sdarrenr while [4mless[24m is running, via the "-" command. 409145510Sdarrenr 410145510Sdarrenr Most options may be given in one of two forms: either a dash followed 411145510Sdarrenr by a single letter, or two dashes followed by a long option name. A 412145510Sdarrenr long option name may be abbreviated as long as the abbreviation is 413145510Sdarrenr unambiguous. For example, --quit-at-eof may be abbreviated --quit, but 414145510Sdarrenr not --qui, since both --quit-at-eof and --quiet begin with --qui. Some 415145510Sdarrenr long option names are in uppercase, such as --QUIT-AT-EOF, as distinct 416145510Sdarrenr from --quit-at-eof. Such option names need only have their first let- 417145510Sdarrenr ter capitalized; the remainder of the name may be in either case. For 418145510Sdarrenr example, --Quit-at-eof is equivalent to --QUIT-AT-EOF. 419145510Sdarrenr 420145510Sdarrenr Options are also taken from the environment variable "LESS". For exam- 421145510Sdarrenr ple, to avoid typing "less -options ..." each time [4mless[24m is invoked, you 422145510Sdarrenr might tell [4mcsh:[0m 423145510Sdarrenr 424145510Sdarrenr setenv LESS "-options" 425145510Sdarrenr 426145510Sdarrenr or if you use [4msh:[0m 427145510Sdarrenr 428145510Sdarrenr LESS="-options"; export LESS 429145510Sdarrenr 430145510Sdarrenr On MS-DOS, you don't need the quotes, but you should replace any per- 431145510Sdarrenr cent signs in the options string by double percent signs. 432145510Sdarrenr 433145510Sdarrenr The environment variable is parsed before the command line, so command 434145510Sdarrenr line options override the LESS environment variable. If an option 435145510Sdarrenr appears in the LESS variable, it can be reset to its default value on 436145510Sdarrenr the command line by beginning the command line option with "-+". 437145510Sdarrenr 438145510Sdarrenr For options like -P or -D which take a following string, a dollar sign 439145510Sdarrenr ($) must be used to signal the end of the string. For example, to set 440145510Sdarrenr two -D options on MS-DOS, you must have a dollar sign between them, 441145510Sdarrenr like this: 442145510Sdarrenr 443145510Sdarrenr LESS="-Dn9.1$-Ds4.1" 444145510Sdarrenr 445145510Sdarrenr 446145510Sdarrenr -? or --help 447145510Sdarrenr This option displays a summary of the commands accepted by [4mless[0m 448145510Sdarrenr (the same as the h command). (Depending on how your shell 449145510Sdarrenr interprets the question mark, it may be necessary to quote the 450145510Sdarrenr question mark, thus: "-\?".) 451145510Sdarrenr 452145510Sdarrenr -a or --search-skip-screen 453145510Sdarrenr Causes searches to start after the last line displayed on the 454145510Sdarrenr screen, thus skipping all lines displayed on the screen. By 455145510Sdarrenr default, searches start at the second line on the screen (or 456145510Sdarrenr after the last found line; see the -j option). 457145510Sdarrenr 458145510Sdarrenr -b[4mn[24m or --buffers=[4mn[0m 459145510Sdarrenr Specifies the amount of buffer space [4mless[24m will use for each 460145510Sdarrenr file, in units of kilobytes (1024 bytes). By default 64K of 461145510Sdarrenr buffer space is used for each file (unless the file is a pipe; 462145510Sdarrenr see the -B option). The -b option specifies instead that [4mn[0m 463145510Sdarrenr kilobytes of buffer space should be used for each file. If [4mn[24m is 464145510Sdarrenr -1, buffer space is unlimited; that is, the entire file can be 465145510Sdarrenr read into memory. 466145510Sdarrenr 467145510Sdarrenr -B or --auto-buffers 468145510Sdarrenr By default, when data is read from a pipe, buffers are allocated 469145510Sdarrenr automatically as needed. If a large amount of data is read from 470145510Sdarrenr the pipe, this can cause a large amount of memory to be allo- 471145510Sdarrenr cated. The -B option disables this automatic allocation of 472145510Sdarrenr buffers for pipes, so that only 64K (or the amount of space 473145510Sdarrenr specified by the -b option) is used for the pipe. Warning: use 474145510Sdarrenr of -B can result in erroneous display, since only the most 475145510Sdarrenr recently viewed part of the piped data is kept in memory; any 476161357Sguido earlier data is lost. 477145510Sdarrenr 478145510Sdarrenr -c or --clear-screen 479145510Sdarrenr Causes full screen repaints to be painted from the top line 480145510Sdarrenr down. By default, full screen repaints are done by scrolling 481161357Sguido from the bottom of the screen. 482161357Sguido 483161357Sguido -C or --CLEAR-SCREEN 484161357Sguido Same as -c, for compatibility with older versions of [4mless.[0m 485161357Sguido 486161357Sguido -d or --dumb 487161357Sguido The -d option suppresses the error message normally displayed if 488161357Sguido the terminal is dumb; that is, lacks some important capability, 489161357Sguido such as the ability to clear the screen or scroll backward. The 490161357Sguido -d option does not otherwise change the behavior of [4mless[24m on a 491161357Sguido dumb terminal. 492161357Sguido 493161357Sguido -D[1mx[4m[22mcolor[24m or --color=[1mx[4m[22mcolor[0m 494161357Sguido [MS-DOS only] Sets the color of the text displayed. [1mx [22mis a sin- 495161357Sguido gle character which selects the type of text whose color is 496161357Sguido being set: n=normal, s=standout, d=bold, u=underlined, k=blink. 497161357Sguido [4mcolor[24m is a pair of numbers separated by a period. The first 498161357Sguido number selects the foreground color and the second selects the 499145510Sdarrenr background color of the text. A single number [4mN[24m is the same as 500145510Sdarrenr [4mN.M[24m, where [4mM[24m is the normal background color. 501161357Sguido 502161357Sguido 503145510Sdarrenr -e or --quit-at-eof 504145510Sdarrenr Causes [4mless[24m to automatically exit the second time it reaches 505145510Sdarrenr end-of-file. By default, the only way to exit [4mless[24m is via the 506145510Sdarrenr "q" command. 507161357Sguido 508145510Sdarrenr -E or --QUIT-AT-EOF 509145510Sdarrenr Causes [4mless[24m to automatically exit the first time it reaches end- 510161357Sguido of-file. 511145510Sdarrenr 512145510Sdarrenr -f or --force 513145510Sdarrenr Forces non-regular files to be opened. (A non-regular file is a 514145510Sdarrenr directory or a device special file.) Also suppresses the warn- 515145510Sdarrenr ing message when a binary file is opened. By default, [4mless[24m will 516145510Sdarrenr refuse to open non-regular files. Note that some operating sys- 517145510Sdarrenr tems will not allow directories to be read, even if -f is set. 518145510Sdarrenr 519145510Sdarrenr -F or --quit-if-one-screen 520145510Sdarrenr Causes [4mless[24m to automatically exit if the entire file can be dis- 521145510Sdarrenr played on the first screen. 522145510Sdarrenr 523145510Sdarrenr -g or --hilite-search 524145510Sdarrenr Normally, [4mless[24m will highlight ALL strings which match the last 525145510Sdarrenr search command. The -g option changes this behavior to high- 526145510Sdarrenr light only the particular string which was found by the last 527145510Sdarrenr search command. This can cause [4mless[24m to run somewhat faster than 528145510Sdarrenr the default. 529145510Sdarrenr 530145510Sdarrenr -G or --HILITE-SEARCH 531145510Sdarrenr The -G option suppresses all highlighting of strings found by 532145510Sdarrenr search commands. 533145510Sdarrenr 534145510Sdarrenr -h[4mn[24m or --max-back-scroll=[4mn[0m 535145510Sdarrenr Specifies a maximum number of lines to scroll backward. If it 536145510Sdarrenr is necessary to scroll backward more than [4mn[24m lines, the screen is 537145510Sdarrenr repainted in a forward direction instead. (If the terminal does 538145510Sdarrenr not have the ability to scroll backward, -h0 is implied.) 539145510Sdarrenr 540145510Sdarrenr -i or --ignore-case 541145510Sdarrenr Causes searches to ignore case; that is, uppercase and lowercase 542145510Sdarrenr are considered identical. This option is ignored if any upper- 543145510Sdarrenr case letters appear in the search pattern; in other words, if a 544145510Sdarrenr pattern contains uppercase letters, then that search does not 545145510Sdarrenr ignore case. 546145510Sdarrenr 547145510Sdarrenr -I or --IGNORE-CASE 548145510Sdarrenr Like -i, but searches ignore case even if the pattern contains 549145510Sdarrenr uppercase letters. 550145510Sdarrenr 551145510Sdarrenr -j[4mn[24m or --jump-target=[4mn[0m 552145510Sdarrenr Specifies a line on the screen where the "target" line is to be 553145510Sdarrenr positioned. The target line is the line specified by any com- 554145510Sdarrenr mand to search for a pattern, jump to a line number, jump to a 555145510Sdarrenr file percentage or jump to a tag. The screen line may be speci- 556145510Sdarrenr fied by a number: the top line on the screen is 1, the next is 557145510Sdarrenr 2, and so on. The number may be negative to specify a line rel- 558145510Sdarrenr ative to the bottom of the screen: the bottom line on the screen 559145510Sdarrenr is -1, the second to the bottom is -2, and so on. Alternately, 560145510Sdarrenr the screen line may be specified as a fraction of the height of 561145510Sdarrenr the screen, starting with a decimal point: .5 is in the middle 562145510Sdarrenr of the screen, .3 is three tenths down from the first line, and 563145510Sdarrenr so on. If the line is specified as a fraction, the actual line 564145510Sdarrenr number is recalculated if the terminal window is resized, so 565145510Sdarrenr that the target line remains at the specified fraction of the 566145510Sdarrenr screen height. If any form of the -j option is used, forward 567145510Sdarrenr searches begin at the line immediately after the target line, 568145510Sdarrenr and backward searches begin at the target line. For example, if 569145510Sdarrenr "-j4" is used, the target line is the fourth line on the screen, 570145510Sdarrenr so forward searches begin at the fifth line on the screen. 571145510Sdarrenr 572145510Sdarrenr -J or --status-column 573145510Sdarrenr Displays a status column at the left edge of the screen. The 574145510Sdarrenr status column shows the lines that matched the current search. 575145510Sdarrenr The status column is also used if the -w or -W option is in 576145510Sdarrenr effect. 577145510Sdarrenr 578145510Sdarrenr -k[4mfilename[24m or --lesskey-file=[4mfilename[0m 579145510Sdarrenr Causes [4mless[24m to open and interpret the named file as a [4mlesskey[0m 580145510Sdarrenr (1) file. Multiple -k options may be specified. If the LESSKEY 581145510Sdarrenr or LESSKEY_SYSTEM environment variable is set, or if a lesskey 582145510Sdarrenr file is found in a standard place (see KEY BINDINGS), it is also 583145510Sdarrenr used as a [4mlesskey[24m file. 584145510Sdarrenr 585145510Sdarrenr -K or --quit-on-intr 586145510Sdarrenr Causes [4mless[24m to exit immediately when an interrupt character 587145510Sdarrenr (usually ^C) is typed. Normally, an interrupt character causes 588145510Sdarrenr [4mless[24m to stop whatever it is doing and return to its command 589145510Sdarrenr prompt. Note that use of this option makes it impossible to 590145510Sdarrenr return to the command prompt from the "F" command. 591145510Sdarrenr 592145510Sdarrenr -L or --no-lessopen 593145510Sdarrenr Ignore the LESSOPEN environment variable (see the INPUT PRE- 594145510Sdarrenr PROCESSOR section below). This option can be set from within 595145510Sdarrenr [4mless[24m, but it will apply only to files opened subsequently, not 596145510Sdarrenr to the file which is currently open. 597145510Sdarrenr 598145510Sdarrenr -m or --long-prompt 599145510Sdarrenr Causes [4mless[24m to prompt verbosely (like [4mmore[24m), with the percent 600145510Sdarrenr into the file. By default, [4mless[24m prompts with a colon. 601145510Sdarrenr 602145510Sdarrenr -M or --LONG-PROMPT 603145510Sdarrenr Causes [4mless[24m to prompt even more verbosely than [4mmore.[0m 604145510Sdarrenr 605145510Sdarrenr -n or --line-numbers 606145510Sdarrenr Suppresses line numbers. The default (to use line numbers) may 607145510Sdarrenr cause [4mless[24m to run more slowly in some cases, especially with a 608145510Sdarrenr very large input file. Suppressing line numbers with the -n 609145510Sdarrenr option will avoid this problem. Using line numbers means: the 610145510Sdarrenr line number will be displayed in the verbose prompt and in the = 611145510Sdarrenr command, and the v command will pass the current line number to 612145510Sdarrenr the editor (see also the discussion of LESSEDIT in PROMPTS 613145510Sdarrenr below). 614145510Sdarrenr 615145510Sdarrenr -N or --LINE-NUMBERS 616145510Sdarrenr Causes a line number to be displayed at the beginning of each 617145510Sdarrenr line in the display. 618145510Sdarrenr 619145510Sdarrenr -o[4mfilename[24m or --log-file=[4mfilename[0m 620145510Sdarrenr Causes [4mless[24m to copy its input to the named file as it is being 621145510Sdarrenr viewed. This applies only when the input file is a pipe, not an 622145510Sdarrenr ordinary file. If the file already exists, [4mless[24m will ask for 623145510Sdarrenr confirmation before overwriting it. 624145510Sdarrenr 625145510Sdarrenr -O[4mfilename[24m or --LOG-FILE=[4mfilename[0m 626145510Sdarrenr The -O option is like -o, but it will overwrite an existing file 627145510Sdarrenr without asking for confirmation. 628145510Sdarrenr 629145510Sdarrenr If no log file has been specified, the -o and -O options can be 630145510Sdarrenr used from within [4mless[24m to specify a log file. Without a file 631145510Sdarrenr name, they will simply report the name of the log file. The "s" 632145510Sdarrenr command is equivalent to specifying -o from within [4mless.[0m 633145510Sdarrenr 634145510Sdarrenr -p[4mpattern[24m or --pattern=[4mpattern[0m 635145510Sdarrenr The -p option on the command line is equivalent to specifying 636145510Sdarrenr +/[4mpattern[24m; that is, it tells [4mless[24m to start at the first occur- 637145510Sdarrenr rence of [4mpattern[24m in the file. 638145510Sdarrenr 639145510Sdarrenr -P[4mprompt[24m or --prompt=[4mprompt[0m 640145510Sdarrenr Provides a way to tailor the three prompt styles to your own 641145510Sdarrenr preference. This option would normally be put in the LESS envi- 642145510Sdarrenr ronment variable, rather than being typed in with each [4mless[24m com- 643145510Sdarrenr mand. Such an option must either be the last option in the LESS 644145510Sdarrenr variable, or be terminated by a dollar sign. -Ps followed by a 645145510Sdarrenr string changes the default (short) prompt to that string. -Pm 646145510Sdarrenr changes the medium (-m) prompt. -PM changes the long (-M) 647145510Sdarrenr prompt. -Ph changes the prompt for the help screen. -P= 648145510Sdarrenr changes the message printed by the = command. -Pw changes the 649145510Sdarrenr message printed while waiting for data (in the F command). All 650145510Sdarrenr prompt strings consist of a sequence of letters and special 651145510Sdarrenr escape sequences. See the section on PROMPTS for more details. 652145510Sdarrenr 653145510Sdarrenr -q or --quiet or --silent 654145510Sdarrenr Causes moderately "quiet" operation: the terminal bell is not 655145510Sdarrenr rung if an attempt is made to scroll past the end of the file or 656145510Sdarrenr before the beginning of the file. If the terminal has a "visual 657145510Sdarrenr bell", it is used instead. The bell will be rung on certain 658145510Sdarrenr other errors, such as typing an invalid character. The default 659145510Sdarrenr is to ring the terminal bell in all such cases. 660145510Sdarrenr 661145510Sdarrenr -Q or --QUIET or --SILENT 662145510Sdarrenr Causes totally "quiet" operation: the terminal bell is never 663145510Sdarrenr rung. 664145510Sdarrenr 665145510Sdarrenr -r or --raw-control-chars 666145510Sdarrenr Causes "raw" control characters to be displayed. The default is 667145510Sdarrenr to display control characters using the caret notation; for 668145510Sdarrenr example, a control-A (octal 001) is displayed as "^A". Warning: 669145510Sdarrenr when the -r option is used, [4mless[24m cannot keep track of the actual 670145510Sdarrenr appearance of the screen (since this depends on how the screen 671145510Sdarrenr responds to each type of control character). Thus, various dis- 672145510Sdarrenr play problems may result, such as long lines being split in the 673145510Sdarrenr wrong place. 674145510Sdarrenr 675145510Sdarrenr -R or --RAW-CONTROL-CHARS 676145510Sdarrenr Like -r, but only ANSI "color" escape sequences are output in 677145510Sdarrenr "raw" form. Unlike -r, the screen appearance is maintained cor- 678145510Sdarrenr rectly in most cases. ANSI "color" escape sequences are 679145510Sdarrenr sequences of the form: 680145510Sdarrenr 681145510Sdarrenr ESC [ ... m 682145510Sdarrenr 683145510Sdarrenr where the "..." is zero or more color specification characters 684145510Sdarrenr For the purpose of keeping track of screen appearance, ANSI 685145510Sdarrenr color escape sequences are assumed to not move the cursor. You 686145510Sdarrenr can make [4mless[24m think that characters other than "m" can end ANSI 687145510Sdarrenr color escape sequences by setting the environment variable 688145510Sdarrenr LESSANSIENDCHARS to the list of characters which can end a color 689145510Sdarrenr escape sequence. And you can make [4mless[24m think that characters 690145510Sdarrenr other than the standard ones may appear between the ESC and the 691145510Sdarrenr m by setting the environment variable LESSANSIMIDCHARS to the 692145510Sdarrenr list of characters which can appear. 693145510Sdarrenr 694145510Sdarrenr -s or --squeeze-blank-lines 695145510Sdarrenr Causes consecutive blank lines to be squeezed into a single 696145510Sdarrenr blank line. This is useful when viewing [4mnroff[24m output. 697145510Sdarrenr 698145510Sdarrenr -S or --chop-long-lines 699145510Sdarrenr Causes lines longer than the screen width to be chopped rather 700145510Sdarrenr than folded. That is, the portion of a long line that does not 701145510Sdarrenr fit in the screen width is not shown. The default is to fold 702145510Sdarrenr long lines; that is, display the remainder on the next line. 703145510Sdarrenr 704145510Sdarrenr -t[4mtag[24m or --tag=[4mtag[0m 705145510Sdarrenr The -t option, followed immediately by a TAG, will edit the file 706145510Sdarrenr containing that tag. For this to work, tag information must be 707145510Sdarrenr available; for example, there may be a file in the current 708145510Sdarrenr directory called "tags", which was previously built by [4mctags[24m (1) 709145510Sdarrenr or an equivalent command. If the environment variable LESSGLOB- 710145510Sdarrenr ALTAGS is set, it is taken to be the name of a command compati- 711145510Sdarrenr ble with [4mglobal[24m (1), and that command is executed to find the 712145510Sdarrenr tag. (See http://www.gnu.org/software/global/global.html). The 713145510Sdarrenr -t option may also be specified from within [4mless[24m (using the - 714145510Sdarrenr command) as a way of examining a new file. The command ":t" is 715145510Sdarrenr equivalent to specifying -t from within [4mless.[0m 716145510Sdarrenr 717145510Sdarrenr -T[4mtagsfile[24m or --tag-file=[4mtagsfile[0m 718145510Sdarrenr Specifies a tags file to be used instead of "tags". 719145510Sdarrenr 720145510Sdarrenr -u or --underline-special 721145510Sdarrenr Causes backspaces and carriage returns to be treated as print- 722145510Sdarrenr able characters; that is, they are sent to the terminal when 723145510Sdarrenr they appear in the input. 724145510Sdarrenr 725145510Sdarrenr -U or --UNDERLINE-SPECIAL 726145510Sdarrenr Causes backspaces, tabs and carriage returns to be treated as 727145510Sdarrenr control characters; that is, they are handled as specified by 728145510Sdarrenr the -r option. 729145510Sdarrenr 730145510Sdarrenr By default, if neither -u nor -U is given, backspaces which 731145510Sdarrenr appear adjacent to an underscore character are treated spe- 732145510Sdarrenr cially: the underlined text is displayed using the terminal's 733145510Sdarrenr hardware underlining capability. Also, backspaces which appear 734145510Sdarrenr between two identical characters are treated specially: the 735145510Sdarrenr overstruck text is printed using the terminal's hardware bold- 736145510Sdarrenr face capability. Other backspaces are deleted, along with the 737145510Sdarrenr preceding character. Carriage returns immediately followed by a 738145510Sdarrenr newline are deleted. other carriage returns are handled as 739145510Sdarrenr specified by the -r option. Text which is overstruck or under- 740145510Sdarrenr lined can be searched for if neither -u nor -U is in effect. 741145510Sdarrenr 742145510Sdarrenr -V or --version 743145510Sdarrenr Displays the version number of [4mless.[0m 744145510Sdarrenr 745145510Sdarrenr -w or --hilite-unread 746145510Sdarrenr Temporarily highlights the first "new" line after a forward 747145510Sdarrenr movement of a full page. The first "new" line is the line imme- 748145510Sdarrenr diately following the line previously at the bottom of the 749145510Sdarrenr screen. Also highlights the target line after a g or p command. 750145510Sdarrenr The highlight is removed at the next command which causes move- 751145510Sdarrenr ment. The entire line is highlighted, unless the -J option is 752145510Sdarrenr in effect, in which case only the status column is highlighted. 753145510Sdarrenr 754145510Sdarrenr -W or --HILITE-UNREAD 755145510Sdarrenr Like -w, but temporarily highlights the first new line after any 756145510Sdarrenr forward movement command larger than one line. 757145510Sdarrenr 758145510Sdarrenr -x[4mn[24m,... or --tabs=[4mn[24m,... 759145510Sdarrenr Sets tab stops. If only one [4mn[24m is specified, tab stops are set 760145510Sdarrenr at multiples of [4mn[24m. If multiple values separated by commas are 761145510Sdarrenr specified, tab stops are set at those positions, and then con- 762145510Sdarrenr tinue with the same spacing as the last two. For example, 763145510Sdarrenr [4m-x9,17[24m will set tabs at positions 9, 17, 25, 33, etc. The 764145510Sdarrenr default for [4mn[24m is 8. 765145510Sdarrenr 766145510Sdarrenr -X or --no-init 767145510Sdarrenr Disables sending the termcap initialization and deinitialization 768145510Sdarrenr strings to the terminal. This is sometimes desirable if the 769145510Sdarrenr deinitialization string does something unnecessary, like clear- 770145510Sdarrenr ing the screen. 771145510Sdarrenr 772145510Sdarrenr -y[4mn[24m or --max-forw-scroll=[4mn[0m 773145510Sdarrenr Specifies a maximum number of lines to scroll forward. If it is 774145510Sdarrenr necessary to scroll forward more than [4mn[24m lines, the screen is 775145510Sdarrenr repainted instead. The -c or -C option may be used to repaint 776145510Sdarrenr from the top of the screen if desired. By default, any forward 777145510Sdarrenr movement causes scrolling. 778145510Sdarrenr 779145510Sdarrenr -[z][4mn[24m or --window=[4mn[0m 780145510Sdarrenr Changes the default scrolling window size to [4mn[24m lines. The 781145510Sdarrenr default is one screenful. The z and w commands can also be used 782145510Sdarrenr to change the window size. The "z" may be omitted for compati- 783145510Sdarrenr bility with some versions of [4mmore.[24m If the number [4mn[24m is negative, 784145510Sdarrenr it indicates [4mn[24m lines less than the current screen size. For 785145510Sdarrenr example, if the screen is 24 lines, [4m-z-4[24m sets the scrolling win- 786145510Sdarrenr dow to 20 lines. If the screen is resized to 40 lines, the 787145510Sdarrenr scrolling window automatically changes to 36 lines. 788145510Sdarrenr 789145510Sdarrenr -[4m"cc[24m or --quotes=[4mcc[0m 790145510Sdarrenr Changes the filename quoting character. This may be necessary 791145510Sdarrenr if you are trying to name a file which contains both spaces and 792145510Sdarrenr quote characters. Followed by a single character, this changes 793145510Sdarrenr the quote character to that character. Filenames containing a 794145510Sdarrenr space should then be surrounded by that character rather than by 795145510Sdarrenr double quotes. Followed by two characters, changes the open 796145510Sdarrenr quote to the first character, and the close quote to the second 797145510Sdarrenr character. Filenames containing a space should then be preceded 798145510Sdarrenr by the open quote character and followed by the close quote 799145510Sdarrenr character. Note that even after the quote characters are 800145510Sdarrenr changed, this option remains -" (a dash followed by a double 801145510Sdarrenr quote). 802145510Sdarrenr 803145510Sdarrenr -~ or --tilde 804145510Sdarrenr Normally lines after end of file are displayed as a single tilde 805145510Sdarrenr (~). This option causes lines after end of file to be displayed 806145510Sdarrenr as blank lines. 807145510Sdarrenr 808145510Sdarrenr -# or --shift 809145510Sdarrenr Specifies the default number of positions to scroll horizontally 810145510Sdarrenr in the RIGHTARROW and LEFTARROW commands. If the number speci- 811145510Sdarrenr fied is zero, it sets the default number of positions to one 812145510Sdarrenr half of the screen width. 813145510Sdarrenr 814145510Sdarrenr --no-keypad 815145510Sdarrenr Disables sending the keypad initialization and deinitialization 816145510Sdarrenr strings to the terminal. This is sometimes useful if the keypad 817145510Sdarrenr strings make the numeric keypad behave in an undesirable manner. 818145510Sdarrenr 819145510Sdarrenr --follow-name 820145510Sdarrenr Normally, if the input file is renamed while an F command is 821145510Sdarrenr executing, [4mless[24m will continue to display the contents of the 822145510Sdarrenr original file despite its name change. If --follow-name is 823145510Sdarrenr specified, during an F command [4mless[24m will periodically attempt to 824145510Sdarrenr reopen the file by name. If the reopen succeeds and the file is 825145510Sdarrenr a different file from the original (which means that a new file 826145510Sdarrenr has been created with the same name as the original (now 827145510Sdarrenr renamed) file), [4mless[24m will display the contents of that new file. 828145510Sdarrenr 829145510Sdarrenr -- A command line argument of "--" marks the end of option argu- 830145510Sdarrenr ments. Any arguments following this are interpreted as file- 831145510Sdarrenr names. This can be useful when viewing a file whose name begins 832145510Sdarrenr with a "-" or "+". 833145510Sdarrenr 834145510Sdarrenr + If a command line option begins with [1m+[22m, the remainder of that 835145510Sdarrenr option is taken to be an initial command to [4mless.[24m For example, 836145510Sdarrenr +G tells [4mless[24m to start at the end of the file rather than the 837145510Sdarrenr beginning, and +/xyz tells it to start at the first occurrence 838145510Sdarrenr of "xyz" in the file. As a special case, +<number> acts like 839145510Sdarrenr +<number>g; that is, it starts the display at the specified line 840145510Sdarrenr number (however, see the caveat under the "g" command above). 841145510Sdarrenr If the option starts with ++, the initial command applies to 842145510Sdarrenr every file being viewed, not just the first one. The + command 843145510Sdarrenr described previously may also be used to set (or change) an ini- 844145510Sdarrenr tial command for every file. 845145510Sdarrenr 846145510Sdarrenr 847145510Sdarrenr[1mLINE EDITING[0m 848145510Sdarrenr When entering command line at the bottom of the screen (for example, a 849145510Sdarrenr filename for the :e command, or the pattern for a search command), cer- 850145510Sdarrenr tain keys can be used to manipulate the command line. Most commands 851145510Sdarrenr have an alternate form in [ brackets ] which can be used if a key does 852145510Sdarrenr not exist on a particular keyboard. (Note that the forms beginning 853145510Sdarrenr with ESC do not work in some MS-DOS and Windows systems because ESC is 854145510Sdarrenr the line erase character.) Any of these special keys may be entered 855145510Sdarrenr literally by preceding it with the "literal" character, either ^V or 856145510Sdarrenr ^A. A backslash itself may also be entered literally by entering two 857145510Sdarrenr backslashes. 858145510Sdarrenr 859145510Sdarrenr LEFTARROW [ ESC-h ] 860145510Sdarrenr Move the cursor one space to the left. 861145510Sdarrenr 862145510Sdarrenr RIGHTARROW [ ESC-l ] 863145510Sdarrenr Move the cursor one space to the right. 864145510Sdarrenr 865145510Sdarrenr ^LEFTARROW [ ESC-b or ESC-LEFTARROW ] 866145510Sdarrenr (That is, CONTROL and LEFTARROW simultaneously.) Move the cur- 867145510Sdarrenr sor one word to the left. 868145510Sdarrenr 869145510Sdarrenr ^RIGHTARROW [ ESC-w or ESC-RIGHTARROW ] 870145510Sdarrenr (That is, CONTROL and RIGHTARROW simultaneously.) Move the cur- 871145510Sdarrenr sor one word to the right. 872145510Sdarrenr 873145510Sdarrenr HOME [ ESC-0 ] 874145510Sdarrenr Move the cursor to the beginning of the line. 875145510Sdarrenr 876145510Sdarrenr END [ ESC-$ ] 877145510Sdarrenr Move the cursor to the end of the line. 878145510Sdarrenr 879145510Sdarrenr BACKSPACE 880145510Sdarrenr Delete the character to the left of the cursor, or cancel the 881145510Sdarrenr command if the command line is empty. 882145510Sdarrenr 883145510Sdarrenr DELETE or [ ESC-x ] 884145510Sdarrenr Delete the character under the cursor. 885145510Sdarrenr 886145510Sdarrenr ^BACKSPACE [ ESC-BACKSPACE ] 887145510Sdarrenr (That is, CONTROL and BACKSPACE simultaneously.) Delete the 888145510Sdarrenr word to the left of the cursor. 889145510Sdarrenr 890145510Sdarrenr ^DELETE [ ESC-X or ESC-DELETE ] 891145510Sdarrenr (That is, CONTROL and DELETE simultaneously.) Delete the word 892145510Sdarrenr under the cursor. 893145510Sdarrenr 894145510Sdarrenr UPARROW [ ESC-k ] 895145510Sdarrenr Retrieve the previous command line. 896145510Sdarrenr 897145510Sdarrenr DOWNARROW [ ESC-j ] 898145510Sdarrenr Retrieve the next command line. 899145510Sdarrenr 900145510Sdarrenr TAB Complete the partial filename to the left of the cursor. If it 901145510Sdarrenr matches more than one filename, the first match is entered into 902145510Sdarrenr the command line. Repeated TABs will cycle thru the other 903145510Sdarrenr matching filenames. If the completed filename is a directory, a 904145510Sdarrenr "/" is appended to the filename. (On MS-DOS systems, a "\" is 905145510Sdarrenr appended.) The environment variable LESSSEPARATOR can be used 906145510Sdarrenr to specify a different character to append to a directory name. 907145510Sdarrenr 908145510Sdarrenr BACKTAB [ ESC-TAB ] 909145510Sdarrenr Like, TAB, but cycles in the reverse direction thru the matching 910145510Sdarrenr filenames. 911145510Sdarrenr 912145510Sdarrenr ^L Complete the partial filename to the left of the cursor. If it 913145510Sdarrenr matches more than one filename, all matches are entered into the 914145510Sdarrenr command line (if they fit). 915145510Sdarrenr 916145510Sdarrenr ^U (Unix and OS/2) or ESC (MS-DOS) 917145510Sdarrenr Delete the entire command line, or cancel the command if the 918145510Sdarrenr command line is empty. If you have changed your line-kill char- 919145510Sdarrenr acter in Unix to something other than ^U, that character is used 920145510Sdarrenr instead of ^U. 921145510Sdarrenr 922145510Sdarrenr 923145510Sdarrenr[1mKEY BINDINGS[0m 924145510Sdarrenr You may define your own [4mless[24m commands by using the program [4mlesskey[24m (1) 925145510Sdarrenr to create a lesskey file. This file specifies a set of command keys 926145510Sdarrenr and an action associated with each key. You may also use [4mlesskey[24m to 927145510Sdarrenr change the line-editing keys (see LINE EDITING), and to set environment 928145510Sdarrenr variables. If the environment variable LESSKEY is set, [4mless[24m uses that 929145510Sdarrenr as the name of the lesskey file. Otherwise, [4mless[24m looks in a standard 930145510Sdarrenr place for the lesskey file: On Unix systems, [4mless[24m looks for a lesskey 931145510Sdarrenr file called "$HOME/.less". On MS-DOS and Windows systems, [4mless[24m looks 932145510Sdarrenr for a lesskey file called "$HOME/_less", and if it is not found there, 933145510Sdarrenr then looks for a lesskey file called "_less" in any directory specified 934145510Sdarrenr in the PATH environment variable. On OS/2 systems, [4mless[24m looks for a 935145510Sdarrenr lesskey file called "$HOME/less.ini", and if it is not found, then 936145510Sdarrenr looks for a lesskey file called "less.ini" in any directory specified 937145510Sdarrenr in the INIT environment variable, and if it not found there, then looks 938145510Sdarrenr for a lesskey file called "less.ini" in any directory specified in the 939145510Sdarrenr PATH environment variable. See the [4mlesskey[24m manual page for more 940145510Sdarrenr details. 941145510Sdarrenr 942145510Sdarrenr A system-wide lesskey file may also be set up to provide key bindings. 943145510Sdarrenr If a key is defined in both a local lesskey file and in the system-wide 944145510Sdarrenr file, key bindings in the local file take precedence over those in the 945145510Sdarrenr system-wide file. If the environment variable LESSKEY_SYSTEM is set, 946145510Sdarrenr [4mless[24m uses that as the name of the system-wide lesskey file. Otherwise, 947145510Sdarrenr [4mless[24m looks in a standard place for the system-wide lesskey file: On 948145510Sdarrenr Unix systems, the system-wide lesskey file is /usr/local/etc/sysless. 949145510Sdarrenr (However, if [4mless[24m was built with a different sysconf directory than 950145510Sdarrenr /usr/local/etc, that directory is where the sysless file is found.) On 951145510Sdarrenr MS-DOS and Windows systems, the system-wide lesskey file is c:\_sys- 952145510Sdarrenr less. On OS/2 systems, the system-wide lesskey file is c:\sysless.ini. 953145510Sdarrenr 954145510Sdarrenr 955145510Sdarrenr[1mINPUT PREPROCESSOR[0m 956145510Sdarrenr You may define an "input preprocessor" for [4mless.[24m Before [4mless[24m opens a 957145510Sdarrenr file, it first gives your input preprocessor a chance to modify the way 958145510Sdarrenr the contents of the file are displayed. An input preprocessor is sim- 959145510Sdarrenr ply an executable program (or shell script), which writes the contents 960145510Sdarrenr of the file to a different file, called the replacement file. The con- 961145510Sdarrenr tents of the replacement file are then displayed in place of the con- 962145510Sdarrenr tents of the original file. However, it will appear to the user as if 963145510Sdarrenr the original file is opened; that is, [4mless[24m will display the original 964145510Sdarrenr filename as the name of the current file. 965145510Sdarrenr 966145510Sdarrenr An input preprocessor receives one command line argument, the original 967145510Sdarrenr filename, as entered by the user. It should create the replacement 968145510Sdarrenr file, and when finished, print the name of the replacement file to its 969145510Sdarrenr standard output. If the input preprocessor does not output a replace- 970145510Sdarrenr ment filename, [4mless[24m uses the original file, as normal. The input pre- 971145510Sdarrenr processor is not called when viewing standard input. To set up an 972145510Sdarrenr input preprocessor, set the LESSOPEN environment variable to a command 973145510Sdarrenr line which will invoke your input preprocessor. This command line 974145510Sdarrenr should include one occurrence of the string "%s", which will be 975145510Sdarrenr replaced by the filename when the input preprocessor command is 976145510Sdarrenr invoked. 977145510Sdarrenr 978145510Sdarrenr When [4mless[24m closes a file opened in such a way, it will call another pro- 979145510Sdarrenr gram, called the input postprocessor, which may perform any desired 980145510Sdarrenr clean-up action (such as deleting the replacement file created by 981145510Sdarrenr LESSOPEN). This program receives two command line arguments, the orig- 982145510Sdarrenr inal filename as entered by the user, and the name of the replacement 983145510Sdarrenr file. To set up an input postprocessor, set the LESSCLOSE environment 984145510Sdarrenr variable to a command line which will invoke your input postprocessor. 985145510Sdarrenr It may include two occurrences of the string "%s"; the first is 986145510Sdarrenr replaced with the original name of the file and the second with the 987145510Sdarrenr name of the replacement file, which was output by LESSOPEN. 988145510Sdarrenr 989145510Sdarrenr For example, on many Unix systems, these two scripts will allow you to 990145510Sdarrenr keep files in compressed format, but still let [4mless[24m view them directly: 991145510Sdarrenr 992145510Sdarrenr lessopen.sh: 993145510Sdarrenr #! /bin/sh 994145510Sdarrenr case "$1" in 995145510Sdarrenr *.Z) uncompress - 996145510Sdarrenr if [ -s /tmp/less.$$ ]; then 997145510Sdarrenr echo /tmp/less.$$ 998145510Sdarrenr else 999145510Sdarrenr rm -f /tmp/less.$$ 1000145510Sdarrenr fi 1001145510Sdarrenr ;; 1002145510Sdarrenr esac 1003145510Sdarrenr 1004145510Sdarrenr lessclose.sh: 1005145510Sdarrenr #! /bin/sh 1006145510Sdarrenr rm $2 1007145510Sdarrenr 1008145510Sdarrenr To use these scripts, put them both where they can be executed and set 1009145510Sdarrenr LESSOPEN="lessopen.sh %s", and LESSCLOSE="lessclose.sh %s %s". More 1010145510Sdarrenr complex LESSOPEN and LESSCLOSE scripts may be written to accept other 1011145510Sdarrenr types of compressed files, and so on. 1012145510Sdarrenr 1013145510Sdarrenr It is also possible to set up an input preprocessor to pipe the file 1014145510Sdarrenr data directly to [4mless,[24m rather than putting the data into a replacement 1015145510Sdarrenr file. This avoids the need to decompress the entire file before start- 1016145510Sdarrenr ing to view it. An input preprocessor that works this way is called an 1017145510Sdarrenr input pipe. An input pipe, instead of writing the name of a replace- 1018145510Sdarrenr ment file on its standard output, writes the entire contents of the 1019145510Sdarrenr replacement file on its standard output. If the input pipe does not 1020145510Sdarrenr write any characters on its standard output, then there is no replace- 1021145510Sdarrenr ment file and [4mless[24m uses the original file, as normal. To use an input 1022145510Sdarrenr pipe, make the first character in the LESSOPEN environment variable a 1023145510Sdarrenr vertical bar (|) to signify that the input preprocessor is an input 1024145510Sdarrenr pipe. 1025145510Sdarrenr 1026145510Sdarrenr For example, on many Unix systems, this script will work like the pre- 1027145510Sdarrenr vious example scripts: 1028145510Sdarrenr 1029145510Sdarrenr lesspipe.sh: 1030145510Sdarrenr #! /bin/sh 1031145510Sdarrenr case "$1" in 1032145510Sdarrenr *.Z) uncompress -c $1 2>/dev/null 1033145510Sdarrenr ;; 1034145510Sdarrenr esac 1035145510Sdarrenr 1036145510Sdarrenr To use this script, put it where it can be executed and set 1037145510Sdarrenr LESSOPEN="|lesspipe.sh %s". When an input pipe is used, a LESSCLOSE 1038145510Sdarrenr postprocessor can be used, but it is usually not necessary since there 1039145510Sdarrenr is no replacement file to clean up. In this case, the replacement file 1040145510Sdarrenr name passed to the LESSCLOSE postprocessor is "-". 1041145510Sdarrenr 1042145510Sdarrenr For compatibility with previous versions of [4mless,[24m the input pipe is not 1043145510Sdarrenr used if [4mless[24m is viewing standard input. However, if the character 1044145510Sdarrenr after the vertical bar is a dash (-), the input pipe is used on stan- 1045145510Sdarrenr dard input as well as other files. 1046145510Sdarrenr 1047145510Sdarrenr 1048145510Sdarrenr[1mNATIONAL CHARACTER SETS[0m 1049145510Sdarrenr There are three types of characters in the input file: 1050145510Sdarrenr 1051145510Sdarrenr normal characters 1052145510Sdarrenr can be displayed directly to the screen. 1053145510Sdarrenr 1054145510Sdarrenr control characters 1055145510Sdarrenr should not be displayed directly, but are expected to be found 1056145510Sdarrenr in ordinary text files (such as backspace and tab). 1057145510Sdarrenr 1058145510Sdarrenr binary characters 1059161357Sguido should not be displayed directly and are not expected to be 1060161357Sguido found in text files. 1061145510Sdarrenr 1062145510Sdarrenr A "character set" is simply a description of which characters are to be 1063145510Sdarrenr considered normal, control, and binary. The LESSCHARSET environment 1064145510Sdarrenr variable may be used to select a character set. Possible values for 1065145510Sdarrenr LESSCHARSET are: 1066145510Sdarrenr 1067145510Sdarrenr ascii BS, TAB, NL, CR, and formfeed are control characters, all chars 1068145510Sdarrenr with values between 32 and 126 are normal, and all others are 1069145510Sdarrenr binary. 1070145510Sdarrenr 1071145510Sdarrenr iso8859 1072145510Sdarrenr Selects an ISO 8859 character set. This is the same as ASCII, 1073145510Sdarrenr except characters between 160 and 255 are treated as normal 1074145510Sdarrenr characters. 1075145510Sdarrenr 1076145510Sdarrenr latin1 Same as iso8859. 1077145510Sdarrenr 1078145510Sdarrenr latin9 Same as iso8859. 1079145510Sdarrenr 1080145510Sdarrenr dos Selects a character set appropriate for MS-DOS. 1081145510Sdarrenr 1082145510Sdarrenr ebcdic Selects an EBCDIC character set. 1083145510Sdarrenr 1084145510Sdarrenr IBM-1047 1085145510Sdarrenr Selects an EBCDIC character set used by OS/390 Unix Services. 1086145510Sdarrenr This is the EBCDIC analogue of latin1. You get similar results 1087145510Sdarrenr by setting either LESSCHARSET=IBM-1047 or LC_CTYPE=en_US in your 1088145510Sdarrenr environment. 1089145510Sdarrenr 1090145510Sdarrenr koi8-r Selects a Russian character set. 1091145510Sdarrenr 1092145510Sdarrenr next Selects a character set appropriate for NeXT computers. 1093145510Sdarrenr 1094145510Sdarrenr utf-8 Selects the UTF-8 encoding of the ISO 10646 character set. 1095145510Sdarrenr UTF-8 is special in that it supports multi-byte characters in 1096145510Sdarrenr the input file. It is the only character set that supports 1097145510Sdarrenr multi-byte characters. 1098145510Sdarrenr 1099145510Sdarrenr windows 1100145510Sdarrenr Selects a character set appropriate for Microsoft Windows (cp 1101145510Sdarrenr 1251). 1102145510Sdarrenr 1103145510Sdarrenr In rare cases, it may be desired to tailor [4mless[24m to use a character set 1104145510Sdarrenr other than the ones definable by LESSCHARSET. In this case, the envi- 1105145510Sdarrenr ronment variable LESSCHARDEF can be used to define a character set. It 1106145510Sdarrenr should be set to a string where each character in the string represents 1107145510Sdarrenr one character in the character set. The character "." is used for a 1108145510Sdarrenr normal character, "c" for control, and "b" for binary. A decimal num- 1109145510Sdarrenr ber may be used for repetition. For example, "bccc4b." would mean 1110145510Sdarrenr character 0 is binary, 1, 2 and 3 are control, 4, 5, 6 and 7 are 1111145510Sdarrenr binary, and 8 is normal. All characters after the last are taken to be 1112145510Sdarrenr the same as the last, so characters 9 through 255 would be normal. 1113145510Sdarrenr (This is an example, and does not necessarily represent any real char- 1114145510Sdarrenr acter set.) 1115145510Sdarrenr 1116145510Sdarrenr This table shows the value of LESSCHARDEF which is equivalent to each 1117145510Sdarrenr of the possible values for LESSCHARSET: 1118145510Sdarrenr 1119145510Sdarrenr ascii 8bcccbcc18b95.b 1120161357Sguido dos 8bcccbcc12bc5b95.b. 1121161357Sguido ebcdic 5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b 1122161357Sguido 9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b. 1123161357Sguido IBM-1047 4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc 1124161357Sguido 191.b 1125145510Sdarrenr iso8859 8bcccbcc18b95.33b. 1126145510Sdarrenr koi8-r 8bcccbcc18b95.b128. 1127145510Sdarrenr latin1 8bcccbcc18b95.33b. 1128145510Sdarrenr next 8bcccbcc18b95.bb125.bb 1129145510Sdarrenr 1130145510Sdarrenr If neither LESSCHARSET nor LESSCHARDEF is set, but any of the strings 1131145510Sdarrenr "UTF-8", "UTF8", "utf-8" or "utf8" is found in the LC_ALL, LC_TYPE or 1132145510Sdarrenr LANG environment variables, then the default character set is utf-8. 1133145510Sdarrenr 1134145510Sdarrenr If that string is not found, but your system supports the [4msetlocale[0m 1135145510Sdarrenr interface, [4mless[24m will use setlocale to determine the character set. 1136145510Sdarrenr setlocale is controlled by setting the LANG or LC_CTYPE environment 1137145510Sdarrenr variables. 1138145510Sdarrenr 1139145510Sdarrenr Finally, if the [4msetlocale[24m interface is also not available, the default 1140145510Sdarrenr character set is latin1. 1141153881Sguido 1142153881Sguido Control and binary characters are displayed in standout (reverse 1143153881Sguido video). Each such character is displayed in caret notation if possible 1144145510Sdarrenr (e.g. ^A for control-A). Caret notation is used only if inverting the 1145145510Sdarrenr 0100 bit results in a normal printable character. Otherwise, the char- 1146145510Sdarrenr acter is displayed as a hex number in angle brackets. This format can 1147145510Sdarrenr be changed by setting the LESSBINFMT environment variable. LESSBINFMT 1148153881Sguido may begin with a "*" and one character to select the display attribute: 1149145510Sdarrenr "*k" is blinking, "*d" is bold, "*u" is underlined, "*s" is standout, 1150145510Sdarrenr and "*n" is normal. If LESSBINFMT does not begin with a "*", normal 1151145510Sdarrenr attribute is assumed. The remainder of LESSBINFMT is a string which 1152145510Sdarrenr may include one printf-style escape sequence (a % followed by x, X, o, 1153145510Sdarrenr d, etc.). For example, if LESSBINFMT is "*u[%x]", binary characters 1154145510Sdarrenr are displayed in underlined hexadecimal surrounded by brackets. The 1155145510Sdarrenr default if no LESSBINFMT is specified is "*s<%X>". The default if no 1156145510Sdarrenr LESSBINFMT is specified is "*s<%02X>". Warning: the result of expand- 1157145510Sdarrenr ing the character via LESSBINFMT must be less than 31 characters. 1158145510Sdarrenr 1159145510Sdarrenr When the character set is utf-8, the LESSUTFBINFMT environment variable 1160145510Sdarrenr acts similarly to LESSBINFMT but it applies to Unicode code points that 1161145510Sdarrenr were successfully decoded but are unsuitable for display (e.g., unas- 1162145510Sdarrenr signed code points). Its default value is "<U+%04lX>". Note that 1163145510Sdarrenr LESSUTFBINFMT and LESSBINFMT share their display attribute setting 1164145510Sdarrenr ("*x") so specifying one will affect both; LESSUTFBINFMT is read after 1165145510Sdarrenr LESSBINFMT so its setting, if any, will have priority. Problematic 1166145510Sdarrenr octets in a UTF-8 file (octets of a truncated sequence, octets of a 1167145510Sdarrenr complete but non-shortest form sequence, illegal octets, and stray 1168145510Sdarrenr trailing octets) are displayed individually using LESSBINFMT so as to 1169145510Sdarrenr facilitate diagnostic of how the UTF-8 file is ill-formed. 1170145510Sdarrenr 1171145510Sdarrenr 1172145510Sdarrenr[1mPROMPTS[0m 1173145510Sdarrenr The -P option allows you to tailor the prompt to your preference. The 1174145510Sdarrenr string given to the -P option replaces the specified prompt string. 1175145510Sdarrenr Certain characters in the string are interpreted specially. The prompt 1176145510Sdarrenr mechanism is rather complicated to provide flexibility, but the ordi- 1177145510Sdarrenr nary user need not understand the details of constructing personalized 1178145510Sdarrenr prompt strings. 1179145510Sdarrenr 1180145510Sdarrenr A percent sign followed by a single character is expanded according to 1181145510Sdarrenr what the following character is: 1182145510Sdarrenr 1183145510Sdarrenr %b[4mX[24m Replaced by the byte offset into the current input file. The b 1184145510Sdarrenr is followed by a single character (shown as [4mX[24m above) which spec- 1185145510Sdarrenr ifies the line whose byte offset is to be used. If the charac- 1186145510Sdarrenr ter is a "t", the byte offset of the top line in the display is 1187145510Sdarrenr used, an "m" means use the middle line, a "b" means use the bot- 1188145510Sdarrenr tom line, a "B" means use the line just after the bottom line, 1189145510Sdarrenr and a "j" means use the "target" line, as specified by the -j 1190145510Sdarrenr option. 1191145510Sdarrenr 1192145510Sdarrenr %B Replaced by the size of the current input file. 1193145510Sdarrenr 1194145510Sdarrenr %c Replaced by the column number of the text appearing in the first 1195145510Sdarrenr column of the screen. 1196145510Sdarrenr 1197145510Sdarrenr %d[4mX[24m Replaced by the page number of a line in the input file. The 1198145510Sdarrenr line to be used is determined by the [4mX[24m, as with the %b option. 1199145510Sdarrenr 1200145510Sdarrenr %D Replaced by the number of pages in the input file, or equiva- 1201145510Sdarrenr lently, the page number of the last line in the input file. 1202145510Sdarrenr 1203145510Sdarrenr %E Replaced by the name of the editor (from the VISUAL environment 1204145510Sdarrenr variable, or the EDITOR environment variable if VISUAL is not 1205145510Sdarrenr defined). See the discussion of the LESSEDIT feature below. 1206145510Sdarrenr 1207145510Sdarrenr %f Replaced by the name of the current input file. 1208145510Sdarrenr 1209145510Sdarrenr %i Replaced by the index of the current file in the list of input 1210145510Sdarrenr files. 1211145510Sdarrenr 1212145510Sdarrenr %l[4mX[24m Replaced by the line number of a line in the input file. The 1213145510Sdarrenr line to be used is determined by the [4mX[24m, as with the %b option. 1214145510Sdarrenr 1215145510Sdarrenr %L Replaced by the line number of the last line in the input file. 1216145510Sdarrenr 1217145510Sdarrenr %m Replaced by the total number of input files. 1218145510Sdarrenr 1219145510Sdarrenr %p[4mX[24m Replaced by the percent into the current input file, based on 1220145510Sdarrenr byte offsets. The line used is determined by the [4mX[24m as with the 1221145510Sdarrenr %b option. 1222145510Sdarrenr 1223145510Sdarrenr %P[4mX[24m Replaced by the percent into the current input file, based on 1224145510Sdarrenr line numbers. The line used is determined by the [4mX[24m as with the 1225145510Sdarrenr %b option. 1226145510Sdarrenr 1227145510Sdarrenr %s Same as %B. 1228145510Sdarrenr 1229145510Sdarrenr %t Causes any trailing spaces to be removed. Usually used at the 1230145510Sdarrenr end of the string, but may appear anywhere. 1231145510Sdarrenr 1232145510Sdarrenr %x Replaced by the name of the next input file in the list. 1233145510Sdarrenr 1234145510Sdarrenr If any item is unknown (for example, the file size if input is a pipe), 1235145510Sdarrenr a question mark is printed instead. 1236145510Sdarrenr 1237145510Sdarrenr The format of the prompt string can be changed depending on certain 1238145510Sdarrenr conditions. A question mark followed by a single character acts like 1239145510Sdarrenr an "IF": depending on the following character, a condition is evalu- 1240145510Sdarrenr ated. If the condition is true, any characters following the question 1241145510Sdarrenr mark and condition character, up to a period, are included in the 1242145510Sdarrenr prompt. If the condition is false, such characters are not included. 1243145510Sdarrenr A colon appearing between the question mark and the period can be used 1244145510Sdarrenr to establish an "ELSE": any characters between the colon and the period 1245145510Sdarrenr are included in the string if and only if the IF condition is false. 1246145510Sdarrenr Condition characters (which follow a question mark) may be: 1247145510Sdarrenr 1248145510Sdarrenr ?a True if any characters have been included in the prompt so far. 1249145510Sdarrenr 1250145510Sdarrenr ?b[4mX[24m True if the byte offset of the specified line is known. 1251145510Sdarrenr 1252145510Sdarrenr ?B True if the size of current input file is known. 1253145510Sdarrenr 1254145510Sdarrenr ?c True if the text is horizontally shifted (%c is not zero). 1255145510Sdarrenr 1256145510Sdarrenr ?d[4mX[24m True if the page number of the specified line is known. 1257145510Sdarrenr 1258145510Sdarrenr ?e True if at end-of-file. 1259145510Sdarrenr 1260145510Sdarrenr ?f True if there is an input filename (that is, if input is not a 1261145510Sdarrenr pipe). 1262145510Sdarrenr 1263145510Sdarrenr ?l[4mX[24m True if the line number of the specified line is known. 1264145510Sdarrenr 1265145510Sdarrenr ?L True if the line number of the last line in the file is known. 1266145510Sdarrenr 1267145510Sdarrenr ?m True if there is more than one input file. 1268145510Sdarrenr 1269145510Sdarrenr ?n True if this is the first prompt in a new input file. 1270145510Sdarrenr 1271145510Sdarrenr ?p[4mX[24m True if the percent into the current input file, based on byte 1272145510Sdarrenr offsets, of the specified line is known. 1273145510Sdarrenr 1274145510Sdarrenr ?P[4mX[24m True if the percent into the current input file, based on line 1275145510Sdarrenr numbers, of the specified line is known. 1276145510Sdarrenr 1277145510Sdarrenr ?s Same as "?B". 1278145510Sdarrenr 1279145510Sdarrenr ?x True if there is a next input file (that is, if the current 1280145510Sdarrenr input file is not the last one). 1281145510Sdarrenr 1282145510Sdarrenr Any characters other than the special ones (question mark, colon, 1283145510Sdarrenr period, percent, and backslash) become literally part of the prompt. 1284145510Sdarrenr Any of the special characters may be included in the prompt literally 1285145510Sdarrenr by preceding it with a backslash. 1286145510Sdarrenr 1287145510Sdarrenr Some examples: 1288145510Sdarrenr 1289145510Sdarrenr ?f%f:Standard input. 1290145510Sdarrenr 1291145510Sdarrenr This prompt prints the filename, if known; otherwise the string "Stan- 1292145510Sdarrenr dard input". 1293145510Sdarrenr 1294145510Sdarrenr ?f%f .?ltLine %lt:?pt%pt\%:?btByte %bt:-... 1295145510Sdarrenr 1296145510Sdarrenr This prompt would print the filename, if known. The filename is fol- 1297145510Sdarrenr lowed by the line number, if known, otherwise the percent if known, 1298145510Sdarrenr otherwise the byte offset if known. Otherwise, a dash is printed. 1299145510Sdarrenr Notice how each question mark has a matching period, and how the % 1300145510Sdarrenr after the %pt is included literally by escaping it with a backslash. 1301145510Sdarrenr 1302145510Sdarrenr ?n?f%f .?m(file %i of %m) ..?e(END) ?x- Next\: %x..%t 1303145510Sdarrenr 1304145510Sdarrenr This prints the filename if this is the first prompt in a file, fol- 1305145510Sdarrenr lowed by the "file N of N" message if there is more than one input 1306153881Sguido file. Then, if we are at end-of-file, the string "(END)" is printed 1307145510Sdarrenr followed by the name of the next file, if there is one. Finally, any 1308145510Sdarrenr trailing spaces are truncated. This is the default prompt. For refer- 1309145510Sdarrenr ence, here are the defaults for the other two prompts (-m and -M 1310145510Sdarrenr respectively). Each is broken into two lines here for readability 1311153881Sguido only. 1312153881Sguido 1313145510Sdarrenr ?n?f%f .?m(file %i of %m) ..?e(END) ?x- Next\: %x.: 1314145510Sdarrenr ?pB%pB\%:byte %bB?s/%s...%t 1315145510Sdarrenr 1316145510Sdarrenr ?f%f .?n?m(file %i of %m) ..?ltlines %lt-%lb?L/%L. : 1317145510Sdarrenr byte %bB?s/%s. .?e(END) ?x- Next\: %x.:?pB%pB\%..%t 1318145510Sdarrenr 1319145510Sdarrenr And here is the default message produced by the = command: 1320145510Sdarrenr 1321145510Sdarrenr ?f%f .?m(file %i of %m) .?ltlines %lt-%lb?L/%L. . 1322145510Sdarrenr byte %bB?s/%s. ?e(END) :?pB%pB\%..%t 1323145510Sdarrenr 1324145510Sdarrenr The prompt expansion features are also used for another purpose: if an 1325145510Sdarrenr environment variable LESSEDIT is defined, it is used as the command to 1326145510Sdarrenr be executed when the v command is invoked. The LESSEDIT string is 1327145510Sdarrenr expanded in the same way as the prompt strings. The default value for 1328145510Sdarrenr LESSEDIT is: 1329145510Sdarrenr 1330145510Sdarrenr %E ?lm+%lm. %f 1331145510Sdarrenr 1332145510Sdarrenr Note that this expands to the editor name, followed by a + and the line 1333145510Sdarrenr number, followed by the file name. If your editor does not accept the 1334145510Sdarrenr "+linenumber" syntax, or has other differences in invocation syntax, 1335145510Sdarrenr the LESSEDIT variable can be changed to modify this default. 1336145510Sdarrenr 1337145510Sdarrenr 1338145510Sdarrenr[1mSECURITY[0m 1339145510Sdarrenr When the environment variable LESSSECURE is set to 1, [4mless[24m runs in a 1340145510Sdarrenr "secure" mode. This means these features are disabled: 1341145510Sdarrenr 1342145510Sdarrenr ! the shell command 1343145510Sdarrenr 1344145510Sdarrenr | the pipe command 1345145510Sdarrenr 1346145510Sdarrenr :e the examine command. 1347145510Sdarrenr 1348145510Sdarrenr v the editing command 1349145510Sdarrenr 1350145510Sdarrenr s -o log files 1351145510Sdarrenr 1352145510Sdarrenr -k use of lesskey files 1353145510Sdarrenr 1354145510Sdarrenr -t use of tags files 1355145510Sdarrenr 1356145510Sdarrenr metacharacters in filenames, such as * 1357145510Sdarrenr 1358145510Sdarrenr filename completion (TAB, ^L) 1359145510Sdarrenr 1360145510Sdarrenr Less can also be compiled to be permanently in "secure" mode. 1361145510Sdarrenr 1362145510Sdarrenr 1363145510Sdarrenr[1mCOMPATIBILITY WITH MORE[0m 1364145510Sdarrenr If the environment variable LESS_IS_MORE is set to 1, or if the program 1365145510Sdarrenr is invoked via a file link named "more", [4mless[24m behaves (mostly) in con- 1366145510Sdarrenr formance with the POSIX "more" command specification. In this mode, 1367145510Sdarrenr less behaves differently in these ways: 1368145510Sdarrenr 1369145510Sdarrenr The -e option works differently. If the -e option is not set, [4mless[0m 1370145510Sdarrenr behaves as if the -E option were set. If the -e option is set, [4mless[0m 1371145510Sdarrenr behaves as if the -e and -F options were set. 1372145510Sdarrenr 1373145510Sdarrenr The -m option works differently. If the -m option is not set, the 1374145510Sdarrenr medium prompt is used, and it is prefixed with the string "--More--". 1375145510Sdarrenr If the -m option is set, the short prompt is used. 1376145510Sdarrenr 1377145510Sdarrenr The -n option acts like the -z option. The normal behavior of the -n 1378145510Sdarrenr option is unavailable in this mode. 1379145510Sdarrenr 1380145510Sdarrenr The parameter to the -p option is taken to be a [4mless[24m command rather 1381145510Sdarrenr than a search pattern. 1382145510Sdarrenr 1383145510Sdarrenr The LESS environment variable is ignored, and the MORE environment 1384145510Sdarrenr variable is used in its place. 1385145510Sdarrenr 1386145510Sdarrenr 1387145510Sdarrenr[1mENVIRONMENT VARIABLES[0m 1388145510Sdarrenr Environment variables may be specified either in the system environment 1389145510Sdarrenr as usual, or in a [4mlesskey[24m (1) file. If environment variables are 1390145510Sdarrenr defined in more than one place, variables defined in a local lesskey 1391145510Sdarrenr file take precedence over variables defined in the system environment, 1392145510Sdarrenr which take precedence over variables defined in the system-wide lesskey 1393145510Sdarrenr file. 1394145510Sdarrenr 1395145510Sdarrenr COLUMNS 1396145510Sdarrenr Sets the number of columns on the screen. Takes precedence over 1397145510Sdarrenr the number of columns specified by the TERM variable. (But if 1398145510Sdarrenr you have a windowing system which supports TIOCGWINSZ or 1399145510Sdarrenr WIOCGETD, the window system's idea of the screen size takes 1400145510Sdarrenr precedence over the LINES and COLUMNS environment variables.) 1401145510Sdarrenr 1402145510Sdarrenr EDITOR The name of the editor (used for the v command). 1403145510Sdarrenr 1404145510Sdarrenr HOME Name of the user's home directory (used to find a lesskey file 1405145510Sdarrenr on Unix and OS/2 systems). 1406145510Sdarrenr 1407145510Sdarrenr HOMEDRIVE, HOMEPATH 1408145510Sdarrenr Concatenation of the HOMEDRIVE and HOMEPATH environment vari- 1409145510Sdarrenr ables is the name of the user's home directory if the HOME vari- 1410145510Sdarrenr able is not set (only in the Windows version). 1411145510Sdarrenr 1412145510Sdarrenr INIT Name of the user's init directory (used to find a lesskey file 1413145510Sdarrenr on OS/2 systems). 1414145510Sdarrenr 1415145510Sdarrenr LANG Language for determining the character set. 1416145510Sdarrenr 1417145510Sdarrenr LC_CTYPE 1418145510Sdarrenr Language for determining the character set. 1419145510Sdarrenr 1420145510Sdarrenr LESS Options which are passed to [4mless[24m automatically. 1421145510Sdarrenr 1422145510Sdarrenr LESSANSIENDCHARS 1423145510Sdarrenr Characters which may end an ANSI color escape sequence (default 1424145510Sdarrenr "m"). 1425145510Sdarrenr 1426145510Sdarrenr LESSANSIMIDCHARS 1427145510Sdarrenr Characters which may appear between the ESC character and the 1428145510Sdarrenr end character in an ANSI color escape sequence (default 1429145510Sdarrenr "0123456789;[?!"'#%()*+ ". 1430145510Sdarrenr 1431145510Sdarrenr LESSBINFMT 1432145510Sdarrenr Format for displaying non-printable, non-control characters. 1433145510Sdarrenr 1434145510Sdarrenr LESSCHARDEF 1435145510Sdarrenr Defines a character set. 1436145510Sdarrenr 1437145510Sdarrenr LESSCHARSET 1438145510Sdarrenr Selects a predefined character set. 1439145510Sdarrenr 1440145510Sdarrenr LESSCLOSE 1441145510Sdarrenr Command line to invoke the (optional) input-postprocessor. 1442145510Sdarrenr 1443145510Sdarrenr LESSECHO 1444145510Sdarrenr Name of the lessecho program (default "lessecho"). The lessecho 1445145510Sdarrenr program is needed to expand metacharacters, such as * and ?, in 1446145510Sdarrenr filenames on Unix systems. 1447145510Sdarrenr 1448145510Sdarrenr LESSEDIT 1449145510Sdarrenr Editor prototype string (used for the v command). See discus- 1450145510Sdarrenr sion under PROMPTS. 1451145510Sdarrenr 1452145510Sdarrenr LESSGLOBALTAGS 1453145510Sdarrenr Name of the command used by the -t option to find global tags. 1454145510Sdarrenr Normally should be set to "global" if your system has the [4mglobal[0m 1455145510Sdarrenr (1) command. If not set, global tags are not used. 1456145510Sdarrenr 1457145510Sdarrenr LESSHISTFILE 1458145510Sdarrenr Name of the history file used to remember search commands and 1459145510Sdarrenr shell commands between invocations of [4mless.[24m If set to "-" or 1460145510Sdarrenr "/dev/null", a history file is not used. The default is 1461145510Sdarrenr "$HOME/.lesshst" on Unix systems, "$HOME/_lesshst" on DOS and 1462145510Sdarrenr Windows systems, or "$HOME/lesshst.ini" or "$INIT/lesshst.ini" 1463145510Sdarrenr on OS/2 systems. 1464145510Sdarrenr 1465145510Sdarrenr LESSHISTSIZE 1466145510Sdarrenr The maximum number of commands to save in the history file. The 1467145510Sdarrenr default is 100. 1468145510Sdarrenr 1469145510Sdarrenr LESSKEY 1470145510Sdarrenr Name of the default lesskey(1) file. 1471145510Sdarrenr 1472145510Sdarrenr LESSKEY_SYSTEM 1473145510Sdarrenr Name of the default system-wide lesskey(1) file. 1474153881Sguido 1475145510Sdarrenr LESSMETACHARS 1476145510Sdarrenr List of characters which are considered "metacharacters" by the 1477145510Sdarrenr shell. 1478145510Sdarrenr 1479145510Sdarrenr LESSMETAESCAPE 1480145510Sdarrenr Prefix which less will add before each metacharacter in a com- 1481145510Sdarrenr mand sent to the shell. If LESSMETAESCAPE is an empty string, 1482161357Sguido commands containing metacharacters will not be passed to the 1483145510Sdarrenr shell. 1484145510Sdarrenr 1485145510Sdarrenr LESSOPEN 1486145510Sdarrenr Command line to invoke the (optional) input-preprocessor. 1487145510Sdarrenr 1488145510Sdarrenr LESSSECURE 1489145510Sdarrenr Runs less in "secure" mode. See discussion under SECURITY. 1490145510Sdarrenr 1491145510Sdarrenr LESSSEPARATOR 1492145510Sdarrenr String to be appended to a directory name in filename comple- 1493145510Sdarrenr tion. 1494145510Sdarrenr 1495145510Sdarrenr LESSUTFBINFMT 1496145510Sdarrenr Format for displaying non-printable Unicode code points. 1497145510Sdarrenr 1498145510Sdarrenr LESS_IS_MORE 1499145510Sdarrenr Emulate the [4mmore[24m (1) command. 1500145510Sdarrenr 1501145510Sdarrenr LINES Sets the number of lines on the screen. Takes precedence over 1502145510Sdarrenr the number of lines specified by the TERM variable. (But if you 1503145510Sdarrenr have a windowing system which supports TIOCGWINSZ or WIOCGETD, 1504145510Sdarrenr the window system's idea of the screen size takes precedence 1505145510Sdarrenr over the LINES and COLUMNS environment variables.) 1506145510Sdarrenr 1507145510Sdarrenr PATH User's search path (used to find a lesskey file on MS-DOS and 1508145510Sdarrenr OS/2 systems). 1509145510Sdarrenr 1510145510Sdarrenr SHELL The shell used to execute the ! command, as well as to expand 1511145510Sdarrenr filenames. 1512145510Sdarrenr 1513145510Sdarrenr TERM The type of terminal on which [4mless[24m is being run. 1514145510Sdarrenr 1515145510Sdarrenr VISUAL The name of the editor (used for the v command). 1516145510Sdarrenr 1517145510Sdarrenr 1518145510Sdarrenr[1mSEE ALSO[0m 1519145510Sdarrenr lesskey(1) 1520145510Sdarrenr 1521145510Sdarrenr 1522145510Sdarrenr[1mCOPYRIGHT[0m 1523145510Sdarrenr Copyright (C) 1984-2008 Mark Nudelman 1524145510Sdarrenr 1525145510Sdarrenr less is part of the GNU project and is free software. You can redis- 1526145510Sdarrenr tribute it and/or modify it under the terms of either (1) the GNU Gen- 1527145510Sdarrenr eral Public License as published by the Free Software Foundation; or 1528145510Sdarrenr (2) the Less License. See the file README in the less distribution for 1529145510Sdarrenr more details regarding redistribution. You should have received a copy 1530145510Sdarrenr of the GNU General Public License along with the source for less; see 1531145510Sdarrenr the file COPYING. If not, write to the Free Software Foundation, 59 1532145510Sdarrenr Temple Place, Suite 330, Boston, MA 02111-1307, USA. You should also 1533145510Sdarrenr have received a copy of the Less License; see the file LICENSE. 1534145510Sdarrenr 1535145510Sdarrenr less is distributed in the hope that it will be useful, but WITHOUT ANY 1536145510Sdarrenr WARRANTY; without even the implied warranty of MERCHANTABILITY or FIT- 1537145510Sdarrenr NESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 1538145510Sdarrenr more details. 1539145510Sdarrenr 1540145510Sdarrenr 1541145510Sdarrenr[1mAUTHOR[0m 1542145510Sdarrenr Mark Nudelman <markn@greenwoodsoftware.com> 1543145510Sdarrenr See http://www.greenwoodsoftware.com/less/bugs.html for the latest list 1544145510Sdarrenr of known bugs in less. 1545145510Sdarrenr Send bug reports or comments to the above address or to 1546145510Sdarrenr bug-less@gnu.org. 1547145510Sdarrenr For more information, see the less homepage at 1548145510Sdarrenr http://www.greenwoodsoftware.com/less. 1549145510Sdarrenr 1550145510Sdarrenr 1551145510Sdarrenr 1552145510Sdarrenr Version 429: 11 Apr 2009 LESS(1) 1553145510Sdarrenr