Linux: locate command

Source: Internet
Author: User
Linux: locate command-Linux general technology-Linux programming and kernel information. The following is a detailed description. In fact, I have long wanted to take a closer look at the usage of the query commands in linux, including whereis, which, find, locate, and grep.

Today we will talk about locate.

I thought that locate is a built-in system command, just like our commonly used cd, ls, mkdir and so on. I tried to locate it yesterday and found that command not found, I was puzzled. Why didn't I? I asked, people told me that I didn't install it. I am even more puzzled: Isn't it a built-in system?

After querying, there are mlocate, rlocate, and slocate. Then we found that the company uses slocate and is linked by locate.

Later found the http://gentoo-wiki.com/Slocate_and_Rlocate

There are a lot of things in it. To put it simply, if slocate is used, emerge slocate is used first. At this time, we will see that locate is connected to slocate.

If you use the locate command now, you will get: cocould not find user database '/var/lib/slocate. db'. You still have a database with a file index, so you still cannot find it. Now you are entering the command: updatedb to create a database for retrieval. This command takes quite a long time, then, you can use the locate command.

One of them is: slocate cannot coexist with rlocate, so we have to make a trade-off. This is described in gentoo-wiki above.
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.