[Organize common Linux commands 4] search for files

Source: Internet
Author: User
Command 1: Which The "which command" can only find the directory where the command is located. Example: Which ls Command 2: whereis "Whereis command" to find and only find the directory where the command is located + the location of the help document   Whereis command Command location + help document location   Command 3: Find "Find path search mode parameter" allows you to find any file There are many ways to search: 1. Search by file name Search Method:-name Example: Find/T3-name file1   Note: wildcards can be used for file names. * Multiple characters ? Single Character Example: Find/T3-name fil *   2. Search by file size Search Method:-size (unit: 512 bytes, that is, KB) + 1000 -1000 = 1000 Example: Find/T3-name-1000   3. Search by file owner Search Method:-user Example: Find/T3-user xhc   4. Search by file group Search Method:-group Example: Find/T3-group greenday   5. search based on the last modification time Query Method:-ctime,-atime, and-mtime are measured in days. Query Method:-Cmin,-Amin, and-mmin are measured in minutes. C. Change refers to the file attribute. It refers to the permission, group, and owner changed. A access M modification indicates that the file content has been modified Parameters: + How long has it exceeded? -How long does it take? Nothing is written. Example: Find/T3-mmin-120   6. Search by file type Search Method:-type Example: Find/T3-type D 7. Search by I Node Search Method:-inum Example: Find/T3-inum 14 8. Multiple conditions -A logic and -O logic or Example: Find-size + 80-a-size-100   4. Search and perform operations Fixed format: Find XXX-exec command {}\; For example: Find/T3-mmin-120-exec LS-l {}\; find the modified files within two hours and list the details 5. Locate Locate XXX lists all XXX-Related Files Feature: It is fast, but the file database must be updated. Otherwise, the newly created file cannot be found and must be used with the updatedb command. 6. grep "Grep XXX file a" searches for XXX-related content in file.

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.