There are two ways to find files: Locate and find:
Locate:non-real-time, fuzzy matching, lookup is based on the system-wide file database;
updatedb the command to generate the file database manually, it may be slow to build the database
Advantages: Fast speed
Find: Real Time
Precise
support for many search criteria
traverse All files in the specified directory to complete the lookup, slow;
command format: Find Find Path Lookup criteria finds a later processing action
1. Find the path: default to the current directory
2. Find criteria: Default to all files under the specified path
3. Handling actions: Default to display (Print to screen)
Match (Find) criteria: -name ' FILENAME ': exact matching of file masterpieces
The file name supports a wildcard:
*: Any character of any length
?:
[]:
-iname ' filename ': file name matching does not support case
-regex PATTERN: File name matching based on regular expressions
-user USERNAME: Search According to the owner of the file
-uid UID: Search by UID
-gid GID: Search by GID
-nouser: Finding users who are not owned by the master
-nogroup: Finding files that are not owned by a group
-type:
F: Normal file
D:
C:
B:
L
P:
S
-size:
#k:
#M:
#G:
The above unit can be preceded by a [+|-] identifier, + = greater than,-represents less than
Combination conditions:
-A
-O
-not
-mtime
-ctime
-atime
[+|-]#
-mmin
-cmin
-amin
[+|-]#
-perm MODE
/mode: Only one match can be
-mode: File permissions can only be displayed when the MODE is fully contained
Action:-print: (default) display
-ls: Displays detailed information for each file in a form similar to Ls-l
-ok COMMAND \; Must be "\;" End, every operation needs to be confirmed
-exec COMMAND {} \; Must be "\;" End, operation without confirmation
Find Command Usage Introduction