linux命令之locate
来源:互联网 发布:钉钉 心知天气 编辑:程序博客网 时间:2024/05/16 08:11
作用:
locate(locate) 命令用来查找文件或目录, locate命令要比find -name快得多,原因在于它不搜索具体目录,而是搜索一个数据库/var/lib/mlocate/mlocate.dbLinux系统自动创建这个数据库,并且每天自动更新一次,因此,我们在用whereis和locate 查找文件时,有时会找到已经被删除的数据,或者刚刚建立文件,却无法查找到,原因就是因为数据库文件没有被更新。为了避免这种情况,可以在使用locate之前,先使用updatedb命令,手动更新数据库。整个locate工作其实是由四部分组成的:
/usr/bin/updatedb 主要用来更新数据库,通过crontab自动完成的
/usr/bin/locate 查询文件位置
/etc/updatedb.conf updatedb的配置文件
/var/lib/mlocate/mlocate.db 存放文件信息的文件
-b, --basename match only the base name of path names
-c, --count 只输出找到的数量
-d, --database DBPATH 使用DBPATH指定的数据库,而不是默认数据库 /var/lib/mlocate/mlocate.db
-e, --existing only print entries for currently existing files
-L, --follow follow trailing symbolic links when checking file existence (default)
-h, --help 显示帮助
-i, --ignore-case 忽略大小写
-l, --limit, -n LIMIT limit output (or counting) to LIMIT entries
-m, --mmap ignored, for backward compatibility
-P, --nofollow, -H don't follow trailing symbolic links when checking file existence
-0, --null separate entries with NUL on output
-S, --statistics don't search for entries, print statistics about eachused database
-q, --quiet 安静模式,不会显示任何错误讯息
-r, --regexp REGEXP 使用基本正则表达式
--regex 使用扩展正则表达式
-s, --stdio ignored, for backward compatibility
-V, --version 显示版本信息
-w, --wholename match whole path name (default)
实例
[root@cs70-moban ~]# locate cat
/usr/share/mime/application/vnd.ms-word.template.macroEnabled.12.xml
/usr/share/mime/application/vnd.ms-works.xml
/usr/share/mime/application/vnd.ms-wpl.xml
/usr/share/mime/application/vnd.oasis.opendocument.chart-template.xml
/usr/share/mime/application/vnd.oasis.opendocument.chart.xml
/usr/share/mime/application/vnd.oasis.opendocument.database.xml
/usr/share/mime/application/vnd.oasis.opendocument.formula-template.xml
/usr/share/mime/application/vnd.oasis.opendocument.formula.xml
/usr/share/mime/application/vnd.oasis.opendocument.graphics-flat-xml.xml
/usr/share/mime/application/vnd.oasis.opendocument.graphics-template.xml
/usr/share/mime/application/vnd.oasis.opendocument.graphics.xml
/usr/share/mime/application/vnd.oasis.opendocument.image.xml
/usr/share/mime/application/vnd.oasis.opendocument.presentation-flat-xml.xml
/usr/share/mime/application/vnd.oasis.opendocument.presentation-template.xml
/usr/share/mime/application/vnd.oasis.opendocument.presentation.xml
/usr/share/mime/application/vnd.oasis.opendocument.spreadsheet-flat-xml.xml
/usr/share/mime/application/vnd.oasis.opendocument.spreadsheet-template.xml
/usr/share/mime/application/vnd.oasis.opendocument.spreadsheet.xml
/usr/share/mime/application/vnd.oasis.opendocument.text-flat-xml.xml
/usr/share/mime/application/vnd.oasis.opendocument.text-master.xml
/usr/share/mime/application/vnd.oasis.opendocument.text-template.xml
/usr/share/mime/application/vnd.oasis.opendocument.text-web.xml
/usr/share/mime/application/vnd.oasis.opendocument.text.xml
- linux命令之locate
- Linux命令之"locate"
- linux命令之locate
- Linux之locate命令详解
- linux查找命令之locate
- Linux进阶之 locate 命令
- 图解Linux命令之--locate命令
- Linux命令之locate命令详解
- WindowXp下仿Linux之locate命令
- Linux中文件搜索命令之locate
- linux 常用基本命令之十四 locate
- linux locate查找命令
- Linux命令:locate
- Linux常用命令:locate 命令
- linux命令(19):locate
- Linux-locate/slocate命令
- linux----locate命令
- Linux命令:locate
- Sources for Android API 23 Platfrom not found (Android Studio 2.0)
- #OSG+VS#第十一周
- CAE开发日志(7):动静分离
- POJ_2236_Wireless Network【并查集】
- angular js判断结束时间不能小于开始时间并且间隔不能超过30天
- linux命令之locate
- TensorFlow实现对数几率回归
- 从程序员到项目经理(5):程序员加油站 -- 不是人人都懂的学习要点
- 希尔排序算法(Shell Sort) Java实现
- String.format("%06d", i)
- vue2学习计划1-1 浏览器跨域问题
- 解决npm 的 shasum check failed for错误(npm注册国内镜像介绍)
- RELU 激活函数及其他相关的函数
- JDK/bin目录下不同exe文件的用途