"Shell's locate and find performance command comparison"

Source: Internet
Author: User
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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.