It's explained in the man page for less
.
The default action for REs is to ignore case if there are no uppercase characters present, but to act case-sensitively otherwise.
There are three modes available within less
:
- Case context dependent: a search or RE without uppercase characters is considered to be case-insensitive, but a search or RE containing at least one uppercase character is considered to be case-sensitive. Examples:
abc
will match abc
and aBC
, but aBc
will only match aBc
and not abc
or ABC
. This is the default setting.
- Case sensitive: a search or RE pays full regard to the case of any letter. Example:
abC
will match only abC
and not abc
or ABC
.
- Case insensitive: a search or RE pays no regard to the case of any letter. Example:
abC
will match any of abc
, abC
, or ABC
.
You can toggle case sensitive comparisons with -I
, and case context sensitive comparisons with -i
.
The control can be specified in three ways:
- On the command line, for example
less -I bigfile.txt
.
- In the environment, for example
export LESS=-i
and later less bigfile.txt
.
- Within
less
itself, for example by starting less bigfile.txt
and then typing -i
.