File Lookup tool:
Files: According to the attributes of the file to find the corresponding file
Find command: Real-time search for files that match the specified attributes by traversing the specified target directory;
Exact match; speed is slightly slower;
Find [OPTIONS] [Find path] [find condition] [processing action]
Find path: Default to the current path;
Search criteria: Default to all files under the specified path;
Processing action: The default is to print to the screen;
Search criteria:
-name "file name": File name support using globbing
*, ?, [], [^]
# find/etc-name "passwd*"
-iname "File name"
-user USERNAME: Based on owner Lookup
-group USERNAME: Search by Genus Group
-uid UID: Search According to the specified UID;
-gid GID: Search According to the specified GID;
-nouser: Find files that are not owned by the master;
-nogroup: Find files without a group;
Combination Lookup criteria:
With:-A, find condition 1-a find condition 2-a ...
All conditions must be met at the same time
Or:-O, find condition 1-o find condition 2-o ...
Meet one of the conditions
Non:-not,!
-not Find Criteria
# find/tmp-nouser-a-name "*centos*"-ls
# find/tmp-not \ (-name "*.txt"-o-name "*.out" \)
# find/tmp-not-name "*.txt"-a-not-name "*.out"
Find Conditions (2)
-type Type: Search by file type
F: Normal file
D: Catalog file
L: Symbolic Link file
B: Block device
C: Character device file
P: Command name pipe file
S: Socket file
-size [+|-] #UNIT:
Common units are: K, M, G
#UNIT: #-1 < x <= #
2k:1.8k, 1.9k, 1.1k
-#UNIT: x <= #-1
-2k:1k, 0.9k
+ #UNIT: x > #
+2k:2.1k, 3.1k
Find by Time stamp:
In "Days" as the unit
-atime [+|-]#
#: #= < x < #+1
-#: X < #
+#: x >= #+1
-mtime [+|-]#
-ctime [+|-]#
In "Minutes" units
-amin [+|-]#
-mmin
-cmin
Search by permissions:
-perm [+|-]mode
Mode: Exact match with mode
+mode: The permissions of any class of users can include any one of the permissions assigned to it;
-mode: The permissions of each type of user include all permissions assigned to it;
-222,666,664
Handling actions:
-print: Default action, print to screen;
-ls: Displays the detailed properties of the found file;
-exec COMMAND {} \;
-ok COMMAND {} \;
Note: The Find command finds all eligible files at once and passes them along to the following commands, but some commands do not accept too long parameters; Workaround:
Find | Xargs COMMAND
This article is from the "11284919" blog, please be sure to keep this source http://11294919.blog.51cto.com/11284919/1755554
Linux File Search tool find a little secret