2009 Mar 01
find recursively search each directory in path evaluating the expression for every file until the outcome is known (i.e. is true or false). The expression with the first argument that begins with '-', '(', ')', ',', or '!'. If no paths are given, the current directory is used. If no expression is given, then '-print' is used. find exits with status 0 if all files are processed successfully, greater than 0 if errors occur. The expression is made up of:
-daystart | Measure times (for -amin, -atime, -cmin, -mmin, -mtime) from the beginning of today rather than from 24 hours ago |
-depth | Process each directpry's contents before the directory itself |
-follow | Derereference symbolic links. Implies -noleaf |
-help | Show command line usage |
-maxdepth levels | Descend at most levels of directories below command line arguments |
-mindepth levels | Do not apply any tests or actions at levels less than levels |
-mount -xdev |
Do not descend directories on other filesystems |
-noleaf | Do not optimize by assuming that directories contain 2 fewer subdirectories than their hard link count. Needed for CD-ROM and MSDOS filessystems or AFS volume mount points. Only applies when limiting to directories and ignoring files. |
-version | Print find version and exit |
-amin n | file was last accessed n minutes ago | ||||||||||||||||||
-anewer file | File was last accessed more recently than file was modified. -anewer is affected by -follow only if -follow comes before -anewer on cmnd line. | ||||||||||||||||||
-atime n | File was last accessed n*24 hours ago | ||||||||||||||||||
-cmin n | File's status was last changed n minutes ago | ||||||||||||||||||
-cnewer file | File status was last changed more recently than file was modified. -cnewer is affected by -follow only if -follow comes before -anewer on cmnd line. | ||||||||||||||||||
-ctime n | File's status was last changed n*24 hours ago | ||||||||||||||||||
-empty | File is empty and is either a regular file or a directory | ||||||||||||||||||
-false | Always false | ||||||||||||||||||
-fstype type | File is on a filesystem of type, one of: ufs, 4.2, 4.3, nfs, tmp, mfs, S51K, S52K. Use -preintf %F directive to see types on your system. | ||||||||||||||||||
-gid n | File's numeric group ID is n. | ||||||||||||||||||
-group gname | File belongs to group name gname. | ||||||||||||||||||
-iname pattern | Like -name, but match is case insensitive. | ||||||||||||||||||
-inum n | File has inode number n. | ||||||||||||||||||
-ipath pattern | Like -path, but match is case insensitive. | ||||||||||||||||||
-iregex pattern | Like -regex, but match is case insensitive. | ||||||||||||||||||
-links n | File has n links. | ||||||||||||||||||
-mmin n | File was modified n minutes ago. | ||||||||||||||||||
-mtime n | File was modified n*24 hours ago. | ||||||||||||||||||
-name pattern | Base of file name (path will leading directories removed) matches shell pattern. | ||||||||||||||||||
-newer file | File was modified more recently than file. Affected by -follow only if -follow comes before -newer on cmnd line. | ||||||||||||||||||
-nouser | No user corresponds to file's numeric user ID. | ||||||||||||||||||
-nogroup | No group corresponds to file's numeric group ID. | ||||||||||||||||||
-path pattern | File name matches shell pattern. The metacharacters do not treat
'/' or '.' as special. To ignore a whole directory tree use
-prune, e.g. to skip subtree srec/emacs do:find . -path '.src/emacs' -prune -o -print |
||||||||||||||||||
-prem mode | File's permissions are exactly mode (octal or symbolic). | ||||||||||||||||||
-prem -mode | All of the permission bits mode are set for the file. | ||||||||||||||||||
-regex pattern | File name (whole path) matches patern. | ||||||||||||||||||
-size n[bckw] | File uses n units of space. The units are 512-byte blocks by default or bytes if b or c, 2-byte words if w, kilobytes if k - follows n. Does not count blocks in sparse files not allocated. | ||||||||||||||||||
-true | Always true. | ||||||||||||||||||
-type c |
| ||||||||||||||||||
-uid n | File's numeric user ID is n. | ||||||||||||||||||
-used n | File was last accessed n days after its status was last changed. | ||||||||||||||||||
-user uname | File is owned by user uname (numeric allowed). | ||||||||||||||||||
-xtype c | Same as -type unless file is a symbolic link. If a symbolic link then if -follow not given then true if file linked to is of type c. |
( expr ) | force precedence |
! expr | not expr |
not expr | same as ! expr |
expr1 expr2 | expr1 AND expr2 (implied) |
expr1 -a expr2 | expr1 AND expr2 |
expr1 -and expr2 | expr1 AND expr2 |
expr1 -o expr2 | expr1 OR expr2 |
expr1 -or expr2 | expr1 OR expr2 |
expr1 , expr2 | list; both expr1 and expr2 are always evaluated. The value of expr2 is the value of the list. |
2005-2009