Find command parsing (different searches)

Source: Internet
Author: User
In Linux, all the content is saved as files, which means the number of all files is amazing, how can we find what we need in an astronomical file? This requires the file search command. this time we will discuss... in Linux, all content exists in the form of files, which means the number of all files is amazing, how can we find what we need in an astronomical file? This requires the file search command. this time we will discuss the find command. The Find feature www.2cto.com not only has the find command but also the locate command in the file search command. since they are all file search commands, what is the difference? Locate: non-real-time, fuzzy match, search is performed based on the entire system file database; manual generation of file database is fast. Find: real-time, accurate, and slow. it traverses all files in the specified directory to complete the search. The format of the Find command used by find is as follows: find search path search standard Find the processing action www.2cto.com search path: the default is the current directory search standard: by default, all files are processed: the following description is displayed by default. Matching standard:-name File name: exact matching of the file name. for example, find the passwd find/etc-name "passwd"-iname: case-insensitive-regex mode in The etc directory: use the regular expression to search for-user: find the file "find/tmp-user student-group" that belongs to student in the tmp directory based on the owner. example: find the file "find/tmp-user student-group" based on the parent group.-uid: search by UID-gid: search by GID-nouser: find the file without a master instance: find the file without a master in the tmp directory find/tmp-nouser-nogrep: search for files without groups-type: search by file type: for example, find/tmp-type d-size in the directory of tmp: find the number + unit by file size. the default unit is byte. for example, find/etc-size 1 M-mtime (-| + Days: find the files that are accessed within two days in the current directory. /-atime-2-ctime: find the file that changes the number of days-atime: find the file that accesses the number of days-perm (/|-) permission: //: match only one permission -: the example is displayed only when all file permissions are included: find the file with the permission of 644 in the current directory. /-perm-644 combination condition Group:-a: and relationship-o: or relationship-not: non-relationship usage is the same as normal, it is nothing more than combining different condition logics. Action:-print: Show-ls: list display-exec command {}\;: reference command to complete search example: find the file with the permission 644 in the current directory and change the permission to 536 find. /-perm-644-exec chomd 536 is a simple display and application of the find command. if you want to learn more about its usage, use the man command! I hope the above content will be useful to you. thank you.
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.