Ignore case when trying to match file names using find command in Linux

前端 未结 5 1504
感情败类
感情败类 2021-01-11 10:52

Right now, all I know to use is:

find / -name string.*

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

1string.x
STR         


        
相关标签:
5条回答
  • 2021-01-11 11:21

    Use the -iname option instead of -name.

    0 讨论(0)
  • 2021-01-11 11:21

    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*'
    
    0 讨论(0)
  • 2021-01-11 11:35

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

    find . -iname \*string\*
    
    0 讨论(0)
  • 2021-01-11 11:36

    Or you could use find / | grep -i string

    0 讨论(0)
  • 2021-01-11 11:46

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

    0 讨论(0)
提交回复
热议问题