1. locate find 出來很多結果,? whereis find 只有下面的
find: /usr/bin/find /usr/bin/X11/find /usr/share/man/man1/find.1.gz
所以whereis關注binary,man,source file較多
2. locate bwengine.tra 會得到想要的結果, whereis bwengine.tra 什么結果也沒有
3. whereis在ubuntu上弱勢很多史飞,最多查找在PATH里面的可執(zhí)行文件负蠕,或者man路勁的文件九巡。
4. locate使用的數(shù)據(jù)庫文件在 /var/lib/mlocate/mlocate.db(當前我只看到這一個文件,5M大小了)
/etc/updatedb.conf 控制了locate的數(shù)據(jù)庫的更新,centos 5.x 默認每天更新一次室琢,所以可能看到舊的被刪除的文件乾闰,也可能看不到最新創(chuàng)建的文件。
需要的話盈滴,可以手動執(zhí)行 updatedb ,這樣/etc/updatedb.conf會被參考用來更新locate的數(shù)據(jù)庫涯肩。
5.?? type -a updatedb
updatedb is /usr/bin/updatedb
6.? 可以說locate的數(shù)據(jù)庫保存了系統(tǒng)所有文件的信息.所以查詢效率相當快。因此可以把他當做linux世界的everything了雹熬!唯一區(qū)別只是數(shù)據(jù)庫更新時間了宽菜。
7. 下面的函數(shù)則可以當做linux世界的filelocatorpro了:
alias fr='func_frahk(){ cd "$ahk";ag -i "$@" *;};func_frahk $@'
使用ag,ack,grep查找指定目錄及其子目錄下文件內容符合用戶輸入的文件,mobaxterm下測試比filelocatorpro還要快竿报。
8. locate 語法支持 -i 忽略大小寫 , -r 正則表達式的匹配模式(所以終于知道我剛才使用通配符會沒有結果的原因了继谚,使用正則表達式傲揖!)
locate -r click.*log 可以返回結果了花履!
9. whereis 支持參數(shù): -b binary file , -s source file , -m man file, -u other usual files