locate [OPTION]... [PATTERN]...
Search for entries in a mlocate database 在數(shù)據(jù)庫內(nèi)快速定位文件
數(shù)據(jù)一天更新一次,但可以使用updatedb(可能需要root用戶)手動更新
數(shù)據(jù)庫不包括 /tmp 目錄的內(nèi)容
由于是數(shù)據(jù)庫內(nèi)搜索.所以只支持絕對路徑
有可能需要安裝的話使用 sudo yum install mlocate
-
常用選項:
-i:ignore case distinctions when matching patterns 忽略大小寫 -c:only print number of found entries 只顯示查找到的數(shù)量 -
示例
[xzt7566@centos7-test Downloads]$ locate host*.txt /home/xzt7566/Downloads/hosts.txt /var/cache/yum/x86_64/7/timedhosts.txt