How to use the find command
Find: find files that match the specified attributes in real time by traversing the specified target directory
Advantage: exact match for search
Cons: slightly slower
Usage:
Find [OPTION] [search path] [search condition] [processing Action]
Find path: default to current path
Search criteria: default to all files under the specified path
Processing action: it is displayed on the screen by default
Search criteria:
-name: distinguishes the case of a file when searching, and supports glob
*, [], [^]
-iname: file case insensitive when looking for it
-user USERNAME: search according to the file owner
-group USERNAME: search by file group
-uid UID: find based on the specified UID
When the original user is deleted, the owner group of the file he created before becomes the uig and gid of his previous account.
-gid GID: find based on the specified GID
-nouser: find files without owners
-nogroup: find files that do not belong to a group
-type TYPE: find by file type
-size TYPE: find based on file size
-atime [+ | -] #: files visited in recent days
-mtime[ + | -] #: files that have been modified in recent days
-ctime[ + | -] #: files that have changed in recent days
-amin[ + | -] #: files accessed in the last few minutes
-Mmin [+ | -] #: files that have been modified in recent minutes
-cmin [+ | -] #: files that have changed in the last few minutes
-perm [+ | -] MODE: search based on permissions
-maxdepth: find the most depth, for example:-maxdepth 1 means only look under the current directory, but not the directory under the current directory.
-mindepth: find the minimum depth
Combination of search criteria:
-a: the same as when there are two operations without this parameter
-o: or
!!-not: not
Find by file type
-type TYPE:
F: ordinary files
D: catalog file
L: symbolic link file
B: block equipment
C: character settings file
P: command name pipe
S: represents a socket file
Find based on file size
-size TYPE:
Commonly used unit: KTHERMAL MMAG
+; greater than
-; less than
Nothing is expressed as an exact size.
# UNIT: indicates #-1 < x