& Amp; 65279; & amp; 65279; search File & amp; 26684; type findpathoption [-print] [-exec-okcommand] {} the default search path is-print, output to the standard output. execute the command option to search for objects found.
Function
Search for files
Format
Find pathoption [-print] [-exec-OK command] {}\
The default search path is the current path.
The default value is-print, which is output to standard output.
Execute the command for the searched file
Option is a search condition.
Main parameters
-Name filename
Restrict file names
-User username
Search by file owner
-Group groupname
Search by group
-Mtime-n + n
Search by file change time,-n refers to n days or less, + n refers to n days before
-Atime-n + n
Query by file access time
-Ctime-n + n
Search by file creation time
-Nogroup
-Nouser
-Type
Search by file type
-Size n
-Depth
Search the local directory before searching for the subdirectory
-Follow
If a symbolic link file is encountered, the file indicated by the link will be tracked.
-Prune
Ignore a file
-O
Logic or
-
Logic and
!
Logic no
\(\)
Escape, including search conditions
Example
Find all common files in the current directory
Find.-type f-exec ls-l {}\;
In the home directory, find and delete files whose changes were earlier than 5 days.
Find/home-mtime + 5-exec-OK rm {}\;
Query the files modified today
Find/-mtime-1-exec ls-l {}\;
Query the modified files today and prompt whether the files are displayed.
Find/-mtime-1-OK ls-l {}\;
Search for files smaller than kB and display them
Find/home-size-100 k-exec ls-l {}\;
Search for all files suffixed with. txt.
Find ~ -Name "*. txt"-OK ls-l {}\;