开发者

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

开发者 https://www.devze.com 2023-01-17 08:20 出处:网络
Right now, all I know to use is: find / -name string.* that is case sensitive and it won\'t find files 开发者_StackOverflow中文版named:

Right now, all I know to use is:

find / -name string.*

that is case sensitive and it won't find files 开发者_StackOverflow中文版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?


Use the -iname option instead of -name.


Or you could use find / | grep -i string


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

find . -iname \*string\*


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


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

精彩评论

暂无评论...
验证码 换一张
取 消