1FIND(1) General Commands Manual FIND(1)
2
3
4
6 find - find files
7
9 find pathname-list expression
10
12 Find recursively descends the directory hierarchy for each pathname in
13 the pathname-list (i.e., one or more pathnames) seeking files that
14 match a boolean expression written in the primaries given below. In
15 the descriptions, the argument n is used as a decimal integer where +n
16 means more than n, -n means less than n and n means exactly n.
17
18 -name filename
19 True if the filename argument matches the current file name.
20 Normal Shell argument syntax may be used if escaped (watch
21 out for `[', `?' and `*').
22
23 -perm onum
24 True if the file permission flags exactly match the octal
25 number onum (see chmod(1)). If onum is prefixed by a minus
26 sign, more flag bits (017777, see stat(2)) become significant
27 and the flags are compared: (flags&onum)==onum.
28
29 -type c True if the type of the file is c, where c is b, c, d or f
30 for block special file, character special file, directory or
31 plain file.
32
33 -links n True if the file has n links.
34
35 -user uname
36 True if the file belongs to the user uname (login name or
37 numeric user ID).
38
39 -group gname
40 True if the file belongs to group gname (group name or
41 numeric group ID).
42
43 -size n True if the file is n blocks long (512 bytes per block).
44
45 -inum n True if the file has inode number n.
46
47 -atime n True if the file has been accessed in n days.
48
49 -mtime n True if the file has been modified in n days.
50
51 -exec command
52 True if the executed command returns a zero value as exit
53 status. The end of the command must be punctuated by an
54 escaped semicolon. A command argument `{}' is replaced by
55 the current pathname.
56
57 -ok command
58 Like -exec except that the generated command is written on
59 the standard output, then the standard input is read and the
60 command executed only upon response y.
61
62 -print Always true; causes the current pathname to be printed.
63
64 -newer file
65 True if the current file has been modified more recently than
66 the argument file.
67
68 The primaries may be combined using the following operators (in order
69 of decreasing precedence):
70
71 1) A parenthesized group of primaries and operators (parentheses are
72 special to the Shell and must be escaped).
73
74 2) The negation of a primary (`!' is the unary not operator).
75
76 3) Concatenation of primaries (the and operation is implied by the
77 juxtaposition of two primaries).
78
79 4) Alternation of primaries (`-o' is the or operator).
80
82 To remove all files named `a.out' or `*.o' that have not been accessed
83 for a week:
84
85 find / \( -name a.out -o -name '*.o' \) -atime +7 -exec rm {} \;
86
88 /etc/passwd
89 /etc/group
90
92 sh(1), test(1), filsys(5)
93
95 The syntax is painful.
96
97
98
99 FIND(1)