Linux updatedb 命令

Linux 教程 · 2019-02-14 11:00:00

updatedb 命令用来创建或更新 slocate/locate 命令所必需的数据库文件。

updatedb 命令的执行过程较长,因为在执行时它会遍历整个系统的目录树,并将所有的文件信息写入 slocate/locate 数据库文件中。

注意:slocate 本身具有一个数据库,里面存放了系统中文件与目录的相关信息。

语法

updatedb(选项)

参数

  • -o<文件>:忽略默认的数据库文件,使用指定的slocate数据库文件;
  • -U<目录>:更新指定目录的slocate数据库;
  • -v:显示执行的详细过程。

以下实例检测一个未存在的文件 codercto.txt:

# locate codercto.txt   # 检索 codercto.txt,没有任何输出,表示没有该文件
# touch ./codercto.txt  # 添加文件 codercto.txt
# locate codercto.txt   # 再次检索 codercto.txt,依然没有该文件
# updatedb            # 更新 locate.db 数据库
# locate codercto.txt   # 再次数据库检索 codercto.txt,找到该文件
/root/codercto/codercto.txt

使用 -U 选项可以指定要更新 slocate 数据库的目录。

updatedb -U /root/codercto/

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

查看所有标签

Pattern Recognition and Machine Learning

Pattern Recognition and Machine Learning

Christopher Bishop / Springer / 2007-10-1 / USD 94.95

The dramatic growth in practical applications for machine learning over the last ten years has been accompanied by many important developments in the underlying algorithms and techniques. For example,......一起来看看 《Pattern Recognition and Machine Learning》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具