locate - 查找文件的简单方法

locate 程序会执行一次快速的路径名数据库搜索,并且输出每个与给定子字符串相匹配的路径名。

使用时却发现archlinux出现

bash: locate:未找到命令

于是我找了一下archwiki,发现原来archlinux现在使用更加安全的mlocate来替换原来的locate,于是我进行了下载

yay locate

然后安装完成后,再次使用,却出现了下面的情况

locate: 无法执行 stat () `/var/lib/mlocate/mlocate.db': 没有那个文件或目录

再次查看wiki,发现了下面信息

Before locate(1) can be used, the database will need to be created, this is done with the updatedb(8) command, which (as the name suggests) updates the database.

这里的updatedb是需要在sudo或su的情况下运行的,于是便输入

sudo updatedb

稍等片刻,等运行完毕,再次使用

locate bin/zip
输出:
/usr/bin/zipcmp
/usr/bin/zipmerge
/usr/bin/ziptool

locate已经可以使用

内容来源于网络如有侵权请私信删除
你还没有登录,请先登录注册
  • 还没有人评论,欢迎说说您的想法!