1.locate
The locate command is a file search command that searches faster than the find command because it does not search for a specific directory.
Instead, it searches for a database that contains all the local file information. The Linux system automatically creates this database,
and automatically updated every day, so use locate this command to find the latest changed files. To avoid this situation
You can manually update the database by using the UpdateDB command before using locate.
Command format:
#Example01 add Index.hml under the Var directory
[Email protected]_81_181_centos/]# Locate index.html/usr/share/doc/html/index.html/usr/share/doc/ cyrus-sasl-lib-2.1.23/index.html/usr/share/doc/db4-utils-4.7.25/utility/index.html/usr/share/doc/gamin-0.1.10/ index.html/usr/share/doc/python-babel-0.9.4/doc/index.html/usr/share/doc/python-babel-0.9.4/doc/api/ Identifier-index.html/usr/share/doc/python-babel-0.9.4/doc/api/index.html/usr/share/doc/python-babel-0.9.4/doc /api/since-index.html/usr/share/doc/python-iniparse-0.3.1/index.html/usr/share/doc/python-jinja2-2.2.1/ext/ django2jinja/templates/index.html/usr/share/doc/python-jinja2-2.2.1/html/genindex.html/usr/share/doc/ python-jinja2-2.2.1/html/index.html/usr/share/doc/python-pygments-1.1.1/docs/build/index.html/usr/share/doc/ Rsyslog-5.8.10/index.html/usr/share/doc/udev-147/writing_udev_rules/index.html
Found and did not search to/var/index.html
Use the UpdateDB command:
[Email protected]_81_181_centos/]# updatedb[[email protected]_81_181_centos/]# Locate index.html/usr/share/doc/ html/index.html/usr/share/doc/cyrus-sasl-lib-2.1.23/index.html/usr/share/doc/db4-utils-4.7.25/utility/ Index.html/usr/share/doc/gamin-0.1.10/index.html/usr/share/doc/python-babel-0.9.4/doc/index.html/usr/share/doc /python-babel-0.9.4/doc/api/identifier-index.html/usr/share/doc/python-babel-0.9.4/doc/api/index.html/usr/ Share/doc/python-babel-0.9.4/doc/api/since-index.html/usr/share/doc/python-iniparse-0.3.1/index.html/usr/share /doc/python-jinja2-2.2.1/ext/django2jinja/templates/index.html/usr/share/doc/python-jinja2-2.2.1/html/ Genindex.html/usr/share/doc/python-jinja2-2.2.1/html/index.html/usr/share/doc/python-pygments-1.1.1/docs/build /index.html/usr/share/doc/rsyslog-5.8.10/index.html/usr/share/doc/udev-147/writing_udev_rules/index.html/var/ Index.html
2. After you create a file in some directories and then update the database, you cannot use the Locate command to find
The reason is that the system has set some limits in the configuration file for updating the database, so the search is not available, so enter the following command to see:
[[Email protected]_81_181_centos lib]# vi/etc/updatedb.conf prune_bind_mounts = "Yes" prunefs = "9p AFS anon_inodefs Auto AutoFS bdev binfmt_misc cgroup cifs coda Configfs cpuset debugfs devpts ecryptfs exofs fuse fusectl GFs gfs2 hugetlbfs ino TIFYFS iso9660 JFFS2 Lustre Mqueue ncpfs NFS nfs4 nfsd pipefs proc Ramfs rootfs rpc_pipefs securityfs selinuxfs SFS sockfs Sysfs Tmpfs ubifs udf usbfs "prunenames =". Git. Hg. svn "prunepaths ="/afs/media/net/sfs/tmp/udev/var/cache/ccache /var/spool/cups/var/spool/squid/var/tmp "
prune_bind_mounts = "Yes" indicates that search restrictions are turned on, and if ' no ' means no search restrictions are turned on;
Prunefs = A file system that does not search when searching;
Prunenames = The file type that is not searched when searching;
Prunepaths = The path that is not searched when searching;
Not only locate commands follow search restrictions, Whereis and which also follow
The locate command for Linux commands