Linux Lookup command: Which, Whereis, locate, find

Source: Internet
Author: User
Tags file size linux

Command Lookup-which

The which command is used to find executable files contained in path (that is, commands)

which [-A] command

-A: List all commands

File and directory Lookup-Whereis, locate, find

Where Whereis and locate are found from the database, so they are faster, but unable to find the most recent data, because the database is updated daily by default (or you can perform a manual update of the UpdateDB command).

Whereis File/dirname

Locate [-i] keyword

-I: Ignore case

The difference between Whereis and locate is that Whereis is a precise match, and locate is the keyword lookup.

Find instructions are found from the hard disk, slower, but more powerful.

Find [PATH] [option] [action]

The find instruction contains three sections, [path] refers to the path to look for, and option specifies the parameters, such as:

-name the file name you want to find

-atime-ctime-mtime file time

-type file type

-size File Size

The parameters associated with time are more commonly used, such as:

-mtime +n: Lists files that have been changed before n days (excluding N)

-mtime-n: Lists files that have been changed within n days (including n)

-newer file: Lists files that are newer than

[Action] Indicates the instructions for the operation of the file after the lookup, and the instruction content is-exec with boiling water to the end, as follows:

Find/etc-name sysconfig-exec ls-l {} \;

where {} represents all the content found by find, the previous command represents looking for sysconfig files and directories under/ETC and lists their directory structure.

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/OS/Linux/

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.