"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "less.man" between
less-530.tar.gz and less-548.tar.gz

About: less is a file pager (a program that displays text files similar to "more" or "pg"). Beta version.

less.man  (less-530):less.man  (less-548)
skipping to change at line 1380 skipping to change at line 1380
riodically attempt to riodically attempt to
reopen the file by name. If the reopen succeeds reopen the file by name. If the reopen succeeds
and the file is and the file is
a different file from the original (which means a different file from the original (which means
that a new file that a new file
has been created with the same name as the has been created with the same name as the
original (now original (now
renamed) file), [4mless[24m will display the con- renamed) file), [4mless[24m will display the con-
tents of that new file. tents of that new file.
‐‐mouse
Enables mouse input: scrolling the mouse wheel down
moves for‐
ward in the file, scrolling the mouse wheel up
moves backwards
in the file, and clicking the mouse sets the "#"
mark to the
line where the mouse is clicked. The number of
lines to scroll
when the wheel is moved can be set by the ‐‐wheel‐
lines option.
Mouse input works only on terminals which sup-
port X11 mouse
reporting, and on the Windows version of
[4mless[24m.
‐‐MOUSE
Like ‐‐mouse, except the direction scrolled on
mouse wheel move‐
ment is reversed.
‐‐no‐keypad ‐‐no‐keypad
Disables sending the keypad initialization and Disables sending the keypad initialization and
deinitialization deinitialization
strings to the terminal. This is sometimes useful strings to the terminal. This is sometimes useful
if the keypad if the keypad
strings make the numeric keypad behave in an unde- strings make the numeric keypad behave in an unde-
sirable manner. sirable manner.
‐‐no‐histdups
This option changes the behavior so that if a
search string or
file name is typed in, and the same string is al-
ready in the
history list, the existing copy is removed from the
history list
before the new one is added. Thus, a given string
will appear
only once in the history list. Normally, a
string may appear
multiple times.
‐‐rscroll
This option changes the character used to mark
truncated lines.
It may begin with a two‐character attribute indica-
tor like LESS‐
BINFMT does. If there is no attribute indicator,
standout is
used. If set to "‐", truncated lines are not
marked.
‐‐save‐marks
Save marks in the history file, so marks are
retained across
different invocations of [4mless[24m.
‐‐use‐backslash ‐‐use‐backslash
This option changes the interpretations of options This option changes the interpretations of options
which follow which follow
this one. After the ‐‐use‐backslash option, any this one. After the ‐‐use‐backslash option, any
backslash in an backslash in an
option string is removed and the following charac- option string is removed and the following charac-
ter is taken ter is taken
literally. This allows a dollar sign to be in- literally. This allows a dollar sign to be in-
cluded in option cluded in option
strings. strings.
‐‐rscroll ‐‐wheel‐lines=[4mn[0m
This option changes the character used to mark Set the number of lines to scroll when the
truncated lines. mouse wheel is
It may begin with a two‐character attribute indica- scrolled and the ‐‐mouse or ‐‐MOUSE option is in
tor like LESS‐ effect. The
BINFMT does. If there is no attribute indicator, default is 1 line.
standout is
used. If set to "‐", truncated lines are not ‐‐ A command line argument of "‐‐" marks the end of
marked. option argu‐
ments. Any arguments following this are inter-
‐‐ A command line argument of "‐‐" marks the end of preted as file‐
option argu‐
ments. Any arguments following this are inter-
preted as file‐
names. This can be useful when viewing a file names. This can be useful when viewing a file
whose name begins whose name begins
with a "‐" or "+". with a "‐" or "+".
+ If a command line option begins with [1m+[22m, the + If a command line option begins with [1m+[22m,
remainder of that the remainder of that
option is taken to be an initial command to option is taken to be an initial command to
[4mless[24m. For example, [4mless[24m. For example,
+G tells [4mless[24m to start at the end of the +G tells [4mless[24m to start at the end of the
file rather than the file rather than the
beginning, and +/xyz tells it to start at the beginning, and +/xyz tells it to start at the
first occurrence first occurrence
of "xyz" in the file. As a special case, +<num- of "xyz" in the file. As a special case, +<num-
ber> acts like ber> acts like
+<number>g; that is, it starts the display at the +<number>g; that is, it starts the display at the
specified line specified line
number (however, see the caveat under the "g" number (however, see the caveat under the "g"
command above). command above).
If the option starts with ++, the initial com- If the option starts with ++, the initial command
mand applies to applies to
every file being viewed, not just the first one. every file being viewed, not just the first one.
The + command The + command
described previously may also be used to set (or described previously may also be used to set (or
change) an ini‐ change) an ini‐
tial command for every file. tial command for every file.
[1mLINE EDITING[0m [1mLINE EDITING[0m
When entering command line at the bottom of the screen When entering command line at the bottom of the screen
(for example, a (for example, a
filename for the :e command, or the pattern for a search filename for the :e command, or the pattern for a search
command), cer‐ command), cer‐
tain keys can be used to manipulate the command line. tain keys can be used to manipulate the command line.
Most commands Most commands
have an alternate form in [ brackets ] which can be used have an alternate form in [ brackets ] which can be used
if a key does if a key does
not exist on a particular keyboard. (Note that the not exist on a particular keyboard. (Note that the
forms beginning forms beginning
with ESC do not work in some MS‐DOS and Windows systems with ESC do not work in some MS‐DOS and Windows systems
because ESC is because ESC is
the line erase character.) Any of these special keys may the line erase character.) Any of these special keys
be entered may be entered
literally by preceding it with the "literal" character, literally by preceding it with the "literal" character,
either ^V or either ^V or
^A. A backslash itself may also be entered literally by ^A. A backslash itself may also be entered literally by
entering two entering two
backslashes. backslashes.
LEFTARROW [ ESC‐h ] LEFTARROW [ ESC‐h ]
Move the cursor one space to the left. Move the cursor one space to the left.
RIGHTARROW [ ESC‐l ] RIGHTARROW [ ESC‐l ]
Move the cursor one space to the right. Move the cursor one space to the right.
^LEFTARROW [ ESC‐b or ESC‐LEFTARROW ] ^LEFTARROW [ ESC‐b or ESC‐LEFTARROW ]
(That is, CONTROL and LEFTARROW simultaneously.) (That is, CONTROL and LEFTARROW simultaneously.)
Move the cur‐ Move the cur‐
sor one word to the left. sor one word to the left.
^RIGHTARROW [ ESC‐w or ESC‐RIGHTARROW ] ^RIGHTARROW [ ESC‐w or ESC‐RIGHTARROW ]
(That is, CONTROL and RIGHTARROW simultaneously.) (That is, CONTROL and RIGHTARROW simultaneously.)
Move the cur‐ Move the cur‐
sor one word to the right. sor one word to the right.
HOME [ ESC‐0 ] HOME [ ESC‐0 ]
Move the cursor to the beginning of the line. Move the cursor to the beginning of the line.
END [ ESC‐$ ] END [ ESC‐$ ]
Move the cursor to the end of the line. Move the cursor to the end of the line.
BACKSPACE BACKSPACE
Delete the character to the left of the cursor, Delete the character to the left of the cursor, or
or cancel the cancel the
command if the command line is empty. command if the command line is empty.
DELETE or [ ESC‐x ] DELETE or [ ESC‐x ]
Delete the character under the cursor. Delete the character under the cursor.
^BACKSPACE [ ESC‐BACKSPACE ] ^BACKSPACE [ ESC‐BACKSPACE ]
(That is, CONTROL and BACKSPACE simultaneously.) (That is, CONTROL and BACKSPACE simultaneous-
Delete the ly.) Delete the
word to the left of the cursor. word to the left of the cursor.
^DELETE [ ESC‐X or ESC‐DELETE ] ^DELETE [ ESC‐X or ESC‐DELETE ]
(That is, CONTROL and DELETE simultaneously.) (That is, CONTROL and DELETE simultaneously.)
Delete the word Delete the word
under the cursor. under the cursor.
UPARROW [ ESC‐k ] UPARROW [ ESC‐k ]
Retrieve the previous command line. If you first Retrieve the previous command line. If you
enter some first enter some
text and then press UPARROW, it will retrieve the text and then press UPARROW, it will retrieve the
previous com‐ previous com‐
mand which begins with that text. mand which begins with that text.
DOWNARROW [ ESC‐j ] DOWNARROW [ ESC‐j ]
Retrieve the next command line. If you first en- Retrieve the next command line. If you first
ter some text enter some text
and then press DOWNARROW, it will retrieve the and then press DOWNARROW, it will retrieve the
next command next command
which begins with that text. which begins with that text.
TAB Complete the partial filename to the left of the TAB Complete the partial filename to the left of the
cursor. If it cursor. If it
matches more than one filename, the first match is matches more than one filename, the first match is
entered into entered into
the command line. Repeated TABs will cycle the command line. Repeated TABs will cycle
thru the other thru the other
matching filenames. If the completed filename is a matching filenames. If the completed filename is a
directory, a directory, a
"/" is appended to the filename. (On MS‐DOS sys- "/" is appended to the filename. (On MS‐DOS sys-
tems, a " tems, a "
appended.) The environment variable LESSSEPARA- appended.) The environment variable LESSSEPARATOR
TOR can be used can be used
to specify a different character to append to a di- to specify a different character to append to a di-
rectory name. rectory name.
BACKTAB [ ESC‐TAB ] BACKTAB [ ESC‐TAB ]
Like, TAB, but cycles in the reverse direction thru Like, TAB, but cycles in the reverse direction thru
the matching the matching
filenames. filenames.
^L Complete the partial filename to the left of the ^L Complete the partial filename to the left of the
cursor. If it cursor. If it
matches more than one filename, all matches are en- matches more than one filename, all matches are en-
tered into the tered into the
command line (if they fit). command line (if they fit).
^U (Unix and OS/2) or ESC (MS‐DOS) ^U (Unix and OS/2) or ESC (MS‐DOS)
Delete the entire command line, or cancel the Delete the entire command line, or cancel the
command if the command if the
command line is empty. If you have changed your command line is empty. If you have changed your
line‐kill char‐ line‐kill char‐
acter in Unix to something other than ^U, that acter in Unix to something other than ^U, that
character is used character is used
instead of ^U. instead of ^U.
^G Delete the entire command line and return to the ^G Delete the entire command line and return to the
main prompt. main prompt.
[1mKEY BINDINGS[0m [1mKEY BINDINGS[0m
You may define your own [4mless[24m commands by using the You may define your own [4mless[24m commands by using the
program [4mlesskey[24m (1) program [4mlesskey[24m (1)
to create a lesskey file. This file specifies a set of to create a lesskey file. This file specifies a set of
command keys command keys
and an action associated with each key. You may also use and an action associated with each key. You may also
[4mlesskey[24m to use [4mlesskey[24m to
change the line‐editing keys (see LINE EDITING), and to change the line‐editing keys (see LINE EDITING), and to
set environment set environment
variables. If the environment variable LESSKEY is set, variables. If the environment variable LESSKEY is set,
[4mless[24m uses that [4mless[24m uses that
as the name of the lesskey file. Otherwise, [4mless[24m as the name of the lesskey file. Otherwise, [4mless[24m
looks in a standard looks in a standard
place for the lesskey file: On Unix systems, [4mless[24m place for the lesskey file: On Unix systems, [4mless[24m
looks for a lesskey looks for a lesskey
file called "$HOME/.less". On MS‐DOS and Windows sys- file called "$HOME/.less". On MS‐DOS and Windows systems,
tems, [4mless[24m looks [4mless[24m looks
for a lesskey file called "$HOME/_less", and if it is not for a lesskey file called "$HOME/_less", and if it is not
found there, found there,
then looks for a lesskey file called "_less" in any direc- then looks for a lesskey file called "_less" in any direc-
tory specified tory specified
in the PATH environment variable. On OS/2 systems, in the PATH environment variable. On OS/2 systems,
[4mless[24m looks for a [4mless[24m looks for a
lesskey file called "$HOME/less.ini", and if it is lesskey file called "$HOME/less.ini", and if it is not
not found, then found, then
looks for a lesskey file called "less.ini" in any direc- looks for a lesskey file called "less.ini" in any direc-
tory specified tory specified
in the INIT environment variable, and if it not found in the INIT environment variable, and if it not found
there, then looks there, then looks
for a lesskey file called "less.ini" in any directory for a lesskey file called "less.ini" in any directory
specified in the specified in the
PATH environment variable. See the [4mlesskey[24m PATH environment variable. See the [4mlesskey[24m
manual page for more manual page for more
details. details.
A system‐wide lesskey file may also be set up to provide A system‐wide lesskey file may also be set up to provide
key bindings. key bindings.
If a key is defined in both a local lesskey file and in If a key is defined in both a local lesskey file and in
the system‐wide the system‐wide
file, key bindings in the local file take precedence over file, key bindings in the local file take precedence over
those in the those in the
system‐wide file. If the environment variable system‐wide file. If the environment variable
LESSKEY_SYSTEM is set, LESSKEY_SYSTEM is set,
[4mless[24m uses that as the name of the system‐wide [4mless[24m uses that as the name of the system‐wide
lesskey file. Otherwise, lesskey file. Otherwise,
[4mless[24m looks in a standard place for the system‐ [4mless[24m looks in a standard place for the system‐wide
wide lesskey file: On lesskey file: On
Unix systems, the system‐wide lesskey file is /usr/lo- Unix systems, the system‐wide lesskey file is /usr/lo-
cal/etc/sysless. cal/etc/sysless.
(However, if [4mless[24m was built with a different (However, if [4mless[24m was built with a different
sysconf directory than sysconf directory than
/usr/local/etc, that directory is where the sysless file /usr/local/etc, that directory is where the sysless file
is found.) On is found.) On
MS‐DOS and Windows systems, the system‐wide lesskey MS‐DOS and Windows systems, the system‐wide lesskey file
file is c:_sys‐ is c:_sys‐
less. On OS/2 systems, the system‐wide lesskey file is less. On OS/2 systems, the system‐wide lesskey file is
c:less.ini. c:less.ini.
[1mINPUT PREPROCESSOR[0m [1mINPUT PREPROCESSOR[0m
You may define an "input preprocessor" for [4mless[24m. You may define an "input preprocessor" for [4mless[24m.
Before [4mless[24m opens a Before [4mless[24m opens a
file, it first gives your input preprocessor a chance to file, it first gives your input preprocessor a chance to
modify the way modify the way
the contents of the file are displayed. An input pre- the contents of the file are displayed. An input pre-
processor is sim‐ processor is sim‐
ply an executable program (or shell script), which writes ply an executable program (or shell script), which writes
the contents the contents
of the file to a different file, called the replacement of the file to a different file, called the replacement
file. The con‐ file. The con‐
tents of the replacement file are then displayed in tents of the replacement file are then displayed in place
place of the con‐ of the con‐
tents of the original file. However, it will appear to tents of the original file. However, it will appear to
the user as if the user as if
the original file is opened; that is, [4mless[24m will the original file is opened; that is, [4mless[24m will
display the original display the original
filename as the name of the current file. filename as the name of the current file.
An input preprocessor receives one command line argument, An input preprocessor receives one command line argument,
the original the original
filename, as entered by the user. It should create filename, as entered by the user. It should create the
the replacement replacement
file, and when finished, print the name of the replacement file, and when finished, print the name of the replace-
file to its ment file to its
standard output. If the input preprocessor does not out- standard output. If the input preprocessor does not out-
put a replace‐ put a replace‐
ment filename, [4mless[24m uses the original file, as nor- ment filename, [4mless[24m uses the original file, as
mal. The input pre‐ normal. The input pre‐
processor is not called when viewing standard input. processor is not called when viewing standard input. To
To set up an set up an
input preprocessor, set the LESSOPEN environment variable input preprocessor, set the LESSOPEN environment variable
to a command to a command
line which will invoke your input preprocessor. This line which will invoke your input preprocessor. This
command line command line
should include one occurrence of the string "%s", should include one occurrence of the string "%s",
which will be which will be
replaced by the filename when the input preproces- replaced by the filename when the input preprocessor
sor command is command is
invoked. invoked.
When [4mless[24m closes a file opened in such a way, it When [4mless[24m closes a file opened in such a way, it
will call another pro‐ will call another pro‐
gram, called the input postprocessor, which may per- gram, called the input postprocessor, which may perform
form any desired any desired
clean‐up action (such as deleting the replacement file clean‐up action (such as deleting the replacement
created by file created by
LESSOPEN). This program receives two command line argu- LESSOPEN). This program receives two command line argu-
ments, the orig‐ ments, the orig‐
inal filename as entered by the user, and the name of the inal filename as entered by the user, and the name of
replacement the replacement
file. To set up an input postprocessor, set the LESS- file. To set up an input postprocessor, set the LESSCLOSE
CLOSE environment environment
variable to a command line which will invoke your input variable to a command line which will invoke your input
postprocessor. postprocessor.
It may include two occurrences of the string "%s"; It may include two occurrences of the string "%s";
the first is the first is
replaced with the original name of the file and the sec- replaced with the original name of the file and the
ond with the second with the
name of the replacement file, which was output by name of the replacement file, which was output by
LESSOPEN. LESSOPEN.
For example, on many Unix systems, these two scripts will For example, on many Unix systems, these two scripts will
allow you to allow you to
keep files in compressed format, but still let [4mless[24m keep files in compressed format, but still let [4mless[24m
view them directly: view them directly:
lessopen.sh: lessopen.sh:
#! /bin/sh #! /bin/sh
case "$1" in case "$1" in
*.Z) uncompress ‐c $1 >/tmp/less.$$ 2>/dev/null *.Z) uncompress ‐c $1 >/tmp/less.$$ 2>/dev/null
if [ ‐s /tmp/less.$$ ]; then if [ ‐s /tmp/less.$$ ]; then
echo /tmp/less.$$ echo /tmp/less.$$
else else
rm ‐f /tmp/less.$$ rm ‐f /tmp/less.$$
fi fi
;; ;;
esac esac
lessclose.sh: lessclose.sh:
#! /bin/sh #! /bin/sh
rm $2 rm $2
To use these scripts, put them both where they can be exe- To use these scripts, put them both where they can be ex-
cuted and set ecuted and set
LESSOPEN="lessopen.sh %s", and LESSCLOSE="lessclose.sh LESSOPEN="lessopen.sh %s", and LESSCLOSE="lessclose.sh
%s %s". More %s %s". More
complex LESSOPEN and LESSCLOSE scripts may be written to complex LESSOPEN and LESSCLOSE scripts may be written to
accept other accept other
types of compressed files, and so on. types of compressed files, and so on.
It is also possible to set up an input preprocessor to It is also possible to set up an input preprocessor to
pipe the file pipe the file
data directly to [4mless[24m, rather than putting the data data directly to [4mless[24m, rather than putting the da-
into a replacement ta into a replacement
file. This avoids the need to decompress the entire file file. This avoids the need to decompress the entire file
before start‐ before start‐
ing to view it. An input preprocessor that works this way ing to view it. An input preprocessor that works this way
is called an is called an
input pipe. An input pipe, instead of writing the name input pipe. An input pipe, instead of writing the name of
of a replace‐ a replace‐
ment file on its standard output, writes the entire con- ment file on its standard output, writes the entire
tents of the contents of the
replacement file on its standard output. If the input replacement file on its standard output. If the input
pipe does not pipe does not
write any characters on its standard output, then there is write any characters on its standard output, then there
no replace‐ is no replace‐
ment file and [4mless[24m uses the original file, as nor- ment file and [4mless[24m uses the original file, as nor-
mal. To use an input mal. To use an input
pipe, make the first character in the LESSOPEN environment pipe, make the first character in the LESSOPEN environ-
variable a ment variable a
vertical bar (|) to signify that the input preproces- vertical bar (|) to signify that the input preprocessor
sor is an input is an input
pipe. As with non‐pipe input preprocessors, the command pipe. As with non‐pipe input preprocessors, the com-
string must mand string must
contain one occurrence of %s, which is replaced with contain one occurrence of %s, which is replaced with the
the filename of filename of
the input file. the input file.
For example, on many Unix systems, this script will work For example, on many Unix systems, this script will work
like the pre‐ like the pre‐
vious example scripts: vious example scripts:
lesspipe.sh: lesspipe.sh:
#! /bin/sh #! /bin/sh
case "$1" in case "$1" in
*.Z) uncompress ‐c $1 2>/dev/null *.Z) uncompress ‐c $1 2>/dev/null
;;
*) exit 1 *) exit 1
;; ;;
esac esac
exit $? exit $?
To use this script, put it where it can be exe- To use this script, put it where it can be exe-
cuted and set cuted and set
LESSOPEN="|lesspipe.sh %s". LESSOPEN="|lesspipe.sh %s".
Note that a preprocessor cannot output an empty file, Note that a preprocessor cannot output an empty file,
since that is since that is
interpreted as meaning there is no replacement, and the interpreted as meaning there is no replacement, and the
original file original file
is used. To avoid this, if LESSOPEN starts with two ver- is used. To avoid this, if LESSOPEN starts with two ver-
tical bars, the tical bars, the
exit status of the script becomes meaningful. If the exit status of the script becomes meaningful. If the ex-
exit status is it status is
zero, the output is considered to be replacement text, zero, the output is considered to be replacement text,
even if it is even if it is
empty. If the exit status is nonzero, any output is empty. If the exit status is nonzero, any output is ig-
ignored and the nored and the
original file is used. For compatibility with previous original file is used. For compatibility with previ-
versions of ous versions of
[4mless[24m, if LESSOPEN starts with only one vertical [4mless[24m, if LESSOPEN starts with only one vertical
bar, the exit status of bar, the exit status of
the preprocessor is ignored. the preprocessor is ignored.
When an input pipe is used, a LESSCLOSE postprocessor can When an input pipe is used, a LESSCLOSE postprocessor can
be used, but be used, but
it is usually not necessary since there is no replacement it is usually not necessary since there is no replacement
file to clean file to clean
up. In this case, the replacement file name passed to up. In this case, the replacement file name passed to
the LESSCLOSE the LESSCLOSE
postprocessor is "‐". postprocessor is "‐".
For compatibility with previous versions of [4mless[24m, For compatibility with previous versions of [4mless[24m,
the input preproces‐ the input preproces‐
sor or pipe is not used if [4mless[24m is viewing standard sor or pipe is not used if [4mless[24m is viewing standard
input. However, if input. However, if
the first character of LESSOPEN is a dash (‐), the input the first character of LESSOPEN is a dash (‐), the input
preprocessor preprocessor
is used on standard input as well as other files. In is used on standard input as well as other files. In
this case, the this case, the
dash is not considered to be part of the preprocessor dash is not considered to be part of the preprocessor
command. If command. If
standard input is being viewed, the input preprocessor is standard input is being viewed, the input preprocessor is
passed a file passed a file
name consisting of a single dash. Similarly, if the name consisting of a single dash. Similarly, if the first
first two charac‐ two charac‐
ters of LESSOPEN are vertical bar and dash (|‐) or two ters of LESSOPEN are vertical bar and dash (|‐) or two
vertical bars vertical bars
and a dash (||‐), the input pipe is used on standard in- and a dash (||‐), the input pipe is used on standard input
put as well as as well as
other files. Again, in this case the dash is not consid- other files. Again, in this case the dash is not consid-
ered to be part ered to be part
of the input pipe command. of the input pipe command.
[1mNATIONAL CHARACTER SETS[0m [1mNATIONAL CHARACTER SETS[0m
There are three types of characters in the input file: There are three types of characters in the input file:
normal characters normal characters
can be displayed directly to the screen. can be displayed directly to the screen.
control characters control characters
should not be displayed directly, but are expect- should not be displayed directly, but are expected
ed to be found to be found
in ordinary text files (such as backspace and tab). in ordinary text files (such as backspace and tab).
binary characters binary characters
should not be displayed directly and are not ex- should not be displayed directly and are not
pected to be expected to be
found in text files. found in text files.
A "character set" is simply a description of which charac- A "character set" is simply a description of which charac-
ters are to be ters are to be
considered normal, control, and binary. The LESSCHARSET considered normal, control, and binary. The LESS-
environment CHARSET environment
variable may be used to select a character set. Possi- variable may be used to select a character set. Possible
ble values for values for
LESSCHARSET are: LESSCHARSET are:
ascii BS, TAB, NL, CR, and formfeed are control charac- ascii BS, TAB, NL, CR, and formfeed are control charac-
ters, all chars ters, all chars
with values between 32 and 126 are normal, and with values between 32 and 126 are normal, and all
all others are others are
binary. binary.
iso8859 iso8859
Selects an ISO 8859 character set. This is the Selects an ISO 8859 character set. This is the
same as ASCII, same as ASCII,
except characters between 160 and 255 are except characters between 160 and 255 are treat-
treated as normal ed as normal
characters. characters.
latin1 Same as iso8859. latin1 Same as iso8859.
latin9 Same as iso8859. latin9 Same as iso8859.
dos Selects a character set appropriate for MS‐DOS. dos Selects a character set appropriate for MS‐DOS.
ebcdic Selects an EBCDIC character set. ebcdic Selects an EBCDIC character set.
IBM‐1047 IBM‐1047
Selects an EBCDIC character set used by OS/390 Selects an EBCDIC character set used by OS/390
Unix Services. Unix Services.
This is the EBCDIC analogue of latin1. You get This is the EBCDIC analogue of latin1. You get
similar results similar results
by setting either LESSCHARSET=IBM‐1047 or by setting either LESSCHARSET=IBM‐1047 or
LC_CTYPE=en_US in your LC_CTYPE=en_US in your
environment. environment.
koi8‐r Selects a Russian character set. koi8‐r Selects a Russian character set.
next Selects a character set appropriate for NeXT com- next Selects a character set appropriate for NeXT com-
puters. puters.
utf‐8 Selects the UTF‐8 encoding of the ISO 10646 utf‐8 Selects the UTF‐8 encoding of the ISO 10646
character set. character set.
UTF‐8 is special in that it supports multi‐byte UTF‐8 is special in that it supports multi‐byte
characters in characters in
the input file. It is the only character set the input file. It is the only character set
that supports that supports
multi‐byte characters. multi‐byte characters.
windows windows
Selects a character set appropriate for Microsoft Selects a character set appropriate for Micro-
Windows (cp soft Windows (cp
1251). 1251).
In rare cases, it may be desired to tailor [4mless[24m to In rare cases, it may be desired to tailor [4mless[24m to
use a character set use a character set
other than the ones definable by LESSCHARSET. In this other than the ones definable by LESSCHARSET. In this
case, the envi‐ case, the envi‐
ronment variable LESSCHARDEF can be used to define a char- ronment variable LESSCHARDEF can be used to define a char-
acter set. It acter set. It
should be set to a string where each character in the should be set to a string where each character in the
string represents string represents
one character in the character set. The character "." one character in the character set. The character "." is
is used for a used for a
normal character, "c" for control, and "b" for binary. A normal character, "c" for control, and "b" for binary. A
decimal num‐ decimal num‐
ber may be used for repetition. For example, "bc- ber may be used for repetition. For example, "bccc4b."
cc4b." would mean would mean
character 0 is binary, 1, 2 and 3 are control, 4, 5, 6 character 0 is binary, 1, 2 and 3 are control, 4,
and 7 are 5, 6 and 7 are
binary, and 8 is normal. All characters after the last binary, and 8 is normal. All characters after the last
are taken to be are taken to be
the same as the last, so characters 9 through 255 would the same as the last, so characters 9 through 255
be normal. would be normal.
(This is an example, and does not necessarily represent (This is an example, and does not necessarily represent
any real char‐ any real char‐
acter set.) acter set.)
This table shows the value of LESSCHARDEF which is equiva- This table shows the value of LESSCHARDEF which is
lent to each equivalent to each
of the possible values for LESSCHARSET: of the possible values for LESSCHARSET:
ascii 8bcccbcc18b95.b ascii 8bcccbcc18b95.b
dos 8bcccbcc12bc5b95.b. dos 8bcccbcc12bc5b95.b.
ebcdic 5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b ebcdic 5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b
9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b. 9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b.
IBM‐1047 4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc IBM‐1047 4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc
191.b 191.b
iso8859 8bcccbcc18b95.33b. iso8859 8bcccbcc18b95.33b.
koi8‐r 8bcccbcc18b95.b128. koi8‐r 8bcccbcc18b95.b128.
latin1 8bcccbcc18b95.33b. latin1 8bcccbcc18b95.33b.
next 8bcccbcc18b95.bb125.bb next 8bcccbcc18b95.bb125.bb
If neither LESSCHARSET nor LESSCHARDEF is set, but any If neither LESSCHARSET nor LESSCHARDEF is set, but any of
of the strings the strings
"UTF‐8", "UTF8", "utf‐8" or "utf8" is found in the LC_ALL, "UTF‐8", "UTF8", "utf‐8" or "utf8" is found in the
LC_CTYPE or LC_ALL, LC_CTYPE or
LANG environment variables, then the default character set LANG environment variables, then the default character set
is utf‐8. is utf‐8.
If that string is not found, but your system supports If that string is not found, but your system supports
the [4msetlocale[0m the [4msetlocale[0m
interface, [4mless[24m will use setlocale to determine interface, [4mless[24m will use setlocale to deter-
the character set. mine the character set.
setlocale is controlled by setting the LANG or setlocale is controlled by setting the LANG or LC_CTYPE
LC_CTYPE environment environment
variables. variables.
Finally, if the [4msetlocale[24m interface is also not Finally, if the [4msetlocale[24m interface is also not
available, the default available, the default
character set is latin1. character set is latin1.
Control and binary characters are displayed in Control and binary characters are displayed in
standout (reverse standout (reverse
video). Each such character is displayed in caret nota- video). Each such character is displayed in caret nota-
tion if possible tion if possible
(e.g. ^A for control‐A). Caret notation is used only if (e.g. ^A for control‐A). Caret notation is used only if
inverting the inverting the
0100 bit results in a normal printable character. Other- 0100 bit results in a normal printable character. Other-
wise, the char‐ wise, the char‐
acter is displayed as a hex number in angle brackets. acter is displayed as a hex number in angle brackets.
This format can This format can
be changed by setting the LESSBINFMT environment variable. be changed by setting the LESSBINFMT environment vari-
LESSBINFMT able. LESSBINFMT
may begin with a "*" and one character to select the dis- may begin with a "*" and one character to select the dis-
play attribute: play attribute:
"*k" is blinking, "*d" is bold, "*u" is underlined, "*s" "*k" is blinking, "*d" is bold, "*u" is underlined, "*s"
is standout, is standout,
and "*n" is normal. If LESSBINFMT does not begin with and "*n" is normal. If LESSBINFMT does not begin with a
a "*", normal "*", normal
attribute is assumed. The remainder of LESSBINFMT is a attribute is assumed. The remainder of LESSBINFMT is a
string which string which
may include one printf‐style escape sequence (a % fol- may include one printf‐style escape sequence (a % followed
lowed by x, X, o, by x, X, o,
d, etc.). For example, if LESSBINFMT is "*u[%x]", bina- d, etc.). For example, if LESSBINFMT is "*u[%x]", bi-
ry characters nary characters
are displayed in underlined hexadecimal surrounded by are displayed in underlined hexadecimal surrounded by
brackets. The brackets. The
default if no LESSBINFMT is specified is "*s<%02X>". default if no LESSBINFMT is specified is "*s<%02X>".
Warning: the Warning: the
result of expanding the character via LESSBINFMT must be result of expanding the character via LESSBINFMT must be
less than 31 less than 31
characters. characters.
When the character set is utf‐8, the LESSUTFBINFMT envi- When the character set is utf‐8, the LESSUTFBINFMT envi-
ronment variable ronment variable
acts similarly to LESSBINFMT but it applies to Unicode acts similarly to LESSBINFMT but it applies to Unicode
code points that code points that
were successfully decoded but are unsuitable for display were successfully decoded but are unsuitable for display
(e.g., unas‐ (e.g., unas‐
signed code points). Its default value is signed code points). Its default value is "<U+%04lX>".
"<U+%04lX>". Note that Note that
LESSUTFBINFMT and LESSBINFMT share their display at- LESSUTFBINFMT and LESSBINFMT share their display at-
tribute setting tribute setting
("*x") so specifying one will affect both; LESSUTFBINFMT ("*x") so specifying one will affect both; LESSUTFBINFMT
is read after is read after
LESSBINFMT so its setting, if any, will have priority. LESSBINFMT so its setting, if any, will have priority.
Problematic Problematic
octets in a UTF‐8 file (octets of a truncated se- octets in a UTF‐8 file (octets of a truncated sequence,
quence, octets of a octets of a
complete but non‐shortest form sequence, illegal complete but non‐shortest form sequence, illegal
octets, and stray octets, and stray
trailing octets) are displayed individually using LESS- trailing octets) are displayed individually using LESS-
BINFMT so as to BINFMT so as to
facilitate diagnostic of how the UTF‐8 file is ill‐formed. facilitate diagnostic of how the UTF‐8 file is ill‐formed.
[1mPROMPTS[0m [1mPROMPTS[0m
The ‐P option allows you to tailor the prompt to your The ‐P option allows you to tailor the prompt to your
preference. The preference. The
string given to the ‐P option replaces the specified string given to the ‐P option replaces the specified
prompt string. prompt string.
Certain characters in the string are interpreted special- Certain characters in the string are interpreted special-
ly. The prompt ly. The prompt
mechanism is rather complicated to provide flexibility, mechanism is rather complicated to provide flexibility,
but the ordi‐ but the ordi‐
nary user need not understand the details of constructing nary user need not understand the details of constructing
personalized personalized
prompt strings. prompt strings.
A percent sign followed by a single character is expanded A percent sign followed by a single character is expanded
according to according to
what the following character is: what the following character is:
%b[4mX[24m Replaced by the byte offset into the current %b[4mX[24m Replaced by the byte offset into the cur-
input file. The b rent input file. The b
is followed by a single character (shown as is followed by a single character (shown as
[4mX[24m above) which spec‐ [4mX[24m above) which spec‐
ifies the line whose byte offset is to be used. If ifies the line whose byte offset is to be used.
the charac‐ If the charac‐
ter is a "t", the byte offset of the top line in ter is a "t", the byte offset of the top line in
the display is the display is
used, an "m" means use the middle line, a "b" means used, an "m" means use the middle line, a "b" means
use the bot‐ use the bot‐
tom line, a "B" means use the line just after the tom line, a "B" means use the line just after the
bottom line, bottom line,
and a "j" means use the "target" line, as specified and a "j" means use the "target" line, as speci-
by the ‐j fied by the ‐j
option. option.
%B Replaced by the size of the current input file. %B Replaced by the size of the current input file.
%c Replaced by the column number of the text appearing %c Replaced by the column number of the text appearing
in the first in the first
column of the screen. column of the screen.
%d[4mX[24m Replaced by the page number of a line in the %d[4mX[24m Replaced by the page number of a line in
input file. The the input file. The
line to be used is determined by the [4mX[24m, as line to be used is determined by the [4mX[24m, as
with the %b option. with the %b option.
%D Replaced by the number of pages in the input %D Replaced by the number of pages in the input file,
file, or equiva‐ or equiva‐
lently, the page number of the last line in the in- lently, the page number of the last line in the in-
put file. put file.
%E Replaced by the name of the editor (from the VISUAL %E Replaced by the name of the editor (from the VIS-
environment UAL environment
variable, or the EDITOR environment variable if variable, or the EDITOR environment variable if
VISUAL is not VISUAL is not
defined). See the discussion of the LESSEDIT fea- defined). See the discussion of the LESSEDIT fea-
ture below. ture below.
%f Replaced by the name of the current input file. %f Replaced by the name of the current input file.
%F Replaced by the last component of the name of the %F Replaced by the last component of the name of the
current input current input
file. file.
%i Replaced by the index of the current file in the %g Replaced by the shell‐escaped name of the current
list of input input file.
This is useful when the expanded string will be
used in a shell
command, such as in LESSEDIT.
%i Replaced by the index of the current file in the
list of input
files. files.
%l[4mX[24m Replaced by the line number of a line in the %l[4mX[24m Replaced by the line number of a line in
input file. The the input file. The
line to be used is determined by the [4mX[24m, as line to be used is determined by the [4mX[24m, as
with the %b option. with the %b option.
%L Replaced by the line number of the last line in the %L Replaced by the line number of the last line in the
input file. input file.
%m Replaced by the total number of input files. %m Replaced by the total number of input files.
%p[4mX[24m Replaced by the percent into the current %p[4mX[24m Replaced by the percent into the current in-
input file, based on put file, based on
byte offsets. The line used is determined by the byte offsets. The line used is determined by the
[4mX[24m as with the [4mX[24m as with the
%b option. %b option.
%P[4mX[24m Replaced by the percent into the current %P[4mX[24m Replaced by the percent into the current in-
input file, based on put file, based on
line numbers. The line used is determined by the line numbers. The line used is determined by the
[4mX[24m as with the [4mX[24m as with the
%b option. %b option.
%s Same as %B. %s Same as %B.
%t Causes any trailing spaces to be removed. Usual- %t Causes any trailing spaces to be removed. Usually
ly used at the used at the
end of the string, but may appear anywhere. end of the string, but may appear anywhere.
%T Normally expands to the word "file". However if %T Normally expands to the word "file". However if
viewing files viewing files
via a tags list using the ‐t option, it ex- via a tags list using the ‐t option, it expands
pands to the word to the word
"tag". "tag".
%x Replaced by the name of the next input file in the %x Replaced by the name of the next input file in the
list. list.
If any item is unknown (for example, the file size if in- If any item is unknown (for example, the file size if in-
put is a pipe), put is a pipe),
a question mark is printed instead. a question mark is printed instead.
The format of the prompt string can be changed depend- The format of the prompt string can be changed depending
ing on certain on certain
conditions. A question mark followed by a single charac- conditions. A question mark followed by a single char-
ter acts like acter acts like
an "IF": depending on the following character, a condi- an "IF": depending on the following character, a condi-
tion is evalu‐ tion is evalu‐
ated. If the condition is true, any characters following ated. If the condition is true, any characters following
the question the question
mark and condition character, up to a period, are mark and condition character, up to a period, are in-
included in the cluded in the
prompt. If the condition is false, such characters are prompt. If the condition is false, such characters are
not included. not included.
A colon appearing between the question mark and the peri- A colon appearing between the question mark and the period
od can be used can be used
to establish an "ELSE": any characters between the colon to establish an "ELSE": any characters between the colon
and the period and the period
are included in the string if and only if the IF condi- are included in the string if and only if the IF condi-
tion is false. tion is false.
Condition characters (which follow a question mark) may Condition characters (which follow a question mark) may
be: be:
?a True if any characters have been included in the ?a True if any characters have been included in the
prompt so far. prompt so far.
?b[4mX[24m True if the byte offset of the specified ?b[4mX[24m True if the byte offset of the specified
line is known. line is known.
?B True if the size of current input file is known. ?B True if the size of current input file is known.
?c True if the text is horizontally shifted (%c is not ?c True if the text is horizontally shifted (%c is not
zero). zero).
?d[4mX[24m True if the page number of the specified ?d[4mX[24m True if the page number of the specified
line is known. line is known.
?e True if at end‐of‐file. ?e True if at end‐of‐file.
?f True if there is an input filename (that is, if in- ?f True if there is an input filename (that is, if
put is not a input is not a
pipe). pipe).
?l[4mX[24m True if the line number of the specified ?l[4mX[24m True if the line number of the specified
line is known. line is known.
?L True if the line number of the last line in the ?L True if the line number of the last line in the
file is known. file is known.
?m True if there is more than one input file. ?m True if there is more than one input file.
?n True if this is the first prompt in a new input ?n True if this is the first prompt in a new input
file. file.
?p[4mX[24m True if the percent into the current input ?p[4mX[24m True if the percent into the current input
file, based on byte file, based on byte
offsets, of the specified line is known. offsets, of the specified line is known.
?P[4mX[24m True if the percent into the current input ?P[4mX[24m True if the percent into the current input
file, based on line file, based on line
numbers, of the specified line is known. numbers, of the specified line is known.
?s Same as "?B". ?s Same as "?B".
?x True if there is a next input file (that is, ?x True if there is a next input file (that is, if
if the current the current
input file is not the last one). input file is not the last one).
Any characters other than the special ones (question Any characters other than the special ones (question
mark, colon, mark, colon,
period, percent, and backslash) become literally part period, percent, and backslash) become literally part of
of the prompt. the prompt.
Any of the special characters may be included in the Any of the special characters may be included in the
prompt literally prompt literally
by preceding it with a backslash. by preceding it with a backslash.
Some examples: Some examples:
?f%f:Standard input. ?f%f:Standard input.
This prompt prints the filename, if known; otherwise the This prompt prints the filename, if known; otherwise the
string "Stan‐ string "Stan‐
dard input". dard input".
?f%f .?ltLine %lt:?pt%pt:?btByte %bt:‐... ?f%f .?ltLine %lt:?pt%pt:?btByte %bt:‐...
This prompt would print the filename, if known. The file- This prompt would print the filename, if known. The
name is fol‐ filename is fol‐
lowed by the line number, if known, otherwise the per- lowed by the line number, if known, otherwise the per-
cent if known, cent if known,
otherwise the byte offset if known. Otherwise, a dash otherwise the byte offset if known. Otherwise, a
is printed. dash is printed.
Notice how each question mark has a matching period, Notice how each question mark has a matching period, and
and how the % how the %
after the %pt is included literally by escaping it with a after the %pt is included literally by escaping it with a
backslash. backslash.
?n?f%f .?m(%T %i of %m) ..?e(END) ?x‐ Next %x..%t"; ?n?f%f .?m(%T %i of %m) ..?e(END) ?x‐ Next %x..%t";
This prints the filename if this is the first prompt in a This prints the filename if this is the first prompt in
file, fol‐ a file, fol‐
lowed by the "file N of N" message if there is more lowed by the "file N of N" message if there is more
than one input than one input
file. Then, if we are at end‐of‐file, the string "(END)" file. Then, if we are at end‐of‐file, the string
is printed "(END)" is printed
followed by the name of the next file, if there is one. followed by the name of the next file, if there is one.
Finally, any Finally, any
trailing spaces are truncated. This is the default trailing spaces are truncated. This is the default
prompt. For refer‐ prompt. For refer‐
ence, here are the defaults for the other two ence, here are the defaults for the other two prompts
prompts (‐m and ‐M (‐m and ‐M
respectively). Each is broken into two lines here for respectively). Each is broken into two lines here
readability for readability
only. only.
?n?f%f .?m(%T %i of %m) ..?e(END) ?x‐ Next %x.: ?n?f%f .?m(%T %i of %m) ..?e(END) ?x‐ Next %x.:
?pB%pB:byte %bB?s/%s...%t ?pB%pB:byte %bB?s/%s...%t
?f%f .?n?m(%T %i of %m) ..?ltlines %lt‐%lb?L/%L. : ?f%f .?n?m(%T %i of %m) ..?ltlines %lt‐%lb?L/%L. :
byte %bB?s/%s. .?e(END) ?x‐ Next %x.:?pB%pB..%t byte %bB?s/%s. .?e(END) ?x‐ Next %x.:?pB%pB..%t
And here is the default message produced by the = command: And here is the default message produced by the = command:
?f%f .?m(%T %i of %m) .?ltlines %lt‐%lb?L/%L. . ?f%f .?m(%T %i of %m) .?ltlines %lt‐%lb?L/%L. .
byte %bB?s/%s. ?e(END) :?pB%pB..%t byte %bB?s/%s. ?e(END) :?pB%pB..%t
The prompt expansion features are also used for another The prompt expansion features are also used for another
purpose: if an purpose: if an
environment variable LESSEDIT is defined, it is used as environment variable LESSEDIT is defined, it is used as
the command to the command to
be executed when the v command is invoked. The be executed when the v command is invoked. The LESSED-
LESSEDIT string is IT string is
expanded in the same way as the prompt strings. The de- expanded in the same way as the prompt strings. The de-
fault value for fault value for
LESSEDIT is: LESSEDIT is:
%E ?lm+%lm. %f %E ?lm+%lm. %g
Note that this expands to the editor name, followed by a + Note that this expands to the editor name, followed by a +
and the line and the line
number, followed by the file name. If your editor does number, followed by the shell‐escaped file name. If
not accept the your editor does
"+linenumber" syntax, or has other differences in invo- not accept the "+linenumber" syntax, or has other differ-
cation syntax, ences in invo‐
the LESSEDIT variable can be changed to modify this de- cation syntax, the LESSEDIT variable can be changed
fault. to modify this
default.
[1mSECURITY[0m [1mSECURITY[0m
When the environment variable LESSSECURE is set to 1, When the environment variable LESSSECURE is set to 1,
[4mless[24m runs in a [4mless[24m runs in a
"secure" mode. This means these features are disabled: "secure" mode. This means these features are disabled:
! the shell command ! the shell command
| the pipe command | the pipe command
skipping to change at line 2473 skipping to change at line 2527
TERM The type of terminal on which [4mless[24m is being TERM The type of terminal on which [4mless[24m is being
run. run.
VISUAL The name of the editor (used for the v command). VISUAL The name of the editor (used for the v command).
[1mSEE ALSO[0m [1mSEE ALSO[0m
lesskey(1) lesskey(1)
[1mCOPYRIGHT[0m [1mCOPYRIGHT[0m
Copyright (C) 1984‐2017 Mark Nudelman Copyright (C) 1984‐2018 Mark Nudelman
less is part of the GNU project and is free software. You less is part of the GNU project and is free software. You
can redis‐ can redis‐
tribute it and/or modify it under the terms of either (1) tribute it and/or modify it under the terms of either (1)
the GNU Gen‐ the GNU Gen‐
eral Public License as published by the Free Software eral Public License as published by the Free Software
Foundation; or Foundation; or
(2) the Less License. See the file README in the less (2) the Less License. See the file README in the less
distribution for distribution for
more details regarding redistribution. You should have more details regarding redistribution. You should have
skipping to change at line 2511 skipping to change at line 2565
[1mAUTHOR[0m [1mAUTHOR[0m
Mark Nudelman Mark Nudelman
Send bug reports or comments to <bug‐less@gnu.org> Send bug reports or comments to <bug‐less@gnu.org>
See http://www.greenwoodsoftware.com/less/bugs.html for See http://www.greenwoodsoftware.com/less/bugs.html for
the latest list the latest list
of known bugs in less. of known bugs in less.
For more information, see the less homepage at For more information, see the less homepage at
http://www.greenwoodsoftware.com/less. http://www.greenwoodsoftware.com/less.
Version 530: 05 Dec 2017 Version 548: 17 Dec 2018
LESS(1) LESS(1)
 End of changes. 112 change blocks. 
414 lines changed or deleted 468 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)