File Lookup
1, locate based on a system-wide file database (not real-time, the system collects and stores all files in the system at a specific time of day) (non-real-time Fuzzy Lookup)
Update manually generate the file database ( run it over for a long time )
2. Find ( real-time precise traversal of system catalog files )
How to: Find a path to search for a processing action after a standard lookup
Find path: Default to current directory
Lookup criteria: Default to all files under the specified path
Handling actions: Default to Print to screen
-name FILENAME
wildcard characters supported
-iname FILENAME is case insensitive
-regex PATTERN based on regular expressions
-user USERNAME based on owner lookup
-user grop Search by genus Group
-uid ID lookup based on user ID
-gid ID lookup based on group ID
-nouser Finding files that are not owned by the master
-nogroup Finding files that are not owned by a group
-type Search by file type
f: normal file
d: catalogue
c b L p s ...
-size based on file size (rounded up when it is less than an integer)
[+|-] #K
[+|-] #M
[+|-] #G
Combination Conditions
-A
- o
-not
Example:find/tmp-nouser-a type D
Find/tmp-not-type D
find./-not \ (-user user1-o-user user2\)
-mtime creation Time (days)
-ctime modification Time (days)
-atime access Time (days)
The time to move forward at this moment
[+ |-] + time of day ago
- time of Day
-mmin
-cmin
-amin
[+ |-] usage and time in the same unit for minutes
-pern Permissions
find a file for a permission
MODE file with permission equal to MODE
/mode any one match will satisfy the condition
-mode file permissions can fully contain this MODE only when the condition is met
Find execution action
-print Display
-ls Displays detailed information for each file in a form similar to ls-l
-ok COMMAND {} \: the user is asked to confirm the curly brackets for each action to indicate the file name of the reference found
-exec Commoand {} \: no user confirmation
Example: Find/-perm-006-exec chmod o-w {} \:
find./Type D-ok chmod +x {} \:
find./-perm-020 mv {} {}.new \:
Find what | xargs cpmmand The found content directly to the Xargs with the command after processing
Example: find/etc-size +1m | xargs echo >>/tem/etc.la
Summarize:
Locate is to find files from the database, possibly because the database is not updated and does not find files in real time, but it is much faster than find
Find is real-time according to the path of the file retrieval, the speed is certainly not locate fast, but will be found in real time, generally find will be more common.
This article is from the "Mr.zhu-Technology Exchange" blog, please be sure to keep this source http://bjishu.blog.51cto.com/7481301/1684916
Linux file Lookup