The difference between Whereis, find, whic, and locate commands in Linux __linux

Source: Internet
Author: User

Which view the location of the executable file

Whereis View the location of the file

Locate view file location with database

Find actual search hard disk query file name

1, which

Which is looking for executables through the PATH environment variable, so the basic function is to find executable files

2 Whereis

Whereis lookups are very fast compared to find, because the Linux system records all the files in the system in a database, and when you use the Whereis and the locate that are about to be described below, you look up data from the database, unlike the Find command, By traversing the hard drive to find, the efficiency is naturally high.

However, the database file is not a real-time update, by default, updated once a week, so we use Whereis and locate to find the file will always find the data has been deleted, or just set up a file, but can not find, because the database file has not been updated.

3, locate

Locate file or directory name

4, find

Grammar:

Find path parameters

Parameter description

Time Lookup Parameters:

-atime N: Lists files that have been accessed in n*24 hours

-ctime N: List the changes in n*24 hours, new files, or directories

-mtime: Lists the files or directories that have been modified within n*24 hours

-newer file: Make a list of files that are newer than file

Name Super Find parameters:

-gid N: Searching for files with group ID n

-group Name: Search for files with group names of name

-uid N: Looking for files with owner ID n

-user Name: Find a file with a user name called name

-name file: Looking for files with file-life files

When we can't find the files we need with Whereis and locate, we can use finding, but find is traversing the hard disk, so it's very inefficient, so we recommend that you use Whereis and locate first.



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.