linux 文件查询 (locate与find)
来源:互联网 发布:sql基础教程 pdf 编辑:程序博客网 时间:2024/06/10 22:02
文件查找:
1、locate 非实时,模糊查找,根据全系统文件数据库进行的;当时生成的文件查找不到,需手动生成:updatedb
locate安装:yum install -y mlocate
如出现: locate: can not stat () `/var/lib/mlocate/mlocate.db': 没有那个文件或目录,执行updatedb
直接对文件名进行搜索:
可跟目录路径进行搜索:
2、find 精确查询,向下递归查找
find 查找路径 查找标准 查找后处理动作
-regex 使用正则表达式
-name 文件名精确匹配 find 目录路径 -name 精确文件名-iname 不区分大小写 find 目录路径 -iname 精确文件名(不区分大小写)
-user 根据文件用户 (-uid 根据uid查找) find 目录路径 -user 用户名
-group 根据文件组 (-gid 根据gid查找) find 目录路径 -user 用户组
-nouser 查找没有用户的文件
-nogroup 查找没有用户组的文件
按文件类型查找:
-type
f 普通文件d 目录
l 链接文件
b 块设备文件
c 字符设备文件
按文件大小查找:(模糊范围内)
-size find 目录路径 -size [+-]n[kMG] (+:大于 , -:小于,n:大小 ,kMG:单位) find / -size +1k
kM
G
按时间(天)查找:[+:时间前 -:时间内] find 目录路径 -[mtime|ctime|atime] [+-]n find / -mtime +1
-mtime 修改时间 (写文件时间)
-ctime 状态时间 (文件属性发生变化)
-atime 访问时间 (读文件时间)
按时间(分钟)查找:[+:时间前 -:时间内]
-mmin
-cmin
-amin
按权限查找:
-perm 任意条件匹配(rwx:421 7)
/777 任意一位匹配 (只要有一个权限位匹配)
-777 文件权限能完全包含时匹配
查询包含两个以上查询内容(前后跟上述参数)
-a 与
-o 或
-not 取反
-ls 显示文件详细信息 find 文件路径 -name 文件名 -ls
将查询后结果加入命令中执行:
-exec COMMAND {} \; find 文件路径 -name 文件名 -exec 执行命令 {} \;
-ok COMMAND {} \; 需确认 find 文件路径 -name 文件名 -ok 执行命令 {} \;
阅读全文
0 0
- linux 文件查询 (locate与find)
- Linux 文件路径查询命令(find、locate、which、whereis)
- linux常用命令-查找文件(find/locate)
- 命令与文件的查询 which whereis locate find
- Linux之文件查找命令locate与find详解
- Linux文件查找命令之locate与find
- Linux基础-0001-文件查找:locate与find
- linux下文件的查询(find,which,whereis,locate)
- linux查询命令(find、locate和whereis)
- linux学习(9)命令与文件的搜寻(which,whereis,locate,find)
- linux命令:文件搜索(locate、whereis、which、find、grep)
- linux 文件的查找 find which locate
- linux文件查找命令locate和find
- Linux文件查找利器 locate & find
- 文件查找之locate与find
- linux中locate find 与 grep
- Linux 指令与文件的搜寻 —— which whereis locate updatedb find
- 文件查找locate、find
- BMA220 / BMA222E / BMA250E / BMA255和BMA280是14,8,10,6位三轴低g加速度传感器
- 软件工程(C编码实践篇)学习总结
- 在VS2013下编译caffe-windows,并加载已经训练好的caffemodel做图像分类
- POJ-2479 Maximum sum (线性dp 维护区间最大值 枚举)
- JavaScript event对象
- linux 文件查询 (locate与find)
- AbstractQueuedSynchronizer源码分析
- C++输入输出
- HTTP协议以及HTTP编程
- 递归条件一定要严谨
- springmvc框架
- http协议基础
- JAVA 函数如何对多个JSONArray取交集,取并集
- 声音分贝的概念,dBSPL.dBm,dBu,dBV,dBFS