Man is calling Less; the only control at the man level is choosing which options to call Less with.
Less's search case-sensitivity is controlled by two options.
- If
-I
is in effect, then searches are case-insensitive: either a
or A
can be used to match both a
and A
.
- If
-i
is in effect but not -I
, then searches are case-insensitive, but only if the pattern contains no uppercase letter.
If you make -I
a default option for Less, then all searches will be case-insensitive even in man pages.
Man-db passes extra options to the pager via the LESS
environment variable, which Less interprets in the same way as command line options. The setting is hard-coded at compile time and starts with -i
. (The value is "-ix8RmPm%s$PM%s$"
as of Man-db 2.6.2; the P…$
part is the prompt string.)
If you don't want searches in man pages to be case-sensitive, or if you want them to be always case-insensitive, there is no way to configure this in man-db itself. You can make an alias for man
or a wrapper script that manipulates the LESS
enviroment variable, as Man-db prepends its content to the current value if present:
alias man='LESS="$LESS -I" man'
To turn off the -i
option and thus make searches always case-sensitive by default in man pages:
alias man='LESS="$LESS -+i" man'
You can also hard-code a different value for LESS
by setting the MANLESS
environment variable, but if you do that, then man
just sets LESS
to the value of MANLESS
, you lose the custom title line (“Manual page foo(42)
”) and other goodies (in particular, make sure to include -R
for bold and underline formatting).
LESS
environment variable contains-i
. – manatwork Apr 11 '14 at 13:45less
do you have? Do you have an alias set forless
? Is the LESS or LESSOPEN env vars set? By default aless
search forx
only matchesx
, notX
– bsd Apr 11 '14 at 13:46echo $LESS
= nothing. Note is it not case insensitve -- but it only enforces sensitivity WRT upper case. @bdowningalias | grep less
= nothing. Just noticed it only applies viaman
(it's mandb, btw)., however. I'm sure I've read about this before somewhere... – goldilocks Apr 11 '14 at 15:58-i
works. I'm going to change the question to refer toman
specifically and add that as an answer (see previous comment). – goldilocks Apr 11 '14 at 16:02