The Linux Find command searches the directory structure for files and performs the specified actions.
Reference: http://www.jb51.net/os/RedHat/1307.html
1. Command format:
Find Pathname-options [-print-exec-ok ...]
2.options Options
-name finds files by file name.
-perm to find files according to file permissions.
-prune Use this option to have the Find command not be found in the currently specified directory, and if you use the-depth option at the same time,-prune will be ignored by the Find command.
-user Search for files according to the owner of the file.
-group finds files according to the group to which the files belong.
-mtime-n +n The file changes time to find the file,-n means that the file change time is now less than n days, + n means that the file change time is now N days ago. The Find command also has the-atime and-ctime options, but they both and the-m time option.
-nogroup finds a file that does not have a valid owning group, that is, the group to which the file belongs does not exist in/etc/groups.
-nouser finds a file without a valid owner, that is, the owner of the file does not exist in the/etc/passwd.
-newer file1! File2 look for a file that changes time than the file File1 new but older than the file file2.
-type find a file of a certain type, such as:
B-block device files.
D-Directory.
C-character device file.
P-Pipeline file.
L-Symbolic link file.
F-Normal file.
-size N:[c] finds files with a file length of n blocks, with C indicating the length of the file in bytes. -depth: When looking for a file, first find the file in the current directory, and then look in its subdirectories.
-fstype: Find files located in a file system of a certain type, these file system types can usually be found in the configuration file/etc/fstab, which contains information about the file system in this system.
-mount: Does not cross the file system mount point when locating files.
-follow: If the find command encounters a symbolic link file, it tracks to the file that the link points to.
-cpio: Use the cpio command for matching files to back up these files to the tape device.
In addition, the following three differences:
-amin N Find the last n minutes of files accessed in the system
-atime N Find the last n*24 hour Access file in the system
-cmin n Find files in the last n minutes of the system changed file status
-ctime n Find files that have changed file status in the last n*24 hours of the system
-mmin n Find files that have changed file data in the last N minutes of the system
-mtime n Find files that have changed file data for the last n*24 hours in the system
3. Usage examples
Example 1: Finding files that have been modified within a specified time
Find-atime-2//Find files accessed within 48 hours
Example 2: Search by keyword
Find. -name "*.log"//Find files ending with. Log in the current directory. ". " Represents the current directory
Example 3: Find files by directory or file permissions
find/opt/soft/test/-perm 777//Find a file with permission 777 in the/opt/soft/test/directory
Example 4: Find by Type
Find. -type f-name "*.log"//Find common Files when directories end with. log
Example 5: Find files by size
Find. -size +1000c-print//Find files with current directory larger than 1000Byte
Linux command: Find