Linux command and file lookups which, Wheris, locate, find

Source: Internet
Author: User

1, the search for the command

The which command can find the path in the directory that is configured under the $PATH environment variable. The role of the environment variable is when we execute the command, the system will be in the environment variable configuration of the directory to find the command, if not found on the error.

Which LS-to/bin/ls this is where the LS command's executable file is stored

2. Find Files 2.1, three find commands

1) whereis Whereid optional parameter file or directory name is used to find binary files, documentation, source files, etc.

2) Locate can be used to check

3) Find

Find is very powerful, can be based on user, group, name, file size, permissions, time and so on to find files, but also to find a range of files, such as the size of a file to find files, find/-size +100k, this means to find/ Files or directories with file sizes larger than 100k in the directory

2.2. The Linux system backs up the system files to the database

Linux system will record all the files in the system in a database file, and when using Whereis or locate, will be the contents of this database file, the results in the database to search for the location of the file, and find is directly search the hard disk. As a result, whereis and locate find faster than find, and sometimes you'll find files that have been killed when you use both of them! And you can't find the latest file you just created! Because the files in the Linux system and the files in the database are not always synchronized, there is a certain error in the two methods of finding. The time to update the database for each type of description is not the same. Of course, we can manually update the database, but this process will be slow, update the method is to directly execute updatedb.

Locate find the process: according to the database records in the/var/lib/mlocate, find the user input keyword file name.

The process of updating the database is to search the file name of the system hard disk according to the configuration of/etc/updatedb.conf, and upgrade the database files in/var/lib/mlocate;

  

Linux command and file lookups which, Wheris, locate, find

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.