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