linux 搜索文件夹

locate:定位文件文件

[root@Linux one]# touch 001.txt
[root@Linux one]# locate 001.txt

发现这个命令找不到新建立的文件,所以我们要使用这个命令搜索文件之前,必须自己更新一下数据库,如下操作:

[root@Linux one]# updatedb
[root@Linux one]# locate 001.txt
/root/one/001.txt

看看,如果执行updatedb这个命令更新数据库之后,我们就可以找到我们所需要的数据。不过更新数据库的时间需要一段时间。

 

 

 

 

可能会提示以下问题:

 

-bash: locate: command not found

解决办法:

yum -y install mlocate   下载mlocate   包即可

 

上一篇:[javaweb]strut2-001漏洞分析


下一篇:MySQL基本操作 笔记001