find locate通配符
Find 通配符 locate
2023-09-27 14:27:31 时间
通配符
find
和locate
指令在实际使用中会用到通配符(wildcards),通配符有一些特殊的含义:
-
*
没有或者任意个字符 -
?
无论如何得仅有一个字符 -
[string]
指定范围内的一个字符。如[a-z0-9_]
表示的就是一个字符可能是小写字母、数字或下划线 ,最前面加上!
或者^
表示取反。(这个叫做character classes) -
\
去除转义,可以用在character classes
为了能够正常搜索到隐藏文件或左斜杠,匹配时.
或者/
都没有特殊函数含义。*macs
匹配.macs
; foo*bar
匹配foo3/bar
。
使用单引号或者双引号防止shell变量扩展对查找的影响。
Tips:locate命令简化:你可以使用--limit
控制匹配个数,--count
只输出个数如:locate vel.txt --count
几个例子
-
find /home/junwu/Desktop/t1 -name test.cpp
精确列出t1文件夹下的所有文件名为test.cpp
-
find /home/junwu/Desktop/t1 -name test?.cpp
想查找test后有一个2的cpp文件 -
find /home/junwu/Destop/t1 -name test*
想查找文件开始为test的所有文件 -
find /home/junwu/Desktop/t1 -name *test.so
查找动态库test
相关文章
- Spring 测试运行的时候提示 Unable to find a @SpringBootConfiguration 错误
- Didn't find class "android.view.View$OnUnhandledKeyEventListener" on path: DexPathList
- 解决find命令报错: paths must precede expression
- 一天一个 Linux 命令(17):find 命令
- Cannot find module 'webpack-cli/bin/config-yargs'
- Could not find com.android.tools.build:gradle:3.0.0-alpha3
- Could not find the required component ‘tf2_geometry_msgs‘. The following CMake error indicates that
- go:cannot find main module;see 'go help modules'
- make报错:"/usr/bin/ld: cannot find -lXXX"
- [LeetCode] 277. Find the Celebrity 寻找名人
- leetcode算法: Find the Difference
- ubuntu php 出现 Cannot find module (SNMPv2-TC) 等错误
- 奇怪,Linux下命令可以执行但find查找不到路径
- make报错:"/usr/bin/ld: cannot find -lXXX"