美文网首页
whereis & locate

whereis & locate

作者: 美得冒泡的姗迪 | 来源:发表于2017-08-11 11:54 被阅读0次

whereis

程序名的搜索,比find快,原理是查找linux系统的“文件数据库”,该数据库更新周期是一周,查找不够准确。

-b        查找二进制文件
-B<目录>   在设置的目录下查找二进制文件
-f        不展示文件名前的路径
-s        只查找原始文件
-u        查找不包含指定类型的文件
-m        只查找说明文件

eg:
whereis  -b   svn

locate

locate命令相当于find -name, 但是比后者更快
区别:
find -name 搜索具体目录
locate     查询数据库/var/lib/locatedb(含有本地所有文件信息,此库每日更新一次,查不到最新变动),为了能够查到足心变动,先使用updatedb 更新库

touch ab.txt

locate ab.txt 
 /Document/catherine.liu/mydir/ab.txt

sudo updatedb
locate ab.txt 
 /Document/catherine.liu/ab.txt
 /Document/catherine.liu/mydir/ab.txt

相关文章

网友评论

      本文标题:whereis & locate

      本文链接:https://www.haomeiwen.com/subject/btulrxtx.html