Find
[Syntax]: Find path name ... expression
[Description]:: The Find command recursively traversed each file and subdirectories under the specified path, see if the file can make the expression value true, the following N represents a decimal integer, N represents printing n, -n represents less than n, Here is a legal expression description:
-name mode file name and pattern matching is true, (/ for transllection)
-Perm [-] Octa counting file access mode is the same as the eight-input number, the file is saved.
Take the pattern contains an octal number specified mode.
-size n [c] The length of the file block is true (a 512 byte), if
There is a C option, the file byte length is true.
-time N If the recent access time of the file is N days, it is true.
The Find command will change the access time of the directory of its access.
-mtime N If the recent modification time of the file is N days ago
-ctime n If the file status is n-day change, it is true.
-EXEC command {} /; If the command return value is 0, {} is command parameters,
This command must be over /;
-ok command {} /; with EXEC, just prompting before command execution, if
The answer y is executed
-print display output makes the expression are real file name
-newer file If the file is accessed by the file, it is true than the file specified by the NEWER.
-Depth first dropped to the subdirectory of the search directory, and then he himself
-mount only looks for file systems that contain specified directory
-local file is true when the current file system
-Type C file type C is true, C value can be b (block file) C (character file)
d (directory) L (symbolic link) P (named pipe) f (ordinary file)
/ (Expression /) expression is true
-LINKS n file link is n when N is n
-user user When the file is true, the user can use the number to represent the UID.
-nouser is true when the file is not a user in / etc / passwd
-group file group When the file is true, the file group can use the number to represent GID.
-NOGROUP When the file is not a group in / etc / group
-fstype Type When the file system type belongs to the file is specified type
-inum n When the file i node number is n, true
-Prune When the directory name is matched, the subdirectory is no longer searched.
Simple expressions can be connected to complex expressions with logical operators
Logical operators are! Indicates non-operation, -o representation or operation, two expressions are represented.
Operation
[example]:
Find / -name find * -print
Start search for file names such as Find * from the root directory and display
Find ./ -EXEC SLEEP {1} /; -print
Display a file in a current directory per second
Find $ home / (- name a.out -o -name '* .o' /) -atime 7 -exec rm {} /;
Start search from the $ home directory, delete all files names a.out or * .o and access time in 7 days ago