®nd(1)

®nd(1)

If any internationalization variable contains an invalid setting, all internationalization variables default to

C(see environ(5)).

LC_CTYPE determines the interpretation of text as single and/or multibyte characters, the classi®cation of characters as printable, and the characters matched by character class expressions in regular expressions.

LC_MESSAGES determines the locale that should be used to affect the format and contents of diagnostic messages written to standard error and informative messages written to standard output.

NLSPATH determines the location of message catalogues for the processing of LC_MESSAGES .

International Code Set Support

Single- and multibyte character code sets are supported.

EXAMPLES

Search the two directories /example and /new/example for ®les containing the string Where are you and print the names of the ®les:

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

Remove all ®les 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.

Print the names of all ®les on this machine. Avoid walking nfs directories while still printing the nfs mount points:

find / -fsonly hfs -print

Match only local ®les, and do not examine the contents of any directory found to be remotely mounted:

find / ! -local -prune -o -size +50 -print

This only works correctly if there are no local ®le systems mounted on top of remote directories. This example will print all local ®les on the system larger than 50 blocks, without wasting time accessing remote ®les.

To get the same effect, but to check for ®les in local ®le systems mounted on remote directories, use:

find / -local -size +50 -print

Copy the entire ®le system to a disk mounted on /Disk, avoiding the recursive copy problem. Both commands are equivalent (note the use of -pathinstead of -name):

cd /; find . ! -path ./Disk -only -print cpio -pdxm /Disk cd /; find . -path ./Disk -prune -o -print cpio -pdxm /Disk

Copy the root disk to a disk mounted on /Disk, skipping all mounted ®le systems below /. Note that - xdev does not cause / to be skipped, even though it is a mount point. This is because / is the starting point and -xdevonly affects entries below starting points.

cd /; find . -xdev -print cpio -pdm /Disk

Change permissions on all regular ®les in a directory subtree to mode 444, and permissions on all directories to 555:

find pathname -type f -print xargs chmod 444 find pathname -type d -print xargs chmod 555

Note that output from find was piped to xargs(1) instead of using the -execprimary. This is because when a large number of ®les or directories is to be processed by a single command, the - exec primary spawns a separate process for each ®le or directory, whereas xargs collects ®le names or directory names into multiple arguments to a single chmod command, resulting in fewer processes and greater system ef®ciency. The + delimiter for the -execprimary can be used to achieve the same ef®ciency.

Access Control List Examples

Find all ®les not owned by user karl that have access control lists with at least one entry associated with karl, and one entry for no speci®c user in group bin with the read bit on and the write bit off:

find / ! -user karl -acl 'karl.*, %.bin+r-w' -print

f

HP-UX Release 11i: December 2000

− 5 −

Section 1275