find.1 (2010 09)

f
find(1) find(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 classification
of characters as printable, and the characters matched by character class expressions in regular expres-
sions.
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
Here are several
find examples.
The following examples show using
-H and
-L options. hey is a symbolic link which points to a direc-
tory
hmm.
$ ll /maint/proj/sums
total 0
-rw-rw-rw- 1 dog animal 0 Dec 22 10:55 hello
lrwxrwxrwx 1 dog animal 3 Dec 22 11:15 hey -> hmm
-rw-rw-rw- 1 dog animal 0 Dec 22 10:55 hi
drwxrwxrwx 2 dog animal 96 Dec 22 11:24 hmm
The following command lists the filenames which are type directories. hey is not printed by default.
$ /usr/bin/find /maint/proj/sums/ -type d
/maint/proj/sums
/maint/proj/sums/hmm
The following command uses the -H option. Because /maint/proj/sums/hey
is not found on the
command line, it is not followed and not treated as a directory.
$ /usr/bin/find -H /maint/proj/sums/ -type d
/maint/proj/sums
/maint/proj/sums/hmm
The following command uses the -L option. Although /maint/proj/sums/hey
is not found on the
command line, the
-L option causes all the symbolic links encountered anywhere in the file hierarchy
to be followed.
$ /usr/bin/find -L /maint/proj/sums/ -type d
/maint/proj/sums
/maint/proj/sums/hmm
/maint/proj/sums/hey
In the following -H example, the symbolic link, hey, is on the command line, so it is followed and
recognized as a type directory.
$ /usr/bin/find -H /maint/proj/sums/hey -type d
/maint/proj/sums/hey
Search two directories, /example and /new/example, for files containing the string Where are
you and print the names of the files:
find /example /new/example -exec grep -l ’Where are you’ {} \;
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.
Print a single long listing of all files named
*.o in the current directory:
6 Hewlett-Packard Company 6 HP-UX 11i Version 3: September 2010