在 Linux 中尝试使用 find 命令匹配文件名时忽略大小写

发布于 2024-09-24 23:09:01 字数 183 浏览 1 评论 0原文

现在,我所知道的就是:

find / -name string.*

区分大小写,并且找不到名为:

1string.x
STRing.x
string1.x

如何搜索以便在搜索中将上述所有内容返回到不区分大小写的匹配?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

长安忆 2024-10-01 23:09:01

使用 -iname 选项而不是 -name

Use the -iname option instead of -name.

笑,眼淚并存 2024-10-01 23:09:01

或者您可以使用 find / | grep -i 字符串

Or you could use find / | grep -i string

岁月如刀 2024-10-01 23:09:01

如果您想避免使用单引号,这也有效:

find . -iname \*string\*

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

find . -iname \*string\*
紫南 2024-10-01 23:09:01

在查找中使用 -iname 来匹配不区分大小写的文件名。

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

花海 2024-10-01 23:09:01

如果您所在的系统没有 GNU utils 软件包提供的 find 命令,您可以单独使用 -name 标记和 POSIX 括号表达式:

find . -name '*[Ss][Tt][Rr]ing*'

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*'
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文