Linux locate命令

Linux 教程 · 2019-02-13 20:29:34

Linux locate命令用于查找符合条件的文档,他会去保存文档和目录名称的数据库内,查找合乎范本样式条件的文档或目录。

一般情况我们只需要输入 locate your_file_name 即可查找指定文件。

语法

locate [-d ][--help][--version][范本样式...]

参数:

  • -d或--database= 配置locate指令使用的数据库。locate指令预设的数据库位于/var/lib/slocate目录里,文档名为slocate.db,您可使用 这个参数另行指定。
  • --help  在线帮助。
  • --version  显示版本信息。

实例

查找passwd文件,输入以下命令:

locate passwd

附加说明

locate与find 不同: find 是去硬盘找,locate 只在/var/lib/slocate资料库中找。

locate的速度比find快,它并不是真的查找,而是查数据库,一般文件数据库在/var/lib/slocate/slocate.db中,所以locate的查找并不是实时的,而是以数据库的更新为准,一般是系统自己维护,也可以手工升级数据库 ,命令为:

locate -u 

点击查看所有 Linux 教程 文章: https://codercto.com/courses/l/14.html

查看所有标签

Understanding Computation

Understanding Computation

Tom Stuart / O'Reilly Media / 2013-6-3 / USD 39.99

Finally, you can learn computation theory and programming language design in an engaging, practical way. Understanding Computation explains theoretical computer science in a context you'll recognize, ......一起来看看 《Understanding Computation》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

html转js在线工具
html转js在线工具

html转js在线工具