在数据库中搜索文件
[root@hexingxing ~]# locate nginx -c
262
//显示找到的条目数量
[root@hexingxing ~]# locate abc* -w
/root/abc.txt
//显示搜索结果的完整路径
[root@hexingxing ~]# locate AC.TXT -i
/usr/share/doc/vim-common-7.4.629/README_mac.txt
/usr/share/vim/vim74/doc/os_mac.txt.gz
//忽略区分大小写
[root@hexingxing ~]# locate nginx -n 3
/etc/nginx
/etc/logrotate.d/nginx
/etc/nginx/conf.d
//显示搜索结果的前 3 个文件
* /var/lib/mlocate locate ##命令所搜索的后台数据库
*使用 updatedb 更新搜索数据库信息,由 updatedb 建立索引
* /etc/updatedb.com 配置文件
PRUNE_BIND_MOUNTS = "yes" ##开启搜索限制
PRUNEFS = "" ##搜索时,不搜索的文件系统
PRUNENAMES = "" ##搜索时,不搜索的文件类型
PRUNEPATHS = "" ##搜索时,不搜索的路径
0 条评论