Index: doc/find.texi =================================================================== RCS file: /cvsroot/findutils/findutils/doc/find.texi,v retrieving revision 1.109.2.3 diff -u -r1.109.2.3 find.texi --- doc/find.texi 8 Oct 2005 06:11:04 -0000 1.109.2.3 +++ doc/find.texi 15 Oct 2005 12:19:54 -0000 @@ -979,6 +979,7 @@ If @var{mode} starts with @samp{-}, true if @emph{all} of the permissions set in @var{mode} are set for the file; permissions not set in @var{mode} are ignored. + If @var{mode} starts with @samp{/}, true if @emph{any} of the permissions set in @var{mode} are set for the file; permissions not set in @var{mode} are ignored. @@ -1028,6 +1029,14 @@ @item -perm -g+w,o+w As above. + +@item -perm -444 -perm /222 ! -perm /111 +Search for files which are readable for everybody, have at least on write +bit set but are not executable for anybody. + +@item -perm -a+r -perm /a+w ! -perm /a+x +As above. + @end table @end deffn Index: find/find.1 =================================================================== RCS file: /cvsroot/findutils/findutils/find/find.1,v retrieving revision 1.63.2.3 diff -u -r1.63.2.3 find.1 --- find/find.1 17 Sep 2005 21:44:07 -0000 1.63.2.3 +++ find/find.1 15 Oct 2005 12:19:55 -0000 @@ -340,30 +340,53 @@ .IP "\-path \fIpattern\fR" See \-wholename. The predicate \-path is also supported by HP-UX .BR find . -.IP "\-perm \fImode\fR" +.IP "\-perm \fImode\fR | \-perm \-\fImode\fR | \-perm /\fImode\fR | \-perm +\fImode\fR" +Search for files with specific permissions. Both symbolic and numerical +specifiers for \fImode\fR as documented in \fB chmod\fP(1) +can be used. Symbolic modes are evaluated by starting with a pattern which +has no permission bits set (0000) and applying the specified symbolic mode +specification to it. A symbolic mode may not start with a \-, to avoid any +possibility of ambiguity concerning evaluation as +.B \-perm \fImode\fR +or +.B \-perm \-\fImode\fR. +As removing permission bits from the starting point 0000 does not make any +sense this does not restrict functionality. + +See the +.B EXAMPLES +section for some illustrative examples. + +.B \-perm \fImode\fR: File's permission bits are exactly \fImode\fR (octal or symbolic). Since an exact match is required, if you want to use this form for symbolic modes, you may have to specify a rather complex mode string. For example '\-perm g=w' will only match files which have mode 0020 (that is, ones for which group write permission is the only permission -set). It is more likely that you will want to use the '+' or '-' +set). It is more likely that you will want to use the '/' or '-' forms, for example '\-perm -g=w', which matches any file with group -write permission. See the -.B EXAMPLES -section for some illustrative examples. -.IP "\-perm \-\fImode\fR" +write permission. + +.B \-perm \-\fImode\fR: All of the permission bits \fImode\fR are set for the file. -Symbolic modes are accepted in this form, and this is usually the way -in which would want to use them. You must specify 'u', 'g' or 'o' if -you use a symbolic mode. See the -.B EXAMPLES -section for some illustrative examples. -.IP "\-perm /\fImode\fR" -Any of the permission bits \fImode\fR are set for the file. Symbolic -modes are accepted in this form. You must specify 'u', 'g' or 'o' if -you use a symbolic mode. See the -.B EXAMPLES -section for some illustrative examples. + +.B \-perm /\fImode\fR: +Any of the permission bits \fImode\fR are set for the file. + +.B \-perm +\fImode\fR: +Deprecated, old way of searching for files with any of the permission +bits \fImode\fR set. Use +.B -perm \fI/mode\fR +instead. Trying to use this +syntax with symbolic modes will yield surprising results: e.g. '+u+x' is +a valid symbolic mode (equivalent to +u,+x, i.e. 0111) and will therefore not +be evaluated as +.B \-perm +\fImode\fR +but as exact mode specifier +.B \-perm \fImode\fR +therefore matching files with exact permissions 0111 instead of files with any +execute bit set. + .IP "\-regex \fIpattern\fR" File name matches regular expression \fIpattern\fR. This is a match on the whole path, not a search. For example, to match a file named @@ -1135,6 +1158,16 @@ Both these commands do the same thing; search for files which are writable by both their owner and their group. +.P +.nf +.B find . \-perm \-444 \-perm /222 ! \-perm /111 +.B find . \-perm \-a+r \-perm /a+w ! \-perm /a+x + +.fi +These two commands both search for files that are readable for everybody +(\-perm \-444 or \-perm \-a+r), have at least on write bit set (\-perm /222 +or \-perm /a+w) but are not (!) executable for anybody (\-perm /111 and +\-perm /a+x respectively). .SH EXIT STATUS @@ -1148,9 +1181,9 @@ .SH "SEE ALSO" \fBlocate\fP(1), \fBlocatedb\fP(5), \fBupdatedb\fP(1), \fBxargs\fP(1), -\fBfnmatch\fP(3), \fBregex\fP(7), \fBstat\fP(2), \fBlstat\fP(2), -\fBls\fP(1), \fBprintf\fP(3), \fBstrftime\fP(3), \fBctime\fP(3), -\fBFinding Files\fP (on-line in Info, or printed), +\fBchmod\fP(1), \fBfnmatch\fP(3), \fBregex\fP(7), \fBstat\fP(2), +\fBlstat\fP(2), \fBls\fP(1), \fBprintf\fP(3), \fBstrftime\fP(3), +\fBctime\fP(3), \fBFinding Files\fP (on-line in Info, or printed), .SH "HISTORY" As of findutils-4.2.2, shell metacharacters ('*'. '?' or '[]' for example) used in filename patterns will match a leading '.', because