Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ find(1) — A/UX 3.0.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

chmod(1)

cpio(1)

csh(1)

ksh(1)

sh(1)

xargs(1)

stat(2)

cpio(4)

fs(4)

ff(1M)




find(1) find(1)
NAME find - finds files SYNOPSIS find pathname... expression ARGUMENTS expression Specifies the Boolean expression that is to be found. pathname Specifies the pathname to be searched. DESCRIPTION find recursively descends the directory hierarchy for each pathname specified by a pathname argument, seeking files that match the Boolean expression expression written in the primaries described in this section. The find command does not follow symbolic links. In the descriptions of the primaries, the argument n represents a decimal integer, where +n means more than n, -n means less than n, and n means exactly n. -atime n True if the file has been accessed within the last n days. The access time of directories in the pathname argument is changed by find itself. -cpio device Always true; writes the current file on device in cpio(4) format (512-byte records). -ctime n True if the file has been changed within the last n days. -depth Always true; causes descent of the directory hierarchy to be done so that all entries in a directory are acted on before the directory itself. This argument can be useful when you use find with cpio(1) to transfer files that are contained in directories for which you do not have write permission. -exec cmd True if the executed command cmd returns a zero value as its exit status. The end of cmd must be punctuated by an escaped semicolon. A command argument of the form {} is replaced by the current pathname. (expression) True if the parenthesized expression is true. January 1992 1



find(1) find(1)
(Parentheses are special to the shell and must be escaped.) -fstypetype True if the file system to which the file belongs is of the type specified by type. The value of type can be 4.2 Berkeley Software Distribution (BSD), 5.2 System V File System (SVFS), or nfs Network File System (NFS). -group gname True if the file belongs to the group gname. If gname is numeric and does not appear in the /etc/group file, it is interpreted as a group ID. -inum n True if the file has the inode number specified by n. -links n True if the file has n links. -mtime n True if the file has been modified within the last n days. -name file True if file matches the current filename. You can use normal shell argument syntax if it is escaped. (Use the [, ?, and * characters carefully.) -newer file True if the current file has been modified more recently than the argument file. -ok cmd Same as -exec, except that the generated command line is printed with a question mark as the first character, and is executed only if you respond by typing y. -perm onum True if the file permission flags exactly match the octal number onum (see chmod(1)). If onum is prefixed by a minus sign, more flag bits (017777, described in stat(2)) become significant and the flags are compared: (flags & onum) == onum -print Always true; causes the current pathname to be printed. -prune Always true. Has the side effect of pruning the search 2 January 1992



find(1) find(1)
tree at the file; that is, if the current pathname is a directory, find does not descend into that directory. -size n[c] True if the file is n blocks long (512 bytes per block). If n is followed by a c, the size is in characters. -type c True if the type of the file is c, where c is b, c, d, l, p, or f for block special file, character special file, directory, symbolic link, FIFO (named pipe), or plain file, respectively. -user uname True if the file belongs to the user uname. If uname is numeric and does not appear as a login name in the /etc/passwd file, it is interpreted as a user ID. You can combine the primaries by using the following operators (in order of decreasing precedence): 1. The negation of a primary. The exclamation point (!) is the unary NOT operator. 2. Concatenation of primaries. The AND operation is implied by the juxtaposition of two primaries. 3. Alternation of primaries. -o is the OR operator. EXAMPLES The following command locates and prints all files in /tmp and its subdirectories that are named junk. find /tmp -name junk -print The following command finds all files, starting with the root directory, on which the permission levels have been set to 755 (see chmod(1)). find / -perm 755 -exec ls "{}" ";" With -exec and a command such as ls, it is often necessary to escape the curly braces ({}), that store the current pathname under investigation, by putting the pathname in double quotation marks. It is always necessary to escape the semicolon at the end of an -exec sequence. Note again that it is also necessary to escape parentheses used for grouping primaries, by means of a backslash, as shown here. The following command removes all files named a.out or *.o. January 1992 3



find(1) find(1)
find \( -name a.out -o -name '*.o' \) -exec rm {} \; FILES /bin/find Executable file /etc/passwd File containing user information find /tmp -name junk -print /etc/group File containing group information SEE ALSO chmod(1), cpio(1), csh(1), ksh(1), sh(1), xargs(1) stat(2), cpio(4), fs(4) in A/UX Programmer's Reference ff(1M) in A/UX System Administrator's Reference ``Other Programming Tools'' in A/UX Programming Languages and Tools, Volume 2 4 January 1992

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026