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

孤者浪人 提交于 2019-12-19 05:22:17

问题


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?


回答1:


Or you could use find / | grep -i string




回答2:


Use the -iname option instead of -name.




回答3:


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

find . -iname \*string\*



回答4:


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




回答5:


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*'


来源:https://stackoverflow.com/questions/3770866/ignore-case-when-trying-to-match-file-names-using-find-command-in-linux

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!