Trying to find out how to use case-insensitive searches in less I found this on serverfault.

That seems to perfectly answer my question. The problem is: It doesn't work like that here (OpenSUSE 13.1; less 458).

I had aliased less to less -WiNS but I changed that. But even calling it as command less file does not change anything. I have checked with ps that there is no -i option in the command line any more.

As the answer says the less help (pressing h) states that I can use -i within less, too. If I use that once then less tells me it had changed to case-insensitive search (that is kind of correct: nothing changes). If I use it twice then less tells me it had turned to case-sensitive search. And right, then it works as it should from the start. Giving -i twice on the command line does not work, though.

What's up here?

  • 3
    GNU less doesn't work like that for me (i.e., it is by default case sensitive). Are you sure it's not aliased? What options are you using with ps to check that?
    – goldilocks
    Feb 22, 2014 at 14:05
  • 3
    Hmm. Never noticed this but you're absolutely correct. Searching for FOO finds just FOO, but searching for foo finds foo & FOO. Even with the -i and -WiNS.
    – slm
    Feb 22, 2014 at 14:15
  • @goldilocks With ps I get either no (command less) options or -WNS so I am quite sure this is not a ps problem hiding -i/-I. less seems to have not even the possibility of a config file which could intervene here. Feb 22, 2014 at 14:20
  • @slm "even with -i" is kind of funny because -i is supposed to do exactly that. The interesting question is: Does your less match FOO for foo without -i? Feb 22, 2014 at 14:21
  • 1
    Nope it works the other way. FOO only matches FOO. Seems like a bug to me.
    – slm
    Feb 22, 2014 at 14:24

6 Answers 6


I'm not sure how to enable this from the command line but when you're inside of less you can toggle the behavior you want by giving the -i command to less.

toggling -i

      ss #1        ss #2

searching for /blah and /BLAH

      ss #3       ss #4

searching for /Blah

      ss #5

Apparently you can also summon this mode on demand by suffixing your searches with a -i.


less prompt> /search string/-i


  • That works for me, too, but I have to enter that twice. I guess I will write a bug report for openSUSE. Feb 22, 2014 at 14:58
  • 2
    No, but I have found out something interesting (not related to this "bug", though): You can use -i even after a search. The highlighting changes then (if it is active yet). Feb 22, 2014 at 15:03
  • 4
    Suffixing doesn't appear to work in less 487 (GNU regular expressions) (from Ubuntu 18.04)
    – Ruslan
    Sep 23, 2019 at 9:35
  • 2
    Suffixing -i, like /Throw/-i, in less env does not work in less 551, Lubuntu 20.04 and toggling does not work either. I am less-lost?
    – Timo
    May 16, 2021 at 7:11
  • 1
    You can also toggle this setting live while less is running by typing -i and pressing Enter. Dec 7, 2022 at 21:49

You can start less and ignore case by passing the -i option. This ignores case unless the search string has an upper-case character. Here is the summary on less from the Ubuntu help page:

   -i or --ignore-case
          Causes searches to ignore case; that is, uppercase  and  lowercase  are  considered
          identical.   This  option  is ignored if any uppercase letters appear in the search
          pattern; in other words, if a pattern contains uppercase letters, then that  search
          does not ignore case.

   -I or --IGNORE-CASE
          Like -i, but searches ignore case even if the pattern contains uppercase letters.

Other versions of less may vary in their interpretations of -i.

  • Once you have started less, you can type -i , and it will enable the ignore case option. You don't have to pass it as an argument in the command-line.
    – Flimm
    Aug 15, 2023 at 7:40

The manual (for my less, version 444) says:

      Options are also taken from the environment variable "LESS".  For exam‐
   ple, to avoid typing "less -options ..." each time less is invoked, you
   might tell csh:

   setenv LESS "-options"

   or if you use sh:

   LESS="-options"; export LESS

   On  MS-DOS,  you don't need the quotes, but you should replace any per‐
   cent signs in the options string by double percent signs.

   The environment variable is parsed before the command line, so  command
   line  options  override  the  LESS  environment variable.
       On  MS-DOS,  you don't need the quotes, but you should replace any per‐
   cent signs in the options string by double percent signs.

   The environment variable is parsed before the command line, so  command
   line  options  override  the  LESS  environment variable.  If an option
   appears in the LESS variable, it can be reset to its default  value  on
   the command line by beginning the command line option with "-+".

So, I would check if the environment variable LESS might be set somewhere, in your shell "dot files" perhaps. Also, less -+i should reset the -i to its default (which is case-sensitive). If that brings back the case-sensitivity for you, then you could just alias less=less -+i, maybe together with alias lessi=less -i.


Quick guide in 2 steps: Do your search:

:/put search lowercase word here after slash

Then after all the case sensitive matches are highlighted:


This will highlight all matches regardless of case.

  • 2
    It works if I enter type, then Type found. If I enter Throw, throw not found.Wait, see Oday's answer.
    – Timo
    May 16, 2021 at 7:18

You can pass parameter to the less command when you open your file, and all your searches will be case insensitive.

$ less -i <file_name>

or you can modify your .bashrc file so it your less will always be case-insensitive

export LESS="-i"

For what it's worth, I had something of the opposite problem: on the system I was working on, searches within less were always case insensitive. After some investigation, I discovered that the $LESS shell environment variable was being set to a default value, which included the -I flag. I was able to override the defaults by setting it within my user shell setting (~/.bashrc).

If you are experiencing something similar (with less behaving differently to what you would expect without explicitly directing it to run in case-insenstive mode, for example), you could try running env | grep LESS.

  • 2
    env | grep LESS instead of just echo "$LESS"? ;-) Nov 30, 2022 at 22:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .