With the Find command, you can specify the name, category, time, size, and permissions to find the file you want.
Grammar:
fiind [path] [parameter] [-print]
Detailed parameters:
1.-name finding files by file name
The file name option is the most common option for the Find command, either used alone or in conjunction with other options. You can use a file name pattern to match files, remembering to enclose the filename pattern in quotation marks.
Example: Find the current file name starts with a lowercase letter, and finally 4 to 9 plus. Log End files
Find. -name "[A-z]*[4-9].log"-print
2.-perm follow file permissions to find files
Follow the file permission mode with the-perm option to find files by file permission mode. It is best to use the octal permission notation.
Example: Finding files with the current file permission of 755
Find. -perm 755-print
3.-user Find files According to the owner of the file
-nouser Find files whose owner does not have a valid account
Example: Find files in the $home directory where the file belongs to test master
Find ~-user test-print
In order to find files that are deleted from the master account, you can use-nouser
Find/home-nouser-print
4.-group: Find files According to the group the file belongs to
-nogroup: Finding files with no valid groups
Example: Find files under/etc that belong to the group test
Find/etc-group Test-print
Find all files that do not have a valid owning group
Find/-nogroup-print
5.-cmin N: Files that have been modified in the last few minutes
Example: Find files that have been modified within 5 minutes
Find. -cmin-5-print
Find files that haven't been modified 5 minutes ago
Find. -cmin +5-print
and a atime,ctime,mtime.
The difference between Mtime and CTime is that only if the contents of the file are modified, the mtime of the file will be updated, and the renaming of the file and the owner of the modified file will only update the CTime.
Atime, this is updated every time you view the contents of a file. such as cat operations, and LS operations are not updated.
6.-size N: File of size n
files can be searched by file length, and the length of the file referred to here can be measured either in blocks or in bytes. The length of the measured file in bytes is expressed as n C, and the length of the block measurement file is only represented by a number.
When looking up files by file length, this is generally the size of the file in bytes, and it is easier to convert by using blocks to measure the file system.
Example: Find files with file lengths larger than 1M in the current directory
Find. -size +1000000c-print
Find files that are longer than 10 blocks in the current directory (a chunk equals 512 bytes)
Find. -size +10-print
7.-type: Finding a file of a file type
Example: Find all directories in the current directory
Find. -type D-print
Find all types of files except directories in the current directory
Find. ! -type D-print
8.-path: Ignoring a directory when searching
Example: Find all files in the current directory that are not within the test subdirectory
Find. -path "./test"-prune-o-print
Description
Find [-path ...] [Expression]
After the list of paths is the expression
-path "Test"-prune-o-print is a shorthand expression for-path "test"-a-prune-o-print, evaluated sequentially,-A and-O are short-circuit evaluated, with Shell's && and | | Similar if
-path "Test" is true, the-prune is evaluated,-prune returns TRUE, and the logical expression is true, otherwise no value-prune, and the logical expression is false. If the-path "test"-a-prune is false, the evaluation is-print,-print returns True, or the logical expression is true, otherwise no value-print, or the logical expression is true.
The Find command for Linux