-bash: locate: command not found 解决办法

部分版本的linux系统使用locate快速查找某文件路径会报以下错误:

 -bash: locate: command not found

其原因是没有安装mlocate这个包

安装:yum -y install mlocate

安装完再尝试用locate定位内容,发现依然不能实用,报了新的错误:

locate: can not stat () `/var/lib/mlocate/mlocate.db': No such file or directory

原因是安装完后没有更新库

更新库:updatedb

添加新评论