Linux Command Learning Series 12-locate,whereis,which command

Source: Internet
Author: User

Let's review the previous section:

1. Default Permissions and Umask

2. View the file Type files command

3. Find File Search command

Job: Create a Test.txt file in the/tmp directory, view the file's default permissions, use the Find command to find the file you just created, and use the file command to view the type of files you just created

Touch/tmp/test.txt

Find/-name Test.txt

File/tmp/test.txt

This section looks at several other commands for finding:

1. Locate command

The Locate command, unlike the Find command, relies on a database file, that is, the locate command checks the data directly from the database, not from the file system, so the query is faster than find, but because of the database dependency, if the database is not updated, You may not be able to find the latest data. You can update the database with the UpdateDB command. The following example illustrates the use of the locate command.

Create a Test.txt file

With the Find command, you can find the file you just created

But with the locate command, but can not find the file just now, after the execution of a updatedb, again with locate will be able to find

UpdateDB commands the Linux system to execute automatically every day, for files with low real-time requirements can not be executed manually updatedb command

2. which and Whereis commands

The which command is used to find the absolute path to an executable file from a directory defined by the system's path variable. For example, to find the path to the LS command

The Whereis command is similar to which usage, except that Whereis can find the relevant man file in addition to the binary file, or the LS command as an example.

Job: Create a file myfile.txt, find it with locate, and find the CD command with which and Whereis, respectively.


Follow the public number "get kicked genius" for free video + graphic Tutorials

Linux Command Learning Series 12-locate,whereis,which command

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.