less.man revision 222906
1161475SdelphijLESS(1) LESS(1) 260786Sps 360786Sps 460786Sps 5170256Sdelphij[1mNAME[0m 660786Sps less - opposite of more 760786Sps 8170256Sdelphij[1mSYNOPSIS[0m 9170256Sdelphij [1mless -?[0m 10170256Sdelphij [1mless --help[0m 11170256Sdelphij [1mless -V[0m 12170256Sdelphij [1mless --version[0m 13221715Sdelphij [1mless [-[+]aABcCdeEfFgGiIJKLmMnNqQrRsSuUVwWX~][0m 14170256Sdelphij [1m[-b [4m[22mspace[24m[1m] [-h [4m[22mlines[24m[1m] [-j [4m[22mline[24m[1m] [-k [4m[22mkeyfile[24m[1m][0m 15170256Sdelphij [1m[-{oO} [4m[22mlogfile[24m[1m] [-p [4m[22mpattern[24m[1m] [-P [4m[22mprompt[24m[1m] [-t [4m[22mtag[24m[1m][0m 16170256Sdelphij [1m[-T [4m[22mtagsfile[24m[1m] [-x [4m[22mtab[24m[1m,...] [-y [4m[22mlines[24m[1m] [-[z] [4m[22mlines[24m[1m][0m 17170256Sdelphij [1m[-# [4m[22mshift[24m[1m] [+[+][4m[22mcmd[24m[1m] [--] [[4m[22mfilename[24m[1m]...[0m 18161475Sdelphij (See the OPTIONS section for alternate option syntax with long option 19161475Sdelphij names.) 2060786Sps 2160786Sps 22170256Sdelphij[1mDESCRIPTION[0m 23170256Sdelphij [4mLess[24m is a program similar to [4mmore[24m (1), but which allows backward move- 24170256Sdelphij ment in the file as well as forward movement. Also, [4mless[24m does not have 25161475Sdelphij to read the entire input file before starting, so with large input 26170256Sdelphij files it starts up faster than text editors like [4mvi[24m (1). [4mLess[24m uses 27161475Sdelphij termcap (or terminfo on some systems), so it can run on a variety of 28161475Sdelphij terminals. There is even limited support for hardcopy terminals. (On 29161475Sdelphij a hardcopy terminal, lines which should be printed at the top of the 30161475Sdelphij screen are prefixed with a caret.) 3160786Sps 32170256Sdelphij Commands are based on both [4mmore[24m and [4mvi.[24m Commands may be preceded by a 33161475Sdelphij decimal number, called N in the descriptions below. The number is used 34161475Sdelphij by some commands, as indicated. 3560786Sps 3660786Sps 37170256Sdelphij[1mCOMMANDS[0m 38161475Sdelphij In the following descriptions, ^X means control-X. ESC stands for the 39161475Sdelphij ESCAPE key; for example ESC-v means the two character sequence 40161475Sdelphij "ESCAPE", then "v". 4160786Sps 42161475Sdelphij h or H Help: display a summary of these commands. If you forget all 43161475Sdelphij the other commands, remember this one. 4460786Sps 4560786Sps SPACE or ^V or f or ^F 46161475Sdelphij Scroll forward N lines, default one window (see option -z 47161475Sdelphij below). If N is more than the screen size, only the final 48161475Sdelphij screenful is displayed. Warning: some systems use ^V as a spe- 49161475Sdelphij cial literalization character. 5060786Sps 51161475Sdelphij z Like SPACE, but if N is specified, it becomes the new window 52161475Sdelphij size. 5360786Sps 5460786Sps ESC-SPACE 55161475Sdelphij Like SPACE, but scrolls a full screenful, even if it reaches 56161475Sdelphij end-of-file in the process. 5760786Sps 58221715Sdelphij ENTER or RETURN or ^N or e or ^E or j or ^J 59161475Sdelphij Scroll forward N lines, default 1. The entire N lines are dis- 60161475Sdelphij played, even if N is more than the screen size. 6160786Sps 6260786Sps d or ^D 63161475Sdelphij Scroll forward N lines, default one half of the screen size. If 64161475Sdelphij N is specified, it becomes the new default for subsequent d and 65161475Sdelphij u commands. 6660786Sps 6760786Sps b or ^B or ESC-v 68161475Sdelphij Scroll backward N lines, default one window (see option -z 69161475Sdelphij below). If N is more than the screen size, only the final 70161475Sdelphij screenful is displayed. 7160786Sps 72161475Sdelphij w Like ESC-v, but if N is specified, it becomes the new window 73161475Sdelphij size. 7460786Sps 7560786Sps y or ^Y or ^P or k or ^K 76161475Sdelphij Scroll backward N lines, default 1. The entire N lines are dis- 77161475Sdelphij played, even if N is more than the screen size. Warning: some 78161475Sdelphij systems use ^Y as a special job control character. 7960786Sps 8060786Sps u or ^U 81161475Sdelphij Scroll backward N lines, default one half of the screen size. 82161475Sdelphij If N is specified, it becomes the new default for subsequent d 83161475Sdelphij and u commands. 8460786Sps 8560786Sps ESC-) or RIGHTARROW 86161475Sdelphij Scroll horizontally right N characters, default half the screen 87161475Sdelphij width (see the -# option). If a number N is specified, it 88161475Sdelphij becomes the default for future RIGHTARROW and LEFTARROW com- 89161475Sdelphij mands. While the text is scrolled, it acts as though the -S 9089019Sps option (chop lines) were in effect. 9160786Sps 9260786Sps ESC-( or LEFTARROW 93161475Sdelphij Scroll horizontally left N characters, default half the screen 94161475Sdelphij width (see the -# option). If a number N is specified, it 95161475Sdelphij becomes the default for future RIGHTARROW and LEFTARROW com- 96161475Sdelphij mands. 9760786Sps 9860786Sps r or ^R or ^L 9960786Sps Repaint the screen. 10060786Sps 101161475Sdelphij R Repaint the screen, discarding any buffered input. Useful if 102161475Sdelphij the file is changing while it is being viewed. 10360786Sps 104161475Sdelphij F Scroll forward, and keep trying to read when the end of file is 105161475Sdelphij reached. Normally this command would be used when already at 106161475Sdelphij the end of the file. It is a way to monitor the tail of a file 107161475Sdelphij which is growing while it is being viewed. (The behavior is 10860786Sps similar to the "tail -f" command.) 10960786Sps 11060786Sps g or < or ESC-< 111161475Sdelphij Go to line N in the file, default 1 (beginning of file). (Warn- 112161475Sdelphij ing: this may be slow if N is large.) 11360786Sps 11460786Sps G or > or ESC-> 115161475Sdelphij Go to line N in the file, default the end of the file. (Warn- 116161475Sdelphij ing: this may be slow if N is large, or if N is not specified 117161475Sdelphij and standard input, rather than a file, is being read.) 11860786Sps 119161475Sdelphij p or % Go to a position N percent into the file. N should be between 0 120170256Sdelphij and 100, and may contain a decimal point. 12160786Sps 122170256Sdelphij P Go to the line containing byte offset N in the file. 123170256Sdelphij 124161475Sdelphij { If a left curly bracket appears in the top line displayed on the 125161475Sdelphij screen, the { command will go to the matching right curly 126161475Sdelphij bracket. The matching right curly bracket is positioned on the 127161475Sdelphij bottom line of the screen. If there is more than one left curly 128161475Sdelphij bracket on the top line, a number N may be used to specify the 129161475Sdelphij N-th bracket on the line. 13060786Sps 131161475Sdelphij } If a right curly bracket appears in the bottom line displayed on 132161475Sdelphij the screen, the } command will go to the matching left curly 133161475Sdelphij bracket. The matching left curly bracket is positioned on the 134161475Sdelphij top line of the screen. If there is more than one right curly 135161475Sdelphij bracket on the top line, a number N may be used to specify the 136161475Sdelphij N-th bracket on the line. 13760786Sps 138161475Sdelphij ( Like {, but applies to parentheses rather than curly brackets. 13960786Sps 140161475Sdelphij ) Like }, but applies to parentheses rather than curly brackets. 14160786Sps 142161475Sdelphij [ Like {, but applies to square brackets rather than curly brack- 143161475Sdelphij ets. 14460786Sps 145161475Sdelphij ] Like }, but applies to square brackets rather than curly brack- 146161475Sdelphij ets. 14760786Sps 148161475Sdelphij ESC-^F Followed by two characters, acts like {, but uses the two char- 149161475Sdelphij acters as open and close brackets, respectively. For example, 150161475Sdelphij "ESC ^F < >" could be used to go forward to the > which matches 151161475Sdelphij the < in the top displayed line. 15260786Sps 153161475Sdelphij ESC-^B Followed by two characters, acts like }, but uses the two char- 154161475Sdelphij acters as open and close brackets, respectively. For example, 155161475Sdelphij "ESC ^B < >" could be used to go backward to the < which matches 156161475Sdelphij the > in the bottom displayed line. 15760786Sps 158161475Sdelphij m Followed by any lowercase letter, marks the current position 159161475Sdelphij with that letter. 16060786Sps 161161475Sdelphij ' (Single quote.) Followed by any lowercase letter, returns to 162161475Sdelphij the position which was previously marked with that letter. Fol- 163161475Sdelphij lowed by another single quote, returns to the position at which 164161475Sdelphij the last "large" movement command was executed. Followed by a ^ 165161475Sdelphij or $, jumps to the beginning or end of the file respectively. 166161475Sdelphij Marks are preserved when a new file is examined, so the ' com- 167161475Sdelphij mand can be used to switch between input files. 16860786Sps 16960786Sps ^X^X Same as single quote. 17060786Sps 17160786Sps /pattern 172161475Sdelphij Search forward in the file for the N-th line containing the pat- 173161475Sdelphij tern. N defaults to 1. The pattern is a regular expression, as 174161475Sdelphij recognized by the regular expression library supplied by your 175221715Sdelphij system. The search starts at the first line displayed (but see 17660786Sps the -a and -j options, which change this). 17760786Sps 178161475Sdelphij Certain characters are special if entered at the beginning of 179161475Sdelphij the pattern; they modify the type of search rather than become 180161475Sdelphij part of the pattern: 18160786Sps 18260786Sps ^N or ! 183161475Sdelphij Search for lines which do NOT match the pattern. 18460786Sps 18560786Sps ^E or * 186161475Sdelphij Search multiple files. That is, if the search reaches 187161475Sdelphij the END of the current file without finding a match, the 188161475Sdelphij search continues in the next file in the command line 18960786Sps list. 19060786Sps 19160786Sps ^F or @ 192161475Sdelphij Begin the search at the first line of the FIRST file in 193161475Sdelphij the command line list, regardless of what is currently 194161475Sdelphij displayed on the screen or the settings of the -a or -j 19560786Sps options. 19660786Sps 197161475Sdelphij ^K Highlight any text which matches the pattern on the cur- 198191930Sdelphij rent screen, but don't move to the first match (KEEP cur- 199191930Sdelphij rent position). 20060786Sps 201161475Sdelphij ^R Don't interpret regular expression metacharacters; that 202161475Sdelphij is, do a simple textual comparison. 20360786Sps 20463128Sps ?pattern 205161475Sdelphij Search backward in the file for the N-th line containing the 206161475Sdelphij pattern. The search starts at the line immediately before the 207161475Sdelphij top line displayed. 20863128Sps 20960786Sps Certain characters are special as in the / command: 21060786Sps 21160786Sps ^N or ! 212161475Sdelphij Search for lines which do NOT match the pattern. 21360786Sps 21460786Sps ^E or * 215161475Sdelphij Search multiple files. That is, if the search reaches 216161475Sdelphij the beginning of the current file without finding a 217161475Sdelphij match, the search continues in the previous file in the 218161475Sdelphij command line list. 21960786Sps 22060786Sps ^F or @ 221161475Sdelphij Begin the search at the last line of the last file in the 222161475Sdelphij command line list, regardless of what is currently dis- 223161475Sdelphij played on the screen or the settings of the -a or -j 22460786Sps options. 22560786Sps 22660786Sps ^K As in forward searches. 22760786Sps 22860786Sps ^R As in forward searches. 22960786Sps 23060786Sps ESC-/pattern 23160786Sps Same as "/*". 23260786Sps 23360786Sps ESC-?pattern 23460786Sps Same as "?*". 23560786Sps 236161475Sdelphij n Repeat previous search, for N-th line containing the last pat- 237161475Sdelphij tern. If the previous search was modified by ^N, the search is 238161475Sdelphij made for the N-th line NOT containing the pattern. If the pre- 239161475Sdelphij vious search was modified by ^E, the search continues in the 240161475Sdelphij next (or previous) file if not satisfied in the current file. 241161475Sdelphij If the previous search was modified by ^R, the search is done 242161475Sdelphij without using regular expressions. There is no effect if the 243161475Sdelphij previous search was modified by ^F or ^K. 24460786Sps 245161475Sdelphij N Repeat previous search, but in the reverse direction. 24660786Sps 247161475Sdelphij ESC-n Repeat previous search, but crossing file boundaries. The 248161475Sdelphij effect is as if the previous search were modified by *. 24960786Sps 250161475Sdelphij ESC-N Repeat previous search, but in the reverse direction and cross- 251161475Sdelphij ing file boundaries. 25260786Sps 253161475Sdelphij ESC-u Undo search highlighting. Turn off highlighting of strings 254161475Sdelphij matching the current search pattern. If highlighting is already 255161475Sdelphij off because of a previous ESC-u command, turn highlighting back 256161475Sdelphij on. Any search command will also turn highlighting back on. 257161475Sdelphij (Highlighting can also be disabled by toggling the -G option; in 258161475Sdelphij that case search commands do not turn highlighting back on.) 25960786Sps 260191930Sdelphij &pattern 261191930Sdelphij Display only lines which match the pattern; lines which do not 262191930Sdelphij match the pattern are not displayed. If pattern is empty (if 263191930Sdelphij you type & immediately followed by ENTER), any filtering is 264191930Sdelphij turned off, and all lines are displayed. While filtering is in 265191930Sdelphij effect, an ampersand is displayed at the beginning of the 266191930Sdelphij prompt, as a reminder that some lines in the file may be hidden. 267191930Sdelphij 268191930Sdelphij Certain characters are special as in the / command: 269191930Sdelphij 270191930Sdelphij ^N or ! 271191930Sdelphij Display only lines which do NOT match the pattern. 272191930Sdelphij 273221715Sdelphij ^R Don't interpret regular expression metacharacters; that 274191930Sdelphij is, do a simple textual comparison. 275191930Sdelphij 27660786Sps :e [filename] 277221715Sdelphij Examine a new file. If the filename is missing, the "current" 278221715Sdelphij file (see the :n and :p commands below) from the list of files 279221715Sdelphij in the command line is re-examined. A percent sign (%) in the 280221715Sdelphij filename is replaced by the name of the current file. A pound 281221715Sdelphij sign (#) is replaced by the name of the previously examined 282221715Sdelphij file. However, two consecutive percent signs are simply 283161475Sdelphij replaced with a single percent sign. This allows you to enter a 284221715Sdelphij filename that contains a percent sign in the name. Similarly, 285221715Sdelphij two consecutive pound signs are replaced with a single pound 286221715Sdelphij sign. The filename is inserted into the command line list of 287221715Sdelphij files so that it can be seen by subsequent :n and :p commands. 288161475Sdelphij If the filename consists of several files, they are all inserted 289221715Sdelphij into the list of files and the first one is examined. If the 290161475Sdelphij filename contains one or more spaces, the entire filename should 291161475Sdelphij be enclosed in double quotes (also see the -" option). 29260786Sps 29360786Sps ^X^V or E 294221715Sdelphij Same as :e. Warning: some systems use ^V as a special literal- 295221715Sdelphij ization character. On such systems, you may not be able to use 296161475Sdelphij ^V. 29760786Sps 298221715Sdelphij :n Examine the next file (from the list of files given in the com- 299221715Sdelphij mand line). If a number N is specified, the N-th next file is 300161475Sdelphij examined. 30160786Sps 302161475Sdelphij :p Examine the previous file in the command line list. If a number 303161475Sdelphij N is specified, the N-th previous file is examined. 30460786Sps 305221715Sdelphij :x Examine the first file in the command line list. If a number N 306161475Sdelphij is specified, the N-th file in the list is examined. 30760786Sps 30860786Sps :d Remove the current file from the list of files. 30960786Sps 310221715Sdelphij t Go to the next tag, if there were more than one matches for the 311161475Sdelphij current tag. See the -t option for more details about tags. 31260786Sps 313221715Sdelphij T Go to the previous tag, if there were more than one matches for 314161475Sdelphij the current tag. 31560786Sps 31689019Sps = or ^G or :f 317221715Sdelphij Prints some information about the file being viewed, including 318221715Sdelphij its name and the line number and byte offset of the bottom line 319221715Sdelphij being displayed. If possible, it also prints the length of the 320221715Sdelphij file, the number of lines in the file and the percent of the 321161475Sdelphij file above the last displayed line. 32260786Sps 323221715Sdelphij - Followed by one of the command line option letters (see OPTIONS 324221715Sdelphij below), this will change the setting of that option and print a 325221715Sdelphij message describing the new setting. If a ^P (CONTROL-P) is 326161475Sdelphij entered immediately after the dash, the setting of the option is 327221715Sdelphij changed but no message is printed. If the option letter has a 328221715Sdelphij numeric value (such as -b or -h), or a string value (such as -P 329221715Sdelphij or -t), a new value may be entered after the option letter. If 330221715Sdelphij no new value is entered, a message describing the current set- 331161475Sdelphij ting is printed and nothing is changed. 33260786Sps 333221715Sdelphij -- Like the - command, but takes a long option name (see OPTIONS 334221715Sdelphij below) rather than a single option letter. You must press ENTER 335221715Sdelphij or RETURN after typing the option name. A ^P immediately after 336221715Sdelphij the second dash suppresses printing of a message describing the 337221715Sdelphij new setting, as in the - command. 33860786Sps 339221715Sdelphij -+ Followed by one of the command line option letters this will 340221715Sdelphij reset the option to its default setting and print a message 341221715Sdelphij describing the new setting. (The "-+[4mX[24m" command does the same 342221715Sdelphij thing as "-+[4mX[24m" on the command line.) This does not work for 34360786Sps string-valued options. 34460786Sps 345221715Sdelphij --+ Like the -+ command, but takes a long option name rather than a 346161475Sdelphij single option letter. 34760786Sps 348221715Sdelphij -! Followed by one of the command line option letters, this will 349221715Sdelphij reset the option to the "opposite" of its default setting and 350221715Sdelphij print a message describing the new setting. This does not work 351161475Sdelphij for numeric or string-valued options. 35260786Sps 353221715Sdelphij --! Like the -! command, but takes a long option name rather than a 354161475Sdelphij single option letter. 35560786Sps 356221715Sdelphij _ (Underscore.) Followed by one of the command line option let- 357221715Sdelphij ters, this will print a message describing the current setting 358161475Sdelphij of that option. The setting of the option is not changed. 35960786Sps 360161475Sdelphij __ (Double underscore.) Like the _ (underscore) command, but takes 361161475Sdelphij a long option name rather than a single option letter. You must 362221715Sdelphij press ENTER or RETURN after typing the option name. 36360786Sps 364221715Sdelphij +cmd Causes the specified cmd to be executed each time a new file is 365170256Sdelphij examined. For example, +G causes [4mless[24m to initially display each 366161475Sdelphij file starting at the end rather than the beginning. 36760786Sps 368170256Sdelphij V Prints the version number of [4mless[24m being run. 36960786Sps 37060786Sps q or Q or :q or :Q or ZZ 371170256Sdelphij Exits [4mless.[0m 37260786Sps 373221715Sdelphij The following four commands may or may not be valid, depending on your 374161475Sdelphij particular installation. 37560786Sps 376221715Sdelphij v Invokes an editor to edit the current file being viewed. The 377161475Sdelphij editor is taken from the environment variable VISUAL if defined, 378221715Sdelphij or EDITOR if VISUAL is not defined, or defaults to "vi" if nei- 379221715Sdelphij ther VISUAL nor EDITOR is defined. See also the discussion of 38060786Sps LESSEDIT under the section on PROMPTS below. 38160786Sps 38260786Sps ! shell-command 383221715Sdelphij Invokes a shell to run the shell-command given. A percent sign 384221715Sdelphij (%) in the command is replaced by the name of the current file. 385161475Sdelphij A pound sign (#) is replaced by the name of the previously exam- 386221715Sdelphij ined file. "!!" repeats the last shell command. "!" with no 387221715Sdelphij shell command simply invokes a shell. On Unix systems, the 388221715Sdelphij shell is taken from the environment variable SHELL, or defaults 389221715Sdelphij to "sh". On MS-DOS and OS/2 systems, the shell is the normal 390161475Sdelphij command processor. 39160786Sps 39260786Sps | <m> shell-command 393221715Sdelphij <m> represents any mark letter. Pipes a section of the input 394221715Sdelphij file to the given shell command. The section of the file to be 395221715Sdelphij piped is between the first line on the current screen and the 396221715Sdelphij position marked by the letter. <m> may also be ^ or $ to indi- 397161475Sdelphij cate beginning or end of file respectively. If <m> is . or new- 398161475Sdelphij line, the current screen is piped. 39960786Sps 40060786Sps s filename 401221715Sdelphij Save the input to a file. This only works if the input is a 402161475Sdelphij pipe, not an ordinary file. 40360786Sps 404170256Sdelphij[1mOPTIONS[0m 405221715Sdelphij Command line options are described below. Most options may be changed 406170256Sdelphij while [4mless[24m is running, via the "-" command. 40789019Sps 408221715Sdelphij Most options may be given in one of two forms: either a dash followed 409221715Sdelphij by a single letter, or two dashes followed by a long option name. A 410221715Sdelphij long option name may be abbreviated as long as the abbreviation is 411161475Sdelphij unambiguous. For example, --quit-at-eof may be abbreviated --quit, but 412161475Sdelphij not --qui, since both --quit-at-eof and --quiet begin with --qui. Some 413221715Sdelphij long option names are in uppercase, such as --QUIT-AT-EOF, as distinct 414221715Sdelphij from --quit-at-eof. Such option names need only have their first let- 415221715Sdelphij ter capitalized; the remainder of the name may be in either case. For 416170256Sdelphij example, --Quit-at-eof is equivalent to --QUIT-AT-EOF. 41760786Sps 418161475Sdelphij Options are also taken from the environment variable "LESS". For exam- 419170256Sdelphij ple, to avoid typing "less -options ..." each time [4mless[24m is invoked, you 420170256Sdelphij might tell [4mcsh:[0m 42160786Sps 42260786Sps setenv LESS "-options" 42360786Sps 424170256Sdelphij or if you use [4msh:[0m 42560786Sps 42660786Sps LESS="-options"; export LESS 42760786Sps 428221715Sdelphij On MS-DOS, you don't need the quotes, but you should replace any per- 429161475Sdelphij cent signs in the options string by double percent signs. 43060786Sps 431221715Sdelphij The environment variable is parsed before the command line, so command 432221715Sdelphij line options override the LESS environment variable. If an option 433221715Sdelphij appears in the LESS variable, it can be reset to its default value on 434161475Sdelphij the command line by beginning the command line option with "-+". 43560786Sps 436221715Sdelphij For options like -P or -D which take a following string, a dollar sign 437221715Sdelphij ($) must be used to signal the end of the string. For example, to set 438221715Sdelphij two -D options on MS-DOS, you must have a dollar sign between them, 439161475Sdelphij like this: 44060786Sps 44160786Sps LESS="-Dn9.1$-Ds4.1" 44260786Sps 44360786Sps 44460786Sps -? or --help 445221715Sdelphij This option displays a summary of the commands accepted by [4mless[0m 446221715Sdelphij (the same as the h command). (Depending on how your shell 447221715Sdelphij interprets the question mark, it may be necessary to quote the 448161475Sdelphij question mark, thus: "-\?".) 44960786Sps 45060786Sps -a or --search-skip-screen 451221715Sdelphij By default, forward searches start at the top of the displayed 452221715Sdelphij screen and backwards searches start at the bottom of the dis- 453221715Sdelphij played screen (except for repeated searches invoked by the n or 454221715Sdelphij N commands, which start after or before the "target" line 455221715Sdelphij respectively; see the -j option for more about the target line). 456221715Sdelphij The -a option causes forward searches to instead start at the 457221715Sdelphij bottom of the screen and backward searches to start at the top 458221715Sdelphij of the screen, thus skipping all lines displayed on the screen. 45960786Sps 460221715Sdelphij -A or --SEARCH-SKIP-SCREEN 461221715Sdelphij Causes all forward searches (not just non-repeated searches) to 462221715Sdelphij start just after the target line, and all backward searches to 463221715Sdelphij start just before the target line. Thus, forward searches will 464221715Sdelphij skip part of the displayed screen (from the first line up to and 465221715Sdelphij including the target line). Similarly backwards searches will 466221715Sdelphij skip the displayed screen from the last line up to and including 467221715Sdelphij the target line. This was the default behavior in less versions 468221715Sdelphij prior to 441. 469221715Sdelphij 470170256Sdelphij -b[4mn[24m or --buffers=[4mn[0m 471191930Sdelphij Specifies the amount of buffer space [4mless[24m will use for each 472191930Sdelphij file, in units of kilobytes (1024 bytes). By default 64K of 473191930Sdelphij buffer space is used for each file (unless the file is a pipe; 474191930Sdelphij see the -B option). The -b option specifies instead that [4mn[0m 475170256Sdelphij kilobytes of buffer space should be used for each file. If [4mn[24m is 476191930Sdelphij -1, buffer space is unlimited; that is, the entire file can be 477173932Sdelphij read into memory. 47863128Sps 47960786Sps -B or --auto-buffers 480161475Sdelphij By default, when data is read from a pipe, buffers are allocated 481161475Sdelphij automatically as needed. If a large amount of data is read from 482191930Sdelphij the pipe, this can cause a large amount of memory to be allo- 483221715Sdelphij cated. The -B option disables this automatic allocation of buf- 484221715Sdelphij fers for pipes, so that only 64K (or the amount of space speci- 485221715Sdelphij fied by the -b option) is used for the pipe. Warning: use of -B 486221715Sdelphij can result in erroneous display, since only the most recently 487221715Sdelphij viewed part of the piped data is kept in memory; any earlier 488221715Sdelphij data is lost. 48960786Sps 49060786Sps -c or --clear-screen 491191930Sdelphij Causes full screen repaints to be painted from the top line 492191930Sdelphij down. By default, full screen repaints are done by scrolling 493161475Sdelphij from the bottom of the screen. 49460786Sps 49560786Sps -C or --CLEAR-SCREEN 496170256Sdelphij Same as -c, for compatibility with older versions of [4mless.[0m 49760786Sps 49860786Sps -d or --dumb 499161475Sdelphij The -d option suppresses the error message normally displayed if 500191930Sdelphij the terminal is dumb; that is, lacks some important capability, 501161475Sdelphij such as the ability to clear the screen or scroll backward. The 502191930Sdelphij -d option does not otherwise change the behavior of [4mless[24m on a 503128345Stjr dumb terminal. 50460786Sps 505170256Sdelphij -D[1mx[4m[22mcolor[24m or --color=[1mx[4m[22mcolor[0m 506170256Sdelphij [MS-DOS only] Sets the color of the text displayed. [1mx [22mis a sin- 507191930Sdelphij gle character which selects the type of text whose color is 508191930Sdelphij being set: n=normal, s=standout, d=bold, u=underlined, k=blink. 509191930Sdelphij [4mcolor[24m is a pair of numbers separated by a period. The first 510191930Sdelphij number selects the foreground color and the second selects the 511191930Sdelphij background color of the text. A single number [4mN[24m is the same as 512191930Sdelphij [4mN.M[24m, where [4mM[24m is the normal background color. 51360786Sps 514191930Sdelphij 515128345Stjr -e or --quit-at-eof 516191930Sdelphij Causes [4mless[24m to automatically exit the second time it reaches 517191930Sdelphij end-of-file. By default, the only way to exit [4mless[24m is via the 518161475Sdelphij "q" command. 51963128Sps 52089019Sps -E or --QUIT-AT-EOF 521170256Sdelphij Causes [4mless[24m to automatically exit the first time it reaches end- 522161475Sdelphij of-file. 52360786Sps 52463128Sps -f or --force 525161475Sdelphij Forces non-regular files to be opened. (A non-regular file is a 526191930Sdelphij directory or a device special file.) Also suppresses the warn- 527170256Sdelphij ing message when a binary file is opened. By default, [4mless[24m will 528170256Sdelphij refuse to open non-regular files. Note that some operating sys- 529170256Sdelphij tems will not allow directories to be read, even if -f is set. 53060786Sps 53160786Sps -F or --quit-if-one-screen 532170256Sdelphij Causes [4mless[24m to automatically exit if the entire file can be dis- 533161475Sdelphij played on the first screen. 53460786Sps 53560786Sps -g or --hilite-search 536191930Sdelphij Normally, [4mless[24m will highlight ALL strings which match the last 537191930Sdelphij search command. The -g option changes this behavior to high- 538191930Sdelphij light only the particular string which was found by the last 539170256Sdelphij search command. This can cause [4mless[24m to run somewhat faster than 540161475Sdelphij the default. 54160786Sps 54260786Sps -G or --HILITE-SEARCH 543191930Sdelphij The -G option suppresses all highlighting of strings found by 544161475Sdelphij search commands. 54560786Sps 546170256Sdelphij -h[4mn[24m or --max-back-scroll=[4mn[0m 547191930Sdelphij Specifies a maximum number of lines to scroll backward. If it 548170256Sdelphij is necessary to scroll backward more than [4mn[24m lines, the screen is 549161475Sdelphij repainted in a forward direction instead. (If the terminal does 550161475Sdelphij not have the ability to scroll backward, -h0 is implied.) 55160786Sps 55260786Sps -i or --ignore-case 553161475Sdelphij Causes searches to ignore case; that is, uppercase and lowercase 554191930Sdelphij are considered identical. This option is ignored if any upper- 555191930Sdelphij case letters appear in the search pattern; in other words, if a 556191930Sdelphij pattern contains uppercase letters, then that search does not 557161475Sdelphij ignore case. 55860786Sps 55960786Sps -I or --IGNORE-CASE 560191930Sdelphij Like -i, but searches ignore case even if the pattern contains 561161475Sdelphij uppercase letters. 56260786Sps 563170256Sdelphij -j[4mn[24m or --jump-target=[4mn[0m 564191930Sdelphij Specifies a line on the screen where the "target" line is to be 565191930Sdelphij positioned. The target line is the line specified by any com- 566191930Sdelphij mand to search for a pattern, jump to a line number, jump to a 567173932Sdelphij file percentage or jump to a tag. The screen line may be speci- 568191930Sdelphij fied by a number: the top line on the screen is 1, the next is 569173932Sdelphij 2, and so on. The number may be negative to specify a line rel- 570173932Sdelphij ative to the bottom of the screen: the bottom line on the screen 571191930Sdelphij is -1, the second to the bottom is -2, and so on. Alternately, 572191930Sdelphij the screen line may be specified as a fraction of the height of 573191930Sdelphij the screen, starting with a decimal point: .5 is in the middle 574191930Sdelphij of the screen, .3 is three tenths down from the first line, and 575191930Sdelphij so on. If the line is specified as a fraction, the actual line 576191930Sdelphij number is recalculated if the terminal window is resized, so 577191930Sdelphij that the target line remains at the specified fraction of the 578191930Sdelphij screen height. If any form of the -j option is used, forward 579191930Sdelphij searches begin at the line immediately after the target line, 580221715Sdelphij and backward searches begin at the target line, unless changed 581221715Sdelphij by -a or -A. For example, if "-j4" is used, the target line is 582221715Sdelphij the fourth line on the screen, so forward searches begin at the 583221715Sdelphij fifth line on the screen. 58460786Sps 58563128Sps -J or --status-column 586221715Sdelphij Displays a status column at the left edge of the screen. The 587221715Sdelphij status column shows the lines that matched the current search. 588221715Sdelphij The status column is also used if the -w or -W option is in 589161475Sdelphij effect. 59063128Sps 591170256Sdelphij -k[4mfilename[24m or --lesskey-file=[4mfilename[0m 592221715Sdelphij Causes [4mless[24m to open and interpret the named file as a [4mlesskey[0m 593161475Sdelphij (1) file. Multiple -k options may be specified. If the LESSKEY 594221715Sdelphij or LESSKEY_SYSTEM environment variable is set, or if a lesskey 595161475Sdelphij file is found in a standard place (see KEY BINDINGS), it is also 596170256Sdelphij used as a [4mlesskey[24m file. 59760786Sps 598161475Sdelphij -K or --quit-on-intr 599221715Sdelphij Causes [4mless[24m to exit immediately (with status 2) when an inter- 600221715Sdelphij rupt character (usually ^C) is typed. Normally, an interrupt 601221715Sdelphij character causes [4mless[24m to stop whatever it is doing and return to 602221715Sdelphij its command prompt. Note that use of this option makes it 603221715Sdelphij impossible to return to the command prompt from the "F" command. 604161475Sdelphij 605128345Stjr -L or --no-lessopen 606221715Sdelphij Ignore the LESSOPEN environment variable (see the INPUT PRE- 607221715Sdelphij PROCESSOR section below). This option can be set from within 608221715Sdelphij [4mless[24m, but it will apply only to files opened subsequently, not 609191930Sdelphij to the file which is currently open. 610128345Stjr 61160786Sps -m or --long-prompt 612221715Sdelphij Causes [4mless[24m to prompt verbosely (like [4mmore[24m), with the percent 613170256Sdelphij into the file. By default, [4mless[24m prompts with a colon. 61460786Sps 61560786Sps -M or --LONG-PROMPT 616170256Sdelphij Causes [4mless[24m to prompt even more verbosely than [4mmore.[0m 61760786Sps 61860786Sps -n or --line-numbers 619221715Sdelphij Suppresses line numbers. The default (to use line numbers) may 620221715Sdelphij cause [4mless[24m to run more slowly in some cases, especially with a 621221715Sdelphij very large input file. Suppressing line numbers with the -n 622221715Sdelphij option will avoid this problem. Using line numbers means: the 623161475Sdelphij line number will be displayed in the verbose prompt and in the = 624221715Sdelphij command, and the v command will pass the current line number to 625221715Sdelphij the editor (see also the discussion of LESSEDIT in PROMPTS 626161475Sdelphij below). 62760786Sps 628128345Stjr -N or --LINE-NUMBERS 629221715Sdelphij Causes a line number to be displayed at the beginning of each 630161475Sdelphij line in the display. 63160786Sps 632170256Sdelphij -o[4mfilename[24m or --log-file=[4mfilename[0m 633221715Sdelphij Causes [4mless[24m to copy its input to the named file as it is being 634161475Sdelphij viewed. This applies only when the input file is a pipe, not an 635221715Sdelphij ordinary file. If the file already exists, [4mless[24m will ask for 636161475Sdelphij confirmation before overwriting it. 63760786Sps 638170256Sdelphij -O[4mfilename[24m or --LOG-FILE=[4mfilename[0m 639161475Sdelphij The -O option is like -o, but it will overwrite an existing file 640161475Sdelphij without asking for confirmation. 64160786Sps 642221715Sdelphij If no log file has been specified, the -o and -O options can be 643221715Sdelphij used from within [4mless[24m to specify a log file. Without a file 644161475Sdelphij name, they will simply report the name of the log file. The "s" 645170256Sdelphij command is equivalent to specifying -o from within [4mless.[0m 64663128Sps 647170256Sdelphij -p[4mpattern[24m or --pattern=[4mpattern[0m 648221715Sdelphij The -p option on the command line is equivalent to specifying 649221715Sdelphij +/[4mpattern[24m; that is, it tells [4mless[24m to start at the first occur- 650170256Sdelphij rence of [4mpattern[24m in the file. 65163128Sps 652170256Sdelphij -P[4mprompt[24m or --prompt=[4mprompt[0m 653221715Sdelphij Provides a way to tailor the three prompt styles to your own 654161475Sdelphij preference. This option would normally be put in the LESS envi- 655170256Sdelphij ronment variable, rather than being typed in with each [4mless[24m com- 656161475Sdelphij mand. Such an option must either be the last option in the LESS 657221715Sdelphij variable, or be terminated by a dollar sign. -Ps followed by a 658221715Sdelphij string changes the default (short) prompt to that string. -Pm 659221715Sdelphij changes the medium (-m) prompt. -PM changes the long (-M) 660221715Sdelphij prompt. -Ph changes the prompt for the help screen. -P= 661221715Sdelphij changes the message printed by the = command. -Pw changes the 662221715Sdelphij message printed while waiting for data (in the F command). All 663221715Sdelphij prompt strings consist of a sequence of letters and special 664221715Sdelphij escape sequences. See the section on PROMPTS for more details. 66560786Sps 66660786Sps -q or --quiet or --silent 667191930Sdelphij Causes moderately "quiet" operation: the terminal bell is not 668161475Sdelphij rung if an attempt is made to scroll past the end of the file or 669161475Sdelphij before the beginning of the file. If the terminal has a "visual 670191930Sdelphij bell", it is used instead. The bell will be rung on certain 671191930Sdelphij other errors, such as typing an invalid character. The default 672161475Sdelphij is to ring the terminal bell in all such cases. 67360786Sps 674128345Stjr -Q or --QUIET or --SILENT 675191930Sdelphij Causes totally "quiet" operation: the terminal bell is never 676161475Sdelphij rung. 677128345Stjr 678128345Stjr -r or --raw-control-chars 679161475Sdelphij Causes "raw" control characters to be displayed. The default is 680191930Sdelphij to display control characters using the caret notation; for 681161475Sdelphij example, a control-A (octal 001) is displayed as "^A". Warning: 682170256Sdelphij when the -r option is used, [4mless[24m cannot keep track of the actual 683191930Sdelphij appearance of the screen (since this depends on how the screen 684161475Sdelphij responds to each type of control character). Thus, various dis- 685191930Sdelphij play problems may result, such as long lines being split in the 686161475Sdelphij wrong place. 68760786Sps 68863128Sps -R or --RAW-CONTROL-CHARS 689191930Sdelphij Like -r, but only ANSI "color" escape sequences are output in 690161475Sdelphij "raw" form. Unlike -r, the screen appearance is maintained cor- 691161475Sdelphij rectly in most cases. ANSI "color" escape sequences are 692161475Sdelphij sequences of the form: 69363128Sps 69463128Sps ESC [ ... m 69563128Sps 696191930Sdelphij where the "..." is zero or more color specification characters 697191930Sdelphij For the purpose of keeping track of screen appearance, ANSI 698191930Sdelphij color escape sequences are assumed to not move the cursor. You 699191930Sdelphij can make [4mless[24m think that characters other than "m" can end ANSI 700191930Sdelphij color escape sequences by setting the environment variable 701161475Sdelphij LESSANSIENDCHARS to the list of characters which can end a color 702191930Sdelphij escape sequence. And you can make [4mless[24m think that characters 703191930Sdelphij other than the standard ones may appear between the ESC and the 704191930Sdelphij m by setting the environment variable LESSANSIMIDCHARS to the 705161475Sdelphij list of characters which can appear. 70660786Sps 70760786Sps -s or --squeeze-blank-lines 708191930Sdelphij Causes consecutive blank lines to be squeezed into a single 709170256Sdelphij blank line. This is useful when viewing [4mnroff[24m output. 71060786Sps 71160786Sps -S or --chop-long-lines 712191930Sdelphij Causes lines longer than the screen width to be chopped rather 713191930Sdelphij than folded. That is, the portion of a long line that does not 714191930Sdelphij fit in the screen width is not shown. The default is to fold 715161475Sdelphij long lines; that is, display the remainder on the next line. 71660786Sps 717170256Sdelphij -t[4mtag[24m or --tag=[4mtag[0m 718161475Sdelphij The -t option, followed immediately by a TAG, will edit the file 719191930Sdelphij containing that tag. For this to work, tag information must be 720191930Sdelphij available; for example, there may be a file in the current 721170256Sdelphij directory called "tags", which was previously built by [4mctags[24m (1) 722161475Sdelphij or an equivalent command. If the environment variable LESSGLOB- 723191930Sdelphij ALTAGS is set, it is taken to be the name of a command compati- 724191930Sdelphij ble with [4mglobal[24m (1), and that command is executed to find the 725161475Sdelphij tag. (See http://www.gnu.org/software/global/global.html). The 726191930Sdelphij -t option may also be specified from within [4mless[24m (using the - 727191930Sdelphij command) as a way of examining a new file. The command ":t" is 728170256Sdelphij equivalent to specifying -t from within [4mless.[0m 72960786Sps 730170256Sdelphij -T[4mtagsfile[24m or --tag-file=[4mtagsfile[0m 73189019Sps Specifies a tags file to be used instead of "tags". 73260786Sps 73389019Sps -u or --underline-special 734191930Sdelphij Causes backspaces and carriage returns to be treated as print- 735191930Sdelphij able characters; that is, they are sent to the terminal when 736161475Sdelphij they appear in the input. 73760786Sps 73889019Sps -U or --UNDERLINE-SPECIAL 739191930Sdelphij Causes backspaces, tabs and carriage returns to be treated as 740191930Sdelphij control characters; that is, they are handled as specified by 741161475Sdelphij the -r option. 74260786Sps 743191930Sdelphij By default, if neither -u nor -U is given, backspaces which 744191930Sdelphij appear adjacent to an underscore character are treated spe- 745191930Sdelphij cially: the underlined text is displayed using the terminal's 746191930Sdelphij hardware underlining capability. Also, backspaces which appear 747191930Sdelphij between two identical characters are treated specially: the 748191930Sdelphij overstruck text is printed using the terminal's hardware bold- 749191930Sdelphij face capability. Other backspaces are deleted, along with the 750161475Sdelphij preceding character. Carriage returns immediately followed by a 751191930Sdelphij newline are deleted. other carriage returns are handled as 752191930Sdelphij specified by the -r option. Text which is overstruck or under- 753161475Sdelphij lined can be searched for if neither -u nor -U is in effect. 75460786Sps 75560786Sps -V or --version 756170256Sdelphij Displays the version number of [4mless.[0m 75760786Sps 75860786Sps -w or --hilite-unread 759191930Sdelphij Temporarily highlights the first "new" line after a forward 760161475Sdelphij movement of a full page. The first "new" line is the line imme- 761191930Sdelphij diately following the line previously at the bottom of the 762161475Sdelphij screen. Also highlights the target line after a g or p command. 763191930Sdelphij The highlight is removed at the next command which causes move- 764191930Sdelphij ment. The entire line is highlighted, unless the -J option is 765221715Sdelphij in effect, in which case only the status column is highlighted. 76660786Sps 76760786Sps -W or --HILITE-UNREAD 768161475Sdelphij Like -w, but temporarily highlights the first new line after any 769161475Sdelphij forward movement command larger than one line. 77060786Sps 771170256Sdelphij -x[4mn[24m,... or --tabs=[4mn[24m,... 772221715Sdelphij Sets tab stops. If only one [4mn[24m is specified, tab stops are set 773221715Sdelphij at multiples of [4mn[24m. If multiple values separated by commas are 774221715Sdelphij specified, tab stops are set at those positions, and then con- 775221715Sdelphij tinue with the same spacing as the last two. For example, 776221715Sdelphij [4m-x9,17[24m will set tabs at positions 9, 17, 25, 33, etc. The 777170256Sdelphij default for [4mn[24m is 8. 77860786Sps 77989019Sps -X or --no-init 780161475Sdelphij Disables sending the termcap initialization and deinitialization 781221715Sdelphij strings to the terminal. This is sometimes desirable if the 782221715Sdelphij deinitialization string does something unnecessary, like clear- 783161475Sdelphij ing the screen. 78460786Sps 785170256Sdelphij -y[4mn[24m or --max-forw-scroll=[4mn[0m 786161475Sdelphij Specifies a maximum number of lines to scroll forward. If it is 787221715Sdelphij necessary to scroll forward more than [4mn[24m lines, the screen is 788221715Sdelphij repainted instead. The -c or -C option may be used to repaint 789221715Sdelphij from the top of the screen if desired. By default, any forward 79089019Sps movement causes scrolling. 79160786Sps 792170256Sdelphij -[z][4mn[24m or --window=[4mn[0m 793221715Sdelphij Changes the default scrolling window size to [4mn[24m lines. The 794161475Sdelphij default is one screenful. The z and w commands can also be used 795221715Sdelphij to change the window size. The "z" may be omitted for compati- 796170256Sdelphij bility with some versions of [4mmore.[24m If the number [4mn[24m is negative, 797221715Sdelphij it indicates [4mn[24m lines less than the current screen size. For 798170256Sdelphij example, if the screen is 24 lines, [4m-z-4[24m sets the scrolling win- 799221715Sdelphij dow to 20 lines. If the screen is resized to 40 lines, the 800170256Sdelphij scrolling window automatically changes to 36 lines. 80163128Sps 802170256Sdelphij -[4m"cc[24m or --quotes=[4mcc[0m 803221715Sdelphij Changes the filename quoting character. This may be necessary 804221715Sdelphij if you are trying to name a file which contains both spaces and 805221715Sdelphij quote characters. Followed by a single character, this changes 806221715Sdelphij the quote character to that character. Filenames containing a 807161475Sdelphij space should then be surrounded by that character rather than by 808221715Sdelphij double quotes. Followed by two characters, changes the open 809221715Sdelphij quote to the first character, and the close quote to the second 810161475Sdelphij character. Filenames containing a space should then be preceded 811221715Sdelphij by the open quote character and followed by the close quote 812221715Sdelphij character. Note that even after the quote characters are 813221715Sdelphij changed, this option remains -" (a dash followed by a double 814161475Sdelphij quote). 81560786Sps 816128345Stjr -~ or --tilde 817161475Sdelphij Normally lines after end of file are displayed as a single tilde 818161475Sdelphij (~). This option causes lines after end of file to be displayed 819161475Sdelphij as blank lines. 82060786Sps 82163128Sps -# or --shift 822161475Sdelphij Specifies the default number of positions to scroll horizontally 823221715Sdelphij in the RIGHTARROW and LEFTARROW commands. If the number speci- 824221715Sdelphij fied is zero, it sets the default number of positions to one 825195941Sdelphij half of the screen width. Alternately, the number may be speci- 826221715Sdelphij fied as a fraction of the width of the screen, starting with a 827221715Sdelphij decimal point: .5 is half of the screen width, .3 is three 828221715Sdelphij tenths of the screen width, and so on. If the number is speci- 829221715Sdelphij fied as a fraction, the actual number of scroll positions is 830221715Sdelphij recalculated if the terminal window is resized, so that the 831221715Sdelphij actual scroll remains at the specified fraction of the screen 832195941Sdelphij width. 83363128Sps 834173682Sdelphij --no-keypad 835221715Sdelphij Disables sending the keypad initialization and deinitialization 836173682Sdelphij strings to the terminal. This is sometimes useful if the keypad 837173682Sdelphij strings make the numeric keypad behave in an undesirable manner. 838173682Sdelphij 839173682Sdelphij --follow-name 840195941Sdelphij Normally, if the input file is renamed while an F command is 841195941Sdelphij executing, [4mless[24m will continue to display the contents of the 842195941Sdelphij original file despite its name change. If --follow-name is 843173682Sdelphij specified, during an F command [4mless[24m will periodically attempt to 844173682Sdelphij reopen the file by name. If the reopen succeeds and the file is 845195941Sdelphij a different file from the original (which means that a new file 846195941Sdelphij has been created with the same name as the original (now 847173682Sdelphij renamed) file), [4mless[24m will display the contents of that new file. 848173682Sdelphij 849221715Sdelphij -- A command line argument of "--" marks the end of option argu- 850221715Sdelphij ments. Any arguments following this are interpreted as file- 851161475Sdelphij names. This can be useful when viewing a file whose name begins 852161475Sdelphij with a "-" or "+". 85360786Sps 854221715Sdelphij + If a command line option begins with [1m+[22m, the remainder of that 855221715Sdelphij option is taken to be an initial command to [4mless.[24m For example, 856221715Sdelphij +G tells [4mless[24m to start at the end of the file rather than the 857221715Sdelphij beginning, and +/xyz tells it to start at the first occurrence 858221715Sdelphij of "xyz" in the file. As a special case, +<number> acts like 859161475Sdelphij +<number>g; that is, it starts the display at the specified line 860221715Sdelphij number (however, see the caveat under the "g" command above). 861221715Sdelphij If the option starts with ++, the initial command applies to 862221715Sdelphij every file being viewed, not just the first one. The + command 863161475Sdelphij described previously may also be used to set (or change) an ini- 864161475Sdelphij tial command for every file. 86560786Sps 86660786Sps 867170256Sdelphij[1mLINE EDITING[0m 868221715Sdelphij When entering command line at the bottom of the screen (for example, a 869170256Sdelphij filename for the :e command, or the pattern for a search command), cer- 870221715Sdelphij tain keys can be used to manipulate the command line. Most commands 871221715Sdelphij have an alternate form in [ brackets ] which can be used if a key does 872221715Sdelphij not exist on a particular keyboard. (Note that the forms beginning 873221715Sdelphij with ESC do not work in some MS-DOS and Windows systems because ESC is 874221715Sdelphij the line erase character.) Any of these special keys may be entered 875221715Sdelphij literally by preceding it with the "literal" character, either ^V or 876221715Sdelphij ^A. A backslash itself may also be entered literally by entering two 877191930Sdelphij backslashes. 87860786Sps 87963128Sps LEFTARROW [ ESC-h ] 88063128Sps Move the cursor one space to the left. 88160786Sps 882128345Stjr RIGHTARROW [ ESC-l ] 883128345Stjr Move the cursor one space to the right. 88489019Sps 885128345Stjr ^LEFTARROW [ ESC-b or ESC-LEFTARROW ] 886221715Sdelphij (That is, CONTROL and LEFTARROW simultaneously.) Move the cur- 887161475Sdelphij sor one word to the left. 88889019Sps 889128345Stjr ^RIGHTARROW [ ESC-w or ESC-RIGHTARROW ] 890161475Sdelphij (That is, CONTROL and RIGHTARROW simultaneously.) Move the cur- 891161475Sdelphij sor one word to the right. 89260786Sps 89360786Sps HOME [ ESC-0 ] 89460786Sps Move the cursor to the beginning of the line. 89560786Sps 89660786Sps END [ ESC-$ ] 89760786Sps Move the cursor to the end of the line. 89860786Sps 89960786Sps BACKSPACE 900221715Sdelphij Delete the character to the left of the cursor, or cancel the 901161475Sdelphij command if the command line is empty. 90260786Sps 90360786Sps DELETE or [ ESC-x ] 90460786Sps Delete the character under the cursor. 90560786Sps 90660786Sps ^BACKSPACE [ ESC-BACKSPACE ] 907221715Sdelphij (That is, CONTROL and BACKSPACE simultaneously.) Delete the 908161475Sdelphij word to the left of the cursor. 90960786Sps 91060786Sps ^DELETE [ ESC-X or ESC-DELETE ] 911221715Sdelphij (That is, CONTROL and DELETE simultaneously.) Delete the word 912161475Sdelphij under the cursor. 91360786Sps 91463128Sps UPARROW [ ESC-k ] 91563128Sps Retrieve the previous command line. 91660786Sps 91763128Sps DOWNARROW [ ESC-j ] 91863128Sps Retrieve the next command line. 91960786Sps 920221715Sdelphij TAB Complete the partial filename to the left of the cursor. If it 921221715Sdelphij matches more than one filename, the first match is entered into 922221715Sdelphij the command line. Repeated TABs will cycle thru the other 923161475Sdelphij matching filenames. If the completed filename is a directory, a 924221715Sdelphij "/" is appended to the filename. (On MS-DOS systems, a "\" is 925221715Sdelphij appended.) The environment variable LESSSEPARATOR can be used 926221715Sdelphij to specify a different character to append to a directory name. 92760786Sps 92863128Sps BACKTAB [ ESC-TAB ] 929161475Sdelphij Like, TAB, but cycles in the reverse direction thru the matching 930161475Sdelphij filenames. 93160786Sps 932195941Sdelphij ^L Complete the partial filename to the left of the cursor. If it 933161475Sdelphij matches more than one filename, all matches are entered into the 934161475Sdelphij command line (if they fit). 93560786Sps 936128345Stjr ^U (Unix and OS/2) or ESC (MS-DOS) 937195941Sdelphij Delete the entire command line, or cancel the command if the 938161475Sdelphij command line is empty. If you have changed your line-kill char- 939161475Sdelphij acter in Unix to something other than ^U, that character is used 940161475Sdelphij instead of ^U. 941128345Stjr 942221715Sdelphij ^G Delete the entire command line and return to the main prompt. 943128345Stjr 944221715Sdelphij 945170256Sdelphij[1mKEY BINDINGS[0m 946195941Sdelphij You may define your own [4mless[24m commands by using the program [4mlesskey[24m (1) 947195941Sdelphij to create a lesskey file. This file specifies a set of command keys 948195941Sdelphij and an action associated with each key. You may also use [4mlesskey[24m to 949161475Sdelphij change the line-editing keys (see LINE EDITING), and to set environment 950195941Sdelphij variables. If the environment variable LESSKEY is set, [4mless[24m uses that 951195941Sdelphij as the name of the lesskey file. Otherwise, [4mless[24m looks in a standard 952195941Sdelphij place for the lesskey file: On Unix systems, [4mless[24m looks for a lesskey 953195941Sdelphij file called "$HOME/.less". On MS-DOS and Windows systems, [4mless[24m looks 954195941Sdelphij for a lesskey file called "$HOME/_less", and if it is not found there, 955161475Sdelphij then looks for a lesskey file called "_less" in any directory specified 956195941Sdelphij in the PATH environment variable. On OS/2 systems, [4mless[24m looks for a 957195941Sdelphij lesskey file called "$HOME/less.ini", and if it is not found, then 958195941Sdelphij looks for a lesskey file called "less.ini" in any directory specified 959161475Sdelphij in the INIT environment variable, and if it not found there, then looks 960195941Sdelphij for a lesskey file called "less.ini" in any directory specified in the 961195941Sdelphij PATH environment variable. See the [4mlesskey[24m manual page for more 962161475Sdelphij details. 96360786Sps 964195941Sdelphij A system-wide lesskey file may also be set up to provide key bindings. 965161475Sdelphij If a key is defined in both a local lesskey file and in the system-wide 966195941Sdelphij file, key bindings in the local file take precedence over those in the 967195941Sdelphij system-wide file. If the environment variable LESSKEY_SYSTEM is set, 968170256Sdelphij [4mless[24m uses that as the name of the system-wide lesskey file. Otherwise, 969195941Sdelphij [4mless[24m looks in a standard place for the system-wide lesskey file: On 970195941Sdelphij Unix systems, the system-wide lesskey file is /usr/local/etc/sysless. 971195941Sdelphij (However, if [4mless[24m was built with a different sysconf directory than 972161475Sdelphij /usr/local/etc, that directory is where the sysless file is found.) On 973195941Sdelphij MS-DOS and Windows systems, the system-wide lesskey file is c:\_sys- 974161475Sdelphij less. On OS/2 systems, the system-wide lesskey file is c:\sysless.ini. 97560786Sps 97660786Sps 977170256Sdelphij[1mINPUT PREPROCESSOR[0m 978221715Sdelphij You may define an "input preprocessor" for [4mless.[24m Before [4mless[24m opens a 979161475Sdelphij file, it first gives your input preprocessor a chance to modify the way 980221715Sdelphij the contents of the file are displayed. An input preprocessor is sim- 981221715Sdelphij ply an executable program (or shell script), which writes the contents 982161475Sdelphij of the file to a different file, called the replacement file. The con- 983221715Sdelphij tents of the replacement file are then displayed in place of the con- 984221715Sdelphij tents of the original file. However, it will appear to the user as if 985221715Sdelphij the original file is opened; that is, [4mless[24m will display the original 986161475Sdelphij filename as the name of the current file. 98760786Sps 988221715Sdelphij An input preprocessor receives one command line argument, the original 989221715Sdelphij filename, as entered by the user. It should create the replacement 990221715Sdelphij file, and when finished, print the name of the replacement file to its 991221715Sdelphij standard output. If the input preprocessor does not output a replace- 992221715Sdelphij ment filename, [4mless[24m uses the original file, as normal. The input pre- 993221715Sdelphij processor is not called when viewing standard input. To set up an 994221715Sdelphij input preprocessor, set the LESSOPEN environment variable to a command 995221715Sdelphij line which will invoke your input preprocessor. This command line 996221715Sdelphij should include one occurrence of the string "%s", which will be 997221715Sdelphij replaced by the filename when the input preprocessor command is 99889019Sps invoked. 99989019Sps 1000170256Sdelphij When [4mless[24m closes a file opened in such a way, it will call another pro- 1001221715Sdelphij gram, called the input postprocessor, which may perform any desired 1002221715Sdelphij clean-up action (such as deleting the replacement file created by 1003161475Sdelphij LESSOPEN). This program receives two command line arguments, the orig- 1004221715Sdelphij inal filename as entered by the user, and the name of the replacement 1005221715Sdelphij file. To set up an input postprocessor, set the LESSCLOSE environment 1006221715Sdelphij variable to a command line which will invoke your input postprocessor. 1007221715Sdelphij It may include two occurrences of the string "%s"; the first is 1008221715Sdelphij replaced with the original name of the file and the second with the 1009161475Sdelphij name of the replacement file, which was output by LESSOPEN. 101060786Sps 1011221715Sdelphij For example, on many Unix systems, these two scripts will allow you to 1012170256Sdelphij keep files in compressed format, but still let [4mless[24m view them directly: 101360786Sps 101460786Sps lessopen.sh: 101560786Sps #! /bin/sh 101660786Sps case "$1" in 1017161475Sdelphij *.Z) uncompress - 101860786Sps if [ -s /tmp/less.$$ ]; then 101960786Sps echo /tmp/less.$$ 102060786Sps else 102160786Sps rm -f /tmp/less.$$ 102260786Sps fi 102360786Sps ;; 102460786Sps esac 102560786Sps 102660786Sps lessclose.sh: 102760786Sps #! /bin/sh 102860786Sps rm $2 102960786Sps 1030195941Sdelphij To use these scripts, put them both where they can be executed and set 1031161475Sdelphij LESSOPEN="lessopen.sh %s", and LESSCLOSE="lessclose.sh %s %s". More 1032195941Sdelphij complex LESSOPEN and LESSCLOSE scripts may be written to accept other 1033161475Sdelphij types of compressed files, and so on. 103460786Sps 1035195941Sdelphij It is also possible to set up an input preprocessor to pipe the file 1036195941Sdelphij data directly to [4mless,[24m rather than putting the data into a replacement 1037161475Sdelphij file. This avoids the need to decompress the entire file before start- 1038161475Sdelphij ing to view it. An input preprocessor that works this way is called an 1039195941Sdelphij input pipe. An input pipe, instead of writing the name of a replace- 1040195941Sdelphij ment file on its standard output, writes the entire contents of the 1041195941Sdelphij replacement file on its standard output. If the input pipe does not 1042195941Sdelphij write any characters on its standard output, then there is no replace- 1043195941Sdelphij ment file and [4mless[24m uses the original file, as normal. To use an input 1044195941Sdelphij pipe, make the first character in the LESSOPEN environment variable a 1045195941Sdelphij vertical bar (|) to signify that the input preprocessor is an input 1046161475Sdelphij pipe. 104789019Sps 1048195941Sdelphij For example, on many Unix systems, this script will work like the pre- 1049161475Sdelphij vious example scripts: 105089019Sps 105160786Sps lesspipe.sh: 105260786Sps #! /bin/sh 105360786Sps case "$1" in 105460786Sps *.Z) uncompress -c $1 2>/dev/null 105560786Sps ;; 105660786Sps esac 105760786Sps 1058161475Sdelphij To use this script, put it where it can be executed and set 1059195941Sdelphij LESSOPEN="|lesspipe.sh %s". When an input pipe is used, a LESSCLOSE 1060195941Sdelphij postprocessor can be used, but it is usually not necessary since there 1061161475Sdelphij is no replacement file to clean up. In this case, the replacement file 1062161475Sdelphij name passed to the LESSCLOSE postprocessor is "-". 106360786Sps 1064195941Sdelphij For compatibility with previous versions of [4mless,[24m the input preproces- 1065195941Sdelphij sor or pipe is not used if [4mless[24m is viewing standard input. However, if 1066195941Sdelphij the first character of LESSOPEN is a dash (-), the input preprocessor 1067195941Sdelphij is used on standard input as well as other files. In this case, the 1068195941Sdelphij dash is not considered to be part of the preprocessor command. If 1069195941Sdelphij standard input is being viewed, the input preprocessor is passed a file 1070195941Sdelphij name consisting of a single dash. Similarly, if the first two charac- 1071195941Sdelphij ters of LESSOPEN are vertical bar and dash (|-), the input pipe is used 1072195941Sdelphij on standard input as well as other files. Again, in this case the dash 1073195941Sdelphij is not considered to be part of the input pipe command. 107460786Sps 1075191930Sdelphij 1076170256Sdelphij[1mNATIONAL CHARACTER SETS[0m 107760786Sps There are three types of characters in the input file: 107860786Sps 107960786Sps normal characters 108060786Sps can be displayed directly to the screen. 108160786Sps 108260786Sps control characters 1083195941Sdelphij should not be displayed directly, but are expected to be found 1084161475Sdelphij in ordinary text files (such as backspace and tab). 108560786Sps 108660786Sps binary characters 1087195941Sdelphij should not be displayed directly and are not expected to be 1088161475Sdelphij found in text files. 108960786Sps 1090161475Sdelphij A "character set" is simply a description of which characters are to be 1091195941Sdelphij considered normal, control, and binary. The LESSCHARSET environment 1092195941Sdelphij variable may be used to select a character set. Possible values for 1093161475Sdelphij LESSCHARSET are: 109460786Sps 1095195941Sdelphij ascii BS, TAB, NL, CR, and formfeed are control characters, all chars 1096195941Sdelphij with values between 32 and 126 are normal, and all others are 1097161475Sdelphij binary. 109860786Sps 109989019Sps iso8859 1100195941Sdelphij Selects an ISO 8859 character set. This is the same as ASCII, 1101195941Sdelphij except characters between 160 and 255 are treated as normal 1102161475Sdelphij characters. 110360786Sps 110489019Sps latin1 Same as iso8859. 110560786Sps 110689019Sps latin9 Same as iso8859. 110760786Sps 110889019Sps dos Selects a character set appropriate for MS-DOS. 110960786Sps 111089019Sps ebcdic Selects an EBCDIC character set. 111160786Sps 111289019Sps IBM-1047 1113195941Sdelphij Selects an EBCDIC character set used by OS/390 Unix Services. 1114195941Sdelphij This is the EBCDIC analogue of latin1. You get similar results 1115161475Sdelphij by setting either LESSCHARSET=IBM-1047 or LC_CTYPE=en_US in your 1116161475Sdelphij environment. 111760786Sps 111889019Sps koi8-r Selects a Russian character set. 111960786Sps 1120161475Sdelphij next Selects a character set appropriate for NeXT computers. 112189019Sps 1122195941Sdelphij utf-8 Selects the UTF-8 encoding of the ISO 10646 character set. 1123195941Sdelphij UTF-8 is special in that it supports multi-byte characters in 1124195941Sdelphij the input file. It is the only character set that supports 1125170256Sdelphij multi-byte characters. 112689019Sps 1127161475Sdelphij windows 1128195941Sdelphij Selects a character set appropriate for Microsoft Windows (cp 1129161475Sdelphij 1251). 113060786Sps 1131195941Sdelphij In rare cases, it may be desired to tailor [4mless[24m to use a character set 1132195941Sdelphij other than the ones definable by LESSCHARSET. In this case, the envi- 1133191930Sdelphij ronment variable LESSCHARDEF can be used to define a character set. It 1134191930Sdelphij should be set to a string where each character in the string represents 1135195941Sdelphij one character in the character set. The character "." is used for a 1136195941Sdelphij normal character, "c" for control, and "b" for binary. A decimal num- 1137195941Sdelphij ber may be used for repetition. For example, "bccc4b." would mean 1138195941Sdelphij character 0 is binary, 1, 2 and 3 are control, 4, 5, 6 and 7 are 1139161475Sdelphij binary, and 8 is normal. All characters after the last are taken to be 1140195941Sdelphij the same as the last, so characters 9 through 255 would be normal. 1141195941Sdelphij (This is an example, and does not necessarily represent any real char- 1142161475Sdelphij acter set.) 114360786Sps 1144195941Sdelphij This table shows the value of LESSCHARDEF which is equivalent to each 1145161475Sdelphij of the possible values for LESSCHARSET: 114689019Sps 1147128345Stjr ascii 8bcccbcc18b95.b 1148128345Stjr dos 8bcccbcc12bc5b95.b. 1149128345Stjr ebcdic 5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b 1150128345Stjr 9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b. 1151128345Stjr IBM-1047 4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc 1152128345Stjr 191.b 1153128345Stjr iso8859 8bcccbcc18b95.33b. 1154128345Stjr koi8-r 8bcccbcc18b95.b128. 115560786Sps latin1 8bcccbcc18b95.33b. 115660786Sps next 8bcccbcc18b95.bb125.bb 115760786Sps 1158195941Sdelphij If neither LESSCHARSET nor LESSCHARDEF is set, but any of the strings 1159222906Sdelphij "UTF-8", "UTF8", "utf-8" or "utf8" is found in the LC_ALL, LC_CTYPE or 1160161475Sdelphij LANG environment variables, then the default character set is utf-8. 116160786Sps 1162195941Sdelphij If that string is not found, but your system supports the [4msetlocale[0m 1163195941Sdelphij interface, [4mless[24m will use setlocale to determine the character set. 1164195941Sdelphij setlocale is controlled by setting the LANG or LC_CTYPE environment 1165161475Sdelphij variables. 116689019Sps 1167195941Sdelphij Finally, if the [4msetlocale[24m interface is also not available, the default 1168161475Sdelphij character set is latin1. 116989019Sps 1170195941Sdelphij Control and binary characters are displayed in standout (reverse 1171161475Sdelphij video). Each such character is displayed in caret notation if possible 1172195941Sdelphij (e.g. ^A for control-A). Caret notation is used only if inverting the 1173161475Sdelphij 0100 bit results in a normal printable character. Otherwise, the char- 1174195941Sdelphij acter is displayed as a hex number in angle brackets. This format can 1175195941Sdelphij be changed by setting the LESSBINFMT environment variable. LESSBINFMT 1176161475Sdelphij may begin with a "*" and one character to select the display attribute: 1177195941Sdelphij "*k" is blinking, "*d" is bold, "*u" is underlined, "*s" is standout, 1178195941Sdelphij and "*n" is normal. If LESSBINFMT does not begin with a "*", normal 1179195941Sdelphij attribute is assumed. The remainder of LESSBINFMT is a string which 1180195941Sdelphij may include one printf-style escape sequence (a % followed by x, X, o, 1181195941Sdelphij d, etc.). For example, if LESSBINFMT is "*u[%x]", binary characters 1182195941Sdelphij are displayed in underlined hexadecimal surrounded by brackets. The 1183221715Sdelphij default if no LESSBINFMT is specified is "*s<%02X>". Warning: the 1184221715Sdelphij result of expanding the character via LESSBINFMT must be less than 31 1185221715Sdelphij characters. 118660786Sps 1187161475Sdelphij When the character set is utf-8, the LESSUTFBINFMT environment variable 1188161475Sdelphij acts similarly to LESSBINFMT but it applies to Unicode code points that 1189195941Sdelphij were successfully decoded but are unsuitable for display (e.g., unas- 1190195941Sdelphij signed code points). Its default value is "<U+%04lX>". Note that 1191195941Sdelphij LESSUTFBINFMT and LESSBINFMT share their display attribute setting 1192195941Sdelphij ("*x") so specifying one will affect both; LESSUTFBINFMT is read after 1193195941Sdelphij LESSBINFMT so its setting, if any, will have priority. Problematic 1194195941Sdelphij octets in a UTF-8 file (octets of a truncated sequence, octets of a 1195195941Sdelphij complete but non-shortest form sequence, illegal octets, and stray 1196195941Sdelphij trailing octets) are displayed individually using LESSBINFMT so as to 1197161475Sdelphij facilitate diagnostic of how the UTF-8 file is ill-formed. 119860786Sps 1199161475Sdelphij 1200170256Sdelphij[1mPROMPTS[0m 1201195941Sdelphij The -P option allows you to tailor the prompt to your preference. The 1202195941Sdelphij string given to the -P option replaces the specified prompt string. 1203161475Sdelphij Certain characters in the string are interpreted specially. The prompt 1204195941Sdelphij mechanism is rather complicated to provide flexibility, but the ordi- 1205195941Sdelphij nary user need not understand the details of constructing personalized 1206161475Sdelphij prompt strings. 120760786Sps 1208195941Sdelphij A percent sign followed by a single character is expanded according to 1209161475Sdelphij what the following character is: 121060786Sps 1211195941Sdelphij %b[4mX[24m Replaced by the byte offset into the current input file. The b 1212170256Sdelphij is followed by a single character (shown as [4mX[24m above) which spec- 1213195941Sdelphij ifies the line whose byte offset is to be used. If the charac- 1214195941Sdelphij ter is a "t", the byte offset of the top line in the display is 1215173932Sdelphij used, an "m" means use the middle line, a "b" means use the bot- 1216195941Sdelphij tom line, a "B" means use the line just after the bottom line, 1217195941Sdelphij and a "j" means use the "target" line, as specified by the -j 1218173932Sdelphij option. 121960786Sps 122060786Sps %B Replaced by the size of the current input file. 122160786Sps 1222161475Sdelphij %c Replaced by the column number of the text appearing in the first 1223161475Sdelphij column of the screen. 122460786Sps 1225195941Sdelphij %d[4mX[24m Replaced by the page number of a line in the input file. The 1226170256Sdelphij line to be used is determined by the [4mX[24m, as with the %b option. 122760786Sps 1228195941Sdelphij %D Replaced by the number of pages in the input file, or equiva- 1229161475Sdelphij lently, the page number of the last line in the input file. 123060786Sps 1231195941Sdelphij %E Replaced by the name of the editor (from the VISUAL environment 1232195941Sdelphij variable, or the EDITOR environment variable if VISUAL is not 1233161475Sdelphij defined). See the discussion of the LESSEDIT feature below. 123460786Sps 123560786Sps %f Replaced by the name of the current input file. 123660786Sps 1237221715Sdelphij %F Replaced by the last component of the name of the current input 1238221715Sdelphij file. 1239221715Sdelphij 1240221715Sdelphij %i Replaced by the index of the current file in the list of input 1241161475Sdelphij files. 124260786Sps 1243221715Sdelphij %l[4mX[24m Replaced by the line number of a line in the input file. The 1244170256Sdelphij line to be used is determined by the [4mX[24m, as with the %b option. 124560786Sps 1246221715Sdelphij %L Replaced by the line number of the last line in the input file. 124760786Sps 124860786Sps %m Replaced by the total number of input files. 124960786Sps 1250195941Sdelphij %p[4mX[24m Replaced by the percent into the current input file, based on 1251195941Sdelphij byte offsets. The line used is determined by the [4mX[24m as with the 1252161475Sdelphij %b option. 125360786Sps 1254195941Sdelphij %P[4mX[24m Replaced by the percent into the current input file, based on 1255195941Sdelphij line numbers. The line used is determined by the [4mX[24m as with the 1256161475Sdelphij %b option. 125760786Sps 125889019Sps %s Same as %B. 125960786Sps 1260195941Sdelphij %t Causes any trailing spaces to be removed. Usually used at the 1261161475Sdelphij end of the string, but may appear anywhere. 126260786Sps 1263161475Sdelphij %x Replaced by the name of the next input file in the list. 126460786Sps 1265161475Sdelphij If any item is unknown (for example, the file size if input is a pipe), 1266161475Sdelphij a question mark is printed instead. 126760786Sps 1268195941Sdelphij The format of the prompt string can be changed depending on certain 1269195941Sdelphij conditions. A question mark followed by a single character acts like 1270195941Sdelphij an "IF": depending on the following character, a condition is evalu- 1271195941Sdelphij ated. If the condition is true, any characters following the question 1272195941Sdelphij mark and condition character, up to a period, are included in the 1273195941Sdelphij prompt. If the condition is false, such characters are not included. 1274195941Sdelphij A colon appearing between the question mark and the period can be used 1275161475Sdelphij to establish an "ELSE": any characters between the colon and the period 1276195941Sdelphij are included in the string if and only if the IF condition is false. 1277161475Sdelphij Condition characters (which follow a question mark) may be: 127860786Sps 1279221715Sdelphij ?a True if any characters have been included in the prompt so far. 128060786Sps 1281170256Sdelphij ?b[4mX[24m True if the byte offset of the specified line is known. 128260786Sps 128360786Sps ?B True if the size of current input file is known. 128460786Sps 1285161475Sdelphij ?c True if the text is horizontally shifted (%c is not zero). 128660786Sps 1287170256Sdelphij ?d[4mX[24m True if the page number of the specified line is known. 128860786Sps 128960786Sps ?e True if at end-of-file. 129060786Sps 1291221715Sdelphij ?f True if there is an input filename (that is, if input is not a 1292161475Sdelphij pipe). 129360786Sps 1294170256Sdelphij ?l[4mX[24m True if the line number of the specified line is known. 129563128Sps 1296161475Sdelphij ?L True if the line number of the last line in the file is known. 129763128Sps 129889019Sps ?m True if there is more than one input file. 129963128Sps 1300161475Sdelphij ?n True if this is the first prompt in a new input file. 130163128Sps 1302221715Sdelphij ?p[4mX[24m True if the percent into the current input file, based on byte 1303161475Sdelphij offsets, of the specified line is known. 130463128Sps 1305221715Sdelphij ?P[4mX[24m True if the percent into the current input file, based on line 1306161475Sdelphij numbers, of the specified line is known. 130763128Sps 1308128345Stjr ?s Same as "?B". 130960786Sps 1310221715Sdelphij ?x True if there is a next input file (that is, if the current 1311161475Sdelphij input file is not the last one). 131260786Sps 1313221715Sdelphij Any characters other than the special ones (question mark, colon, 1314221715Sdelphij period, percent, and backslash) become literally part of the prompt. 1315221715Sdelphij Any of the special characters may be included in the prompt literally 1316161475Sdelphij by preceding it with a backslash. 131760786Sps 131860786Sps Some examples: 131960786Sps 132060786Sps ?f%f:Standard input. 132160786Sps 1322221715Sdelphij This prompt prints the filename, if known; otherwise the string "Stan- 1323161475Sdelphij dard input". 132460786Sps 132560786Sps ?f%f .?ltLine %lt:?pt%pt\%:?btByte %bt:-... 132660786Sps 1327221715Sdelphij This prompt would print the filename, if known. The filename is fol- 1328221715Sdelphij lowed by the line number, if known, otherwise the percent if known, 1329221715Sdelphij otherwise the byte offset if known. Otherwise, a dash is printed. 1330221715Sdelphij Notice how each question mark has a matching period, and how the % 1331161475Sdelphij after the %pt is included literally by escaping it with a backslash. 133260786Sps 133360786Sps ?n?f%f .?m(file %i of %m) ..?e(END) ?x- Next\: %x..%t 133460786Sps 1335221715Sdelphij This prints the filename if this is the first prompt in a file, fol- 1336221715Sdelphij lowed by the "file N of N" message if there is more than one input 1337221715Sdelphij file. Then, if we are at end-of-file, the string "(END)" is printed 1338221715Sdelphij followed by the name of the next file, if there is one. Finally, any 1339161475Sdelphij trailing spaces are truncated. This is the default prompt. For refer- 1340221715Sdelphij ence, here are the defaults for the other two prompts (-m and -M 1341221715Sdelphij respectively). Each is broken into two lines here for readability 1342161475Sdelphij only. 134363128Sps 134489019Sps ?n?f%f .?m(file %i of %m) ..?e(END) ?x- Next\: %x.: 134589019Sps ?pB%pB\%:byte %bB?s/%s...%t 134663128Sps 134789019Sps ?f%f .?n?m(file %i of %m) ..?ltlines %lt-%lb?L/%L. : 134889019Sps byte %bB?s/%s. .?e(END) ?x- Next\: %x.:?pB%pB\%..%t 134963128Sps 135089019Sps And here is the default message produced by the = command: 135163128Sps 135289019Sps ?f%f .?m(file %i of %m) .?ltlines %lt-%lb?L/%L. . 1353128345Stjr byte %bB?s/%s. ?e(END) :?pB%pB\%..%t 1354128345Stjr 1355221715Sdelphij The prompt expansion features are also used for another purpose: if an 1356221715Sdelphij environment variable LESSEDIT is defined, it is used as the command to 1357221715Sdelphij be executed when the v command is invoked. The LESSEDIT string is 1358221715Sdelphij expanded in the same way as the prompt strings. The default value for 1359128345Stjr LESSEDIT is: 1360128345Stjr 136160786Sps %E ?lm+%lm. %f 136260786Sps 1363161475Sdelphij Note that this expands to the editor name, followed by a + and the line 1364221715Sdelphij number, followed by the file name. If your editor does not accept the 1365221715Sdelphij "+linenumber" syntax, or has other differences in invocation syntax, 1366161475Sdelphij the LESSEDIT variable can be changed to modify this default. 136760786Sps 136860786Sps 1369170256Sdelphij[1mSECURITY[0m 1370221715Sdelphij When the environment variable LESSSECURE is set to 1, [4mless[24m runs in a 1371161475Sdelphij "secure" mode. This means these features are disabled: 137260786Sps 137360786Sps ! the shell command 137460786Sps 137560786Sps | the pipe command 137660786Sps 137760786Sps :e the examine command. 137860786Sps 137960786Sps v the editing command 138060786Sps 138160786Sps s -o log files 138260786Sps 138360786Sps -k use of lesskey files 138460786Sps 138560786Sps -t use of tags files 138660786Sps 138760786Sps metacharacters in filenames, such as * 138860786Sps 138960786Sps filename completion (TAB, ^L) 139060786Sps 1391161475Sdelphij Less can also be compiled to be permanently in "secure" mode. 139260786Sps 139360786Sps 1394170256Sdelphij[1mCOMPATIBILITY WITH MORE[0m 1395170256Sdelphij If the environment variable LESS_IS_MORE is set to 1, or if the program 1396221715Sdelphij is invoked via a file link named "more", [4mless[24m behaves (mostly) in con- 1397221715Sdelphij formance with the POSIX "more" command specification. In this mode, 1398170256Sdelphij less behaves differently in these ways: 1399170256Sdelphij 1400221715Sdelphij The -e option works differently. If the -e option is not set, [4mless[0m 1401221715Sdelphij behaves as if the -E option were set. If the -e option is set, [4mless[0m 1402170256Sdelphij behaves as if the -e and -F options were set. 1403170256Sdelphij 1404221715Sdelphij The -m option works differently. If the -m option is not set, the 1405221715Sdelphij medium prompt is used, and it is prefixed with the string "--More--". 1406170256Sdelphij If the -m option is set, the short prompt is used. 1407170256Sdelphij 1408221715Sdelphij The -n option acts like the -z option. The normal behavior of the -n 1409170256Sdelphij option is unavailable in this mode. 1410170256Sdelphij 1411221715Sdelphij The parameter to the -p option is taken to be a [4mless[24m command rather 1412170256Sdelphij than a search pattern. 1413170256Sdelphij 1414221715Sdelphij The LESS environment variable is ignored, and the MORE environment 1415170256Sdelphij variable is used in its place. 1416170256Sdelphij 1417170256Sdelphij 1418170256Sdelphij[1mENVIRONMENT VARIABLES[0m 1419161475Sdelphij Environment variables may be specified either in the system environment 1420221715Sdelphij as usual, or in a [4mlesskey[24m (1) file. If environment variables are 1421221715Sdelphij defined in more than one place, variables defined in a local lesskey 1422221715Sdelphij file take precedence over variables defined in the system environment, 1423161475Sdelphij which take precedence over variables defined in the system-wide lesskey 1424161475Sdelphij file. 142560786Sps 1426128345Stjr COLUMNS 1427161475Sdelphij Sets the number of columns on the screen. Takes precedence over 1428221715Sdelphij the number of columns specified by the TERM variable. (But if 1429161475Sdelphij you have a windowing system which supports TIOCGWINSZ or 1430221715Sdelphij WIOCGETD, the window system's idea of the screen size takes 1431161475Sdelphij precedence over the LINES and COLUMNS environment variables.) 1432128345Stjr 143363128Sps EDITOR The name of the editor (used for the v command). 143460786Sps 1435221715Sdelphij HOME Name of the user's home directory (used to find a lesskey file 1436161475Sdelphij on Unix and OS/2 systems). 143760786Sps 143860786Sps HOMEDRIVE, HOMEPATH 1439221715Sdelphij Concatenation of the HOMEDRIVE and HOMEPATH environment vari- 1440161475Sdelphij ables is the name of the user's home directory if the HOME vari- 1441161475Sdelphij able is not set (only in the Windows version). 144260786Sps 1443221715Sdelphij INIT Name of the user's init directory (used to find a lesskey file 1444161475Sdelphij on OS/2 systems). 144560786Sps 144660786Sps LANG Language for determining the character set. 144760786Sps 144860786Sps LC_CTYPE 144960786Sps Language for determining the character set. 145060786Sps 1451170256Sdelphij LESS Options which are passed to [4mless[24m automatically. 145260786Sps 145360786Sps LESSANSIENDCHARS 1454221715Sdelphij Characters which may end an ANSI color escape sequence (default 1455161475Sdelphij "m"). 145660786Sps 1457161475Sdelphij LESSANSIMIDCHARS 1458221715Sdelphij Characters which may appear between the ESC character and the 1459221715Sdelphij end character in an ANSI color escape sequence (default 1460161475Sdelphij "0123456789;[?!"'#%()*+ ". 1461161475Sdelphij 146260786Sps LESSBINFMT 1463161475Sdelphij Format for displaying non-printable, non-control characters. 146460786Sps 146560786Sps LESSCHARDEF 146660786Sps Defines a character set. 146760786Sps 146889019Sps LESSCHARSET 146989019Sps Selects a predefined character set. 147063128Sps 147189019Sps LESSCLOSE 1472161475Sdelphij Command line to invoke the (optional) input-postprocessor. 147363128Sps 147489019Sps LESSECHO 1475161475Sdelphij Name of the lessecho program (default "lessecho"). The lessecho 1476221715Sdelphij program is needed to expand metacharacters, such as * and ?, in 1477161475Sdelphij filenames on Unix systems. 147863128Sps 1479161475Sdelphij LESSEDIT 1480221715Sdelphij Editor prototype string (used for the v command). See discus- 1481161475Sdelphij sion under PROMPTS. 148263128Sps 1483161475Sdelphij LESSGLOBALTAGS 1484221715Sdelphij Name of the command used by the -t option to find global tags. 1485170256Sdelphij Normally should be set to "global" if your system has the [4mglobal[0m 1486161475Sdelphij (1) command. If not set, global tags are not used. 148763128Sps 1488161475Sdelphij LESSHISTFILE 1489221715Sdelphij Name of the history file used to remember search commands and 1490221715Sdelphij shell commands between invocations of [4mless.[24m If set to "-" or 1491221715Sdelphij "/dev/null", a history file is not used. The default is 1492221715Sdelphij "$HOME/.lesshst" on Unix systems, "$HOME/_lesshst" on DOS and 1493221715Sdelphij Windows systems, or "$HOME/lesshst.ini" or "$INIT/lesshst.ini" 1494170256Sdelphij on OS/2 systems. 149563128Sps 1496161475Sdelphij LESSHISTSIZE 1497161475Sdelphij The maximum number of commands to save in the history file. The 1498161475Sdelphij default is 100. 149963128Sps 150060786Sps LESSKEY 150160786Sps Name of the default lesskey(1) file. 150260786Sps 150360786Sps LESSKEY_SYSTEM 150460786Sps Name of the default system-wide lesskey(1) file. 150560786Sps 150660786Sps LESSMETACHARS 1507221715Sdelphij List of characters which are considered "metacharacters" by the 1508161475Sdelphij shell. 150960786Sps 151060786Sps LESSMETAESCAPE 1511221715Sdelphij Prefix which less will add before each metacharacter in a com- 1512221715Sdelphij mand sent to the shell. If LESSMETAESCAPE is an empty string, 1513221715Sdelphij commands containing metacharacters will not be passed to the 1514161475Sdelphij shell. 151560786Sps 151660786Sps LESSOPEN 1517161475Sdelphij Command line to invoke the (optional) input-preprocessor. 151860786Sps 151960786Sps LESSSECURE 1520161475Sdelphij Runs less in "secure" mode. See discussion under SECURITY. 152160786Sps 152260786Sps LESSSEPARATOR 1523221715Sdelphij String to be appended to a directory name in filename comple- 1524161475Sdelphij tion. 152560786Sps 1526161475Sdelphij LESSUTFBINFMT 1527161475Sdelphij Format for displaying non-printable Unicode code points. 152860786Sps 1529170256Sdelphij LESS_IS_MORE 1530170256Sdelphij Emulate the [4mmore[24m (1) command. 1531170256Sdelphij 1532221715Sdelphij LINES Sets the number of lines on the screen. Takes precedence over 1533161475Sdelphij the number of lines specified by the TERM variable. (But if you 1534221715Sdelphij have a windowing system which supports TIOCGWINSZ or WIOCGETD, 1535221715Sdelphij the window system's idea of the screen size takes precedence 1536161475Sdelphij over the LINES and COLUMNS environment variables.) 153763128Sps 1538221715Sdelphij PATH User's search path (used to find a lesskey file on MS-DOS and 1539161475Sdelphij OS/2 systems). 154063128Sps 1541221715Sdelphij SHELL The shell used to execute the ! command, as well as to expand 1542161475Sdelphij filenames. 1543161475Sdelphij 1544170256Sdelphij TERM The type of terminal on which [4mless[24m is being run. 154563128Sps 1546128345Stjr VISUAL The name of the editor (used for the v command). 154760786Sps 154860786Sps 1549170256Sdelphij[1mSEE ALSO[0m 1550128345Stjr lesskey(1) 155160786Sps 155260786Sps 1553170256Sdelphij[1mCOPYRIGHT[0m 1554221715Sdelphij Copyright (C) 1984-2011 Mark Nudelman 155560786Sps 1556221715Sdelphij less is part of the GNU project and is free software. You can redis- 1557221715Sdelphij tribute it and/or modify it under the terms of either (1) the GNU Gen- 1558221715Sdelphij eral Public License as published by the Free Software Foundation; or 1559161475Sdelphij (2) the Less License. See the file README in the less distribution for 1560161475Sdelphij more details regarding redistribution. You should have received a copy 1561221715Sdelphij of the GNU General Public License along with the source for less; see 1562221715Sdelphij the file COPYING. If not, write to the Free Software Foundation, 59 1563221715Sdelphij Temple Place, Suite 330, Boston, MA 02111-1307, USA. You should also 1564161475Sdelphij have received a copy of the Less License; see the file LICENSE. 156560786Sps 1566161475Sdelphij less is distributed in the hope that it will be useful, but WITHOUT ANY 1567221715Sdelphij WARRANTY; without even the implied warranty of MERCHANTABILITY or FIT- 1568221715Sdelphij NESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 1569161475Sdelphij more details. 157060786Sps 157160786Sps 1572170256Sdelphij[1mAUTHOR[0m 157389019Sps Mark Nudelman <markn@greenwoodsoftware.com> 1574221715Sdelphij Send bug reports or comments to the above address or to bug- 1575221715Sdelphij less@gnu.org. 1576191930Sdelphij See http://www.greenwoodsoftware.com/less/bugs.html for the latest list 1577191930Sdelphij of known bugs in less. 1578170256Sdelphij For more information, see the less homepage at 1579170256Sdelphij http://www.greenwoodsoftware.com/less. 158060786Sps 158160786Sps 158260786Sps 1583222906Sdelphij Version 444: 09 Jun 2011 LESS(1) 1584