Search for files in linux

Source: Internet
Author: User
Article title: search for files in linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

1. which (find the "execution file ")

Which [-a] command (-a lists all the commands found, not just the names of the first commands found)

This command searches for the file name of the "execution file" according to the PATH specified by the "PATH" environment variable, followed by the complete file name.

2. whereis (find a specific file)

Whereis [-bmsu] file or directory name

-B: only binary files are available.

-M: only find the file in the manual path of the help file.

-S: only find the source file

-U: file with no help file

3. part of the locate file name

4. find [PATH] [option] [option]

For specific parameters, use man find

Note: find is a powerful search command, but it takes a lot of time because find searches hard disks directly, and whereis or locate is much faster, this is because the Linux system records all files in the system in a database file. when whereis or locate is used, the content of the database file prevails. therefore, sometimes you will find that when you use these two commands, you may find the deleted file and cannot find the file you just created. this is because these two commands search for the file through the database results.

Linux searches for database updates based on the location of all files on the Linux host. the updated program is updatedb. you can also directly use/usr/bin/updatedb to update database files.

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.