15

Right now, all I know to use is:

find / -name string.*

that is case sensitive and it won't find files named:

1string.x
STRing.x
string1.x

How can I search so that all the above would be returned in the search to a case-insensitive matching?

Inian
  • 80,270
  • 14
  • 142
  • 161
Captain Claptrap
  • 3,839
  • 5
  • 25
  • 29

5 Answers5

26

Use the -iname option instead of -name.

llasram
  • 4,417
  • 28
  • 28
7

Or you could use find / | grep -i string

DigitalRoss
  • 143,651
  • 25
  • 248
  • 329
  • 1
    `find` does this natively. Creating another process just to do that is going to make it slower. – Daenyth Sep 23 '10 at 01:16
  • True but it's easy to remember and consistent with the software tools pattern. Find does do shell globbing on plain old `-name`, it is true. – DigitalRoss Sep 23 '10 at 19:03
6

This works as well, if you want to avoid the single quotes:

find . -iname \*string\*
2

Use -iname in find for case insensitive file name matches.

Anya Shenanigans
  • 91,618
  • 3
  • 107
  • 122
1

If the system you are in does not have the find command provided by the GNU utils package, you can use the -name tag alone with POSIX bracket expressions as

find . -name '*[Ss][Tt][Rr]ing*'
Inian
  • 80,270
  • 14
  • 142
  • 161