Linux Find File Summary

Source: Internet
Author: User

Locate: Non-real-time lookup, the lookup process is based on the system-wide file database, the search method is not accurate.

The default system writes to the database periodically.

Pros: Find Fast.

If you do not have a database, you can create it manually, UpdateDB, but the command will take a long time to process.

Find: Real-time, accurate, traversal of all files in the specified directory to complete the lookup, the lookup speed is slow.

Support for many lookup criteria (regular expressions supported)

Find Find path lookup criteria lookup to later processing operations

Default current path default current path All files default to display case sensitive

Matching Criteria:

-name ' Fliename '

Example: Find/tmp-name "1.txt"

Find/etc-name ' passwd '

Find/-name 1.txt from/Find 1.txt

File Wildcard: * Any character of any length

?

[]

-iname: Case-sensitive when file matching

Find Regular expression

-regex pattern based mode

-regextype type based on regular expression

-user username (based on user's owner lookup)

Find/tmp-user Student

-group GroupName According to the genus Group

-uid UID: Search by UID

-gid GID: Search by GID

-nouser: Finding files that are not owned by the master

-nogroup: Finding files that are not owned by a group

-type: File type

S: Socket f: normal file D: directory C

B: Block file L P

-size:

[+]k

[-]k

[+|-] #G

Find/etc-size +10k

Combining criteria to find files

-A and

-O or

-not Non-

The default is the "and" action

-mtime:

-ctime:

-atime:

[+|-]#

-mmin:

-cmin:

-amin:

-perm mode (privilege accuracy)

-perm/mode any one match can be

-perm-mode each must match (only the file's permissions are fully contained)


The action of Find:

-ls: Displays detailed information for each file in a form similar to Ls-l

-ok command{}: Each operation needs to be determined

-exec command{}: No need to determine

Find Path-name 1.txt

Find/-name "*newfile*"-ls-exec file

Find/home-user Daibin Find files for user Daibin

Find/home-user daibin-o-group daibin Find files for Daibin or daibin groups

-O or meaning

-A and

Find/-perm-777-typed-ls From/View permissions 777 files

Find/etc-type f-name "se*"

Catalog file type

Delete a backup

Find/tmp-name "* *"-mtime +7-exec rm-f {}\

Find/tmp-name "1*"-exec rm-f {}\

Find related

Which useradd view command location

Wchich find a file command that can be executed (find echo $PATH only)

Whereis Find Command Manpage Library

Slocate=locate (soft Connect) Find all the relevant information, with UpdateDB. UpdateDB Update the query's library file


This article is from the "Elder Don" blog, please be sure to keep this source http://zhanglaotang.blog.51cto.com/3196967/1409976

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.