紅聯Linux門戶
Linux幫助

Linux/Centos在用搜索命令locate時command not found問題

發布時間:2017-06-21 11:26:50來源:linux網站作者:Jolly_xue
在用locate查找命令找文件時提示如下:
-bash: locate: command not found
 
所以就想著是不是locate要yum來安裝才可以呢,于是:
[[email protected] ~]# yum install locate
結果是No package locate available
 
接著就updatedb試試,提示:
-bash:updatedb:command not found
 
網上查了一下要先安裝mlocate相應的包才可以,以前是slocate現在已被mlocate取代。
 
故:[[email protected] ~]# yum -y install mlocate
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mlocate.x86_64 0:0.22.2-6.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
Package  Arch  Version  Repository  Size
Installing:
mlocate  x86_64  0.22.2-6.el6  base  86 k
Transaction Summary
Install       1 Package(s)
Total download size: 86 k
Installed size: 279 k
Downloading Packages:
mlocate-0.22.2-6.el6.x86_64.rpm  |  86 kB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : mlocate-0.22.2-6.el6.x86_64  1/1
Verifying  : mlocate-0.22.2-6.el6.x86_64  1/1
Installed:
mlocate.x86_64 0:0.22.2-6.el6
Complete!
 
安裝成功!執行locate passwd來搜索文件還是有報錯:
[[email protected] ~]# locate passwd
locate: can not stat () `/var/lib/mlocate/mlocate.db': No such file or directory
 
還要使用updatedb命令來創建locate命令依賴的數據庫:
[[email protected] ~]# updatedb
 
下面就可以使用locate命令了。
 
本文永久更新地址:http://www.1851002.live/linux/31637.html
贵州体彩11选5查询号码 北京11选5前三走势图 保定哪期货配资做得好 安徽十一选五前三走势图 山西快乐十分近50期 湖南快乐十分开奖号码 在线配资代理 今日广西十一选五 江西十一选五走势图彩经网 时时彩官方开奖视频 重庆快乐十分属于福利彩票吗