Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ find(1) — HP-UX 6.20

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

cpio(1)

sh(1)

test(1)

stat(2)

cdf(4)

cpio(4)

fs(4)

FIND(1)  —  HP-UX

NAME

find − find files

SYNOPSIS

find path-name-list expression

DESCRIPTION

Find recursively descends the directory hierarchy for each path name in the path-name-list (that is, one or more path names) seeking files that match a boolean expression written in the primaries given below.  Find does not follow symbolic links.  In the descriptions of the primaries, the argument n is used as a decimal integer where +n means more than n, −n means less than n and n means exactly n.

−name file True if file matches the current file name.  Normal shell argument syntax may be used if escaped (watch out for [, ? and ∗). 

−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, see stat(2)) become significant and the flags are compared:

(flags&onum)==onum

−fstype type True if the filesystem to which the file belongs is of type type, where type is either hfs or nfs. 

−type c True if the type of the file is c, where c is b, c, d, l, p, n, or f for block special file, character special file, directory, symbolic link, fifo (a.k.a named pipe), network special file, or plain file respectively. 

−links n True if the file has n links. 

−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 taken as a user ID. 

−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 taken as a group ID. 

−size n[c] True if the file is n blocks long.  If n is followed by a c, the size is in characters. 

−atime n True if the file has been accessed in n days.  The access time of directories in path-name-list is changed by find itself. 

−mtime n True if the file has been modified in n days. 

−ctime n True if the file inode has been changed in n days. 

−exec cmd True if the executed cmd returns a zero value as exit status.  The end of cmd must be punctuated by an escaped semicolon.  A command argument {} is replaced by the current path name. 

−ok cmd Like −exec except that the generated command line is printed with a question mark first, and is executed only if the user responds by typing y. 

−print Always true; causes the current path name to be printed. 

−cpio device Always true; write the current file on device in cpio(4) format (5120-byte records).

−newer file True if the current file has been modified more recently than the argument file.

−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 can be useful when find is used with cpio(1) to transfer files that are contained in directories without write permission.

( expression ) True if the parenthesized expression is true (parentheses are special to the shell and must be escaped). 

−inum n True if the file has inode number n.

−ncpio Same as −cpio but adds the -c option to cpio. 

The primaries may be combined using the following operators (in order of decreasing precedence):

1) The negation of a primary (!  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 example searches two directories (/example and /new/example) for files containing the string Where are you and prints the names of the files:

find /example /new/example -exec grep −l ’Where are you’ {} \;

To remove all files named a.out or ∗.o that have not been accessed for a week:

find  /  \( −name a.out −o −name ´∗.o´ \) −atime +7 −exec rm {} \;

Note that the spaces delimiting the escaped parentheses are required. 

DEPENDENCIES

Series 300 Diskless
The following primaries supplement those described above:

−type H True if the type of the file is hidden directory (see cdf(4)).  The −hidden primary is then also implied (see below). 

−hidden Always true; causes hidden subdirectories (context-dependent files) to be included in the directory hierarchy of each path name in the path-name-list. Also, the normally hidden components of the path name will be visible, such as with the -print primary.  See cdf(4).

For example, to find all files in /bin that are context dependent, that is, hidden directories:

find /bin -type H -print

AUTHOR

Find was developed by AT&T and HP. 

FILES

/etc/group
/etc/passwd

SEE ALSO

cpio(1), sh(1), test(1), stat(2), cdf(4), cpio(4), fs(4). 

INTERNATIONAL SUPPORT

8- and 16-bit data; 8-bit file names, messages. 

Hewlett-Packard Company  —  May 11, 2021

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