[root@localhost]# locate httpd.conf
/etc/httpd/conf/httpd.conf
/etc/httpd/conf/httpd.conf.bak
/opt/eff.org/certbot/venv/lib/python2.7/site-packages/certbot_apache/tests/testdata/centos6_apache/apache/httpd/conf/httpd.conf
/opt/eff.org/certbot/venv/lib/python2.7/site-packages/certbot_apache/tests/testdata/centos7_apache/apache/httpd/conf/httpd.conf
/opt/eff.org/certbot/venv/lib/python2.7/site-packages/certbot_apache/tests/testdata/gentoo_apache/apache/apache2/httpd.conf
/usr/lib/tmpfiles.d/httpd.conf
基本上所有路徑中含有 httpd.conf 的都會顯示出來,當然也可以配合 grep, more, less 使用。
用了一段時間後覺得很方便,但是如果是 mount 進來的卻找不到。研究了一下發現,原來是設定的問題,想一想也合理,mount 進來的磁碟有時候沒有 mount 進來,檔案就不存在,而由於 locate 需要做索引,如果檔案經常變動,那索引也需要持續更新。所以預設不把 /mnt 加入索引也是合情合理的。
其實只要檢查一下設定檔案
vi /etc/updatedb.conf
看到內容長這樣
PRUNE_BIND_MOUNTS = "no"
PRUNEFS = "9p afs anon_inodefs auto autofs bdev binfmt_misc cgroup cifs coda configfs cpuset debugfs devpts ecryptfs exofs fuse fuse.sshfs fusectl gfs gfs2 gpfs hugetlbfs inotifyfs iso9660 jffs2 lustre mqueue ncpfs nfs nfs4 nfsd pipefs proc ramfs rootfs rpc_pipefs securityfs selinuxfs sfs sockfs sysfs tmpfs ubifs udf usbfs fuse.glusterfs ceph fuse.ceph"
PRUNEPATHS = "/afs /media /mnt /net /sfs /tmp /udev /var/cache/ccache /var/lib/yum/yumdb /var/spool/cups /var/spool/squid /var/tmp /var/lib/ceph"
大概可以看到,PRUNE_BIND_MOUNTS 要先設定為 "yes",然後 PRUNEFS 中要把 nfs 拿掉,PRUNEPATHS 也要允許 /mnt
修改完像這樣 (提供參考,可根據需要自行條配)
PRUNE_BIND_MOUNTS = "yes"
PRUNEFS = "9p afs anon_inodefs auto autofs bdev binfmt_misc cgroup cifs coda configfs cpuset debugfs devpts ecryptfs exofs fuse fuse.sshfs fusectl gfs gfs2 gpfs hugetlbfs inotifyfs iso9660 jffs2 lustre mqueue ncpfs nfsd pipefs proc ramfs rootfs rpc_pipefs securityfs selinuxfs sfs sockfs sysfs tmpfs ubifs udf usbfs fuse.glusterfs ceph fuse.ceph"
PRUNENAMES = ".git .hg .svn"
PRUNEPATHS = "/afs /media /net /sfs /tmp /udev /var/cache/ccache /var/lib/yum/yumdb /var/spool/cups /var/spool/squid /var/tmp /var/lib/ceph"