100

I am not able to figure out how can I do case-insensitive search using the find command.

I tried

find . -name -i pattern

And it does not work.

Wuffers
  • 19,020
  • 17
  • 95
  • 126
Vikash Jindal
  • 1,133
  • 2
  • 8
  • 7

3 Answers3

126

Use this:

find . -iname PatTeRn -print
soandos
  • 24,206
  • 28
  • 102
  • 134
Sandeep Singh
  • 1,582
  • 2
  • 11
  • 10
  • 1. Providing the `-print` flag is redundant because if omitted, this is actually the default behavior. 2. TIL that the double quotes around the search term are optional. – rodey Mar 30 '20 at 15:07
44

I believe it's: find . -iname pattern

From man find:

-iname pattern
       Like  -name, but the match is case insensitive.
Wuffers
  • 19,020
  • 17
  • 95
  • 126
karlphillip
  • 1,021
  • 1
  • 10
  • 16
10
sudo updatedb

locate -i "nameofthefile"

nameofthefile should be without the inverted commas.

Indrek
  • 24,204
  • 14
  • 90
  • 93
Ransell
  • 101
  • 1
  • 2