1. Order Introduction
①locate
The Linux Locate command is used to find documents that match the criteria, and he goes to the database where the document and directory names are stored, looking for documents or directories that conform to the template style criteria.
Generally we just need to enter locate Your_file_name to find the specified file.
②find
Find command is the Linux system to look up the file command, the biggest role is to help users in the use of Linux system can quickly find the files they need
2, the actual combat drill
Earlier in the Shell Script Learning guide book, the first contact with locate this command, and then found it to locate the file path is very fast, so the initiation of it and find this also has the search file path function of the performance comparison between the idea. Say not much, direct map: To find passwd file as an example
①find Performance
②locate Performance
③ Performance Comparison Locate and find different: find is to hard drive, locate only in/var/lib/slocate database.
Locate faster than find, it is not really looking, but to check the database, the general file database in/var/lib/slocate/ Slocate.db, so the search for locate is not real-time, but with the update of the database, is generally the system itself maintenance, can also manually upgrade the database, the command is: Locate-u
④ Security
Locate find, even some system key location of the files can be found, but find will be restricted by the permissions, so the same filter conditions, locate find out more than the number of files found to find out the number, so in the security of locate more than finding a bit of a chip. number of files found by locate
Find the number of files found
⑤ Applicable scene
If the security requirements are not high, and high speed requirements, just need to locate the location of the file rather than how many days to modify, access and other file operations, then use locate bar.
3. Reference Documents
Linux Locate Command
Linux Find command detailed