你的位置:首页 > Linux系统
在用locate查找命令找文件时提示如下:
[root@v6 upload]#locate passwd -bash: locate: command not found
找不到命令一般都是没有安装相关的包,于是执行一下命令安装:
yum install locate
结果是 No package locate available
执行updatedb试试,同样提示:
-bash:updatedb:command not found
于是执行以下命令查找locate命令属于哪个包:
[root@v6 upload]# yum provides locate Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.unifiedlayer.com * elrepo: repos.lax-noc.com * elrepo-kernel: repos.lax-noc.com * epel: mirrors.develooper.com * extras: centos-distro.cavecreek.net * updates: mirror.hostduplex.com mlocate-0.26-8.el7.x86_64 : An utility for finding files by name Repo : base
知道属于哪个包就简单了
[root@v6 upload]# yum -y install mlocate Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.unifiedlayer.com * elrepo: repos.lax-noc.com * elrepo-kernel: repos.lax-noc.com * epel: mirrors.develooper.com * extras: centos-distro.cavecreek.net * updates: mirror.hostduplex.com Resolving Dependencies --> Running transaction check ---> Package mlocate.x86_64 0:0.26-8.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ===================================================================================================================================================== Package Arch Version Repository Size ===================================================================================================================================================== Installing: mlocate x86_64 0.26-8.el7 base 113 k Transaction Summary ===================================================================================================================================================== Install 1 Package Total download size: 113 k Installed size: 379 k Downloading packages: mlocate-0.26-8.el7.x86_64.rpm | 113 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : mlocate-0.26-8.el7.x86_64 1/1 Verifying : mlocate-0.26-8.el7.x86_64 1/1 Installed: mlocate.x86_64 0:0.26-8.el7 Complete!
安装成功!执行locate passwd 来搜索文件还是有报错:
[root@v6 upload]# locate passwd locate: can not stat () `/var/lib/mlocate/mlocate.db': No such file or directory
还要使用updatedb命令来创建locate命令依赖的数据库:
[root@v6 upload]# updatedb
下面就可以使用locate命令了
[root@v6 upload]# locate passwd /etc/passwd /etc/passwd- /etc/pam.d/passwd /etc/security/opasswd /usr/bin/gpasswd /usr/bin/grub2-mkpasswd-pbkdf2 /usr/bin/ldappasswd /usr/bin/passwd /usr/include/rpcsvc/yppasswd.h /usr/include/rpcsvc/yppasswd.x /usr/lib/firewalld/services/kpasswd.xml /usr/lib64/openldap/back_passwd-2.4.so.2 /usr/lib64/openldap/back_passwd-2.4.so.2.10.7 /usr/lib64/openldap/back_passwd.la /usr/lib64/security/pam_unix_passwd.so /usr/local/webserver/proftpd/bin/ftpasswd /usr/local/webserver/proftpd/etc/ftpd.passwd /usr/local/webserver/proftpd/share/man/man1/ftpasswd.1 /usr/sbin/chpasswd /usr/sbin/lpasswd ......

- 发表评论
- 查看评论
【暂无评论!】发表评论: