History log of /freebsd-10.1-release/usr.bin/find/find.1
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 272461 02-Oct-2014 gjb

Copy stable/10@r272459 to releng/10.1 as part of
the 10.1-RELEASE process.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 260579 12-Jan-2014 jilles

MFC r260336,r260355: find: Fix -lname and -ilname:

* Take into account that readlink() does not add a terminating '\0'.

* Do not match symlinks that are followed because of -H or -L. This is
explicitly documented in GNU find's info file and is like -type l.

* Fix matching symlinks in subdirectories when fts changes directories.

As before, symlinks of length PATH_MAX or more are not handled correctly.
(These can only be created on other operating systems.)

Also, avoid some readlink() calls on files that are obviously not symlinks
(because of fts(3) restrictions, not all of them).

PR: bin/185393
Submitted by: Ben Reser (parts, original version)


# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 247730 03-Mar-2013 dwmalone

Add an option for finding sparse files.

Reviewed by: iedowse
MFC after: 3 weeks


# 243280 19-Nov-2012 eadler

Use .Nm instead of a self xref

Approved by: bcr (mentor)
MFC after: 1 week


# 243239 18-Nov-2012 eadler

Make it clear that amin and friends take + and - options.

PR: docs/173265
Submitted by: Anton Shterenlikht <mexas@bristol.ac.uk>
Approved by: bcr (mentor)
MFC after: 3 days


# 240299 10-Sep-2012 des

Note that -quit terminates successfully.

Requested by: jmg@


# 240278 09-Sep-2012 des

Document -quit, four and a half years after it was implemented.

MFC after: 3 days
Pointy hat to: imp@


# 238780 25-Jul-2012 jilles

find: Implement real -ignore_readdir_race.

If -ignore_readdir_race is present, [ENOENT] errors caused by deleting a
file after find has read its name from a directory are ignored.

Formerly, -ignore_readdir_race did nothing.

PR: bin/169723
Submitted by: Valery Khromov and Andrey Ignatov


# 237035 13-Jun-2012 jilles

find(1): Move description of -d option to -depth primary.

The nullary -depth primary is standard and the -d option provides little
advantage.

PR: docs/168885
MFC after: 1 week


# 236860 10-Jun-2012 issyl0

Add more description and clarification about the -depth and -d options in
both places where they are mentioned in find(1).

Discussed with: dougb
PR: docs/168885
Reported by: Ronald F. Guilmette (rfg at tristatelogic dot com)
Approved by: gabor (mentor)
MFC after: 3 days


# 236596 05-Jun-2012 eadler

Fix style nit: don't use leading zero for dates in .Dd

Prompted by: brueffer
Approved by: brueffer
MFC after: 3 days


# 236433 02-Jun-2012 eadler

Document the limitations of the -delete primary

PR: bin/166554
Submitted by: Richard Kettlewell <rjk@greenend.org.uk>
Discussed with: jilles
Approved by: bcr
MFC after: 3 days


# 233648 29-Mar-2012 eadler

Remove trailing whitespace per mdoc lint warning

Disussed with: gavin
No objection from: doc
Approved by: joel
MFC after: 3 days


# 233456 25-Mar-2012 joel

Remove superfluous paragraph macro.


# 225847 28-Sep-2011 ed

Get rid of major/minor number distinction.

As of FreeBSD 6, devices can only be opened through devfs. These device
nodes don't have major and minor numbers anymore. The st_rdev field in
struct stat is simply based a copy of st_ino.

Simply display device numbers as hexadecimal, using "%#jx". This is
allowed by POSIX, since it explicitly states things like the following
(example taken from ls(1)):

"If the file is a character special or block special file, the
size of the file may be replaced with implementation-defined
information associated with the device in question."

This makes the output of these commands more compact. For example, ls(1)
now uses approximately four columns less. While there, simplify the
column length calculation from ls(1) by calling snprintf() with a NULL
buffer.

Don't be afraid; if needed one can still obtain individual major/minor
numbers using stat(1).


# 219455 10-Mar-2011 gjb

Move the explanation of using arguments for the PRIMARIES above
the list of PRIMARIES.

PR: 151812
Submitted by: Jay (jouellette of gmail com)
Patch by: eadler
MFC after: 1 week


# 216370 11-Dec-2010 joel

Remove the advertising clause from UCB copyrighted files in usr.bin. This
is in accordance with the information provided at
ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change

Also add $FreeBSD$ to a few files to keep svn happy.

Discussed with: imp, rwatson


# 205233 16-Mar-2010 pjd

Better way to find out available file system types is to use lsvfs(1).
Using 'sysctl vfs' is not only ugly, but is also not reliable - not all
file system types create entries in vfs sysctl tree.

Reviewed by: imp
MFC after: 1 week


# 197363 20-Sep-2009 jilles

Update find(1) man page for -L/-delete interaction.

It is a bit unfortunate that the example to delete broken symlinks now uses
rm(1), but allowing this with -delete would require fixing fts(3) to not
imply FTS_NOCHDIR if FTS_LOGICAL is given (or hacks in the -delete option).

PR: bin/90687
MFC after: 2 weeks


# 176761 03-Mar-2008 ru

Fix SYNOPSIS and usage().


# 176532 24-Feb-2008 ceri

Bump .Dd for revisions 1.83 and 1.84.


# 176531 24-Feb-2008 imp

Tag -ilname and -lname as GNU extensions.
Correct their descriptions to indicate that it is the contents of the
symbolic link that are matched.


# 176478 23-Feb-2008 imp

Implement a number of primaries present in GNU find, but not present
in our find.

The following are nops because they aren't relevant to our find:
-ignore_readdir_race
-noignore_readdir_race
-noleaf
The following aliaes were created:
-gid -> -group [2]
-uid -> -user [2]
-wholename -> -path
-iwholename -> ipath
-mount -> -xdev
-d -> -depth [1]
The following new primaries were created:
-lname like -name, but matches symbolic links only)
-ilname like -lname but case insensitive
-quit exit(0)
-samefile returns true for hard links to the specified file
-true Always true
I changed one primary to match GNU find since I think our use of it violates
POLA
-false Always false (was an alias for -not!)

Also, document the '+' modifier for -execdir, as well as all of the above.
This was previously implemented.

Document the remaining 7 primaries that are in GNU find, but aren't yet
implemented in find(1)

[1] This was done in GNU find for compatibility with FreeBSD, yet they
mixed up command line args and primary args.

[2] -uid/-gid in GNU find ONLY takes a numeric arg, but that arg does the
normal range thing that. GNU find -user and -uid also take a numberic arg,
but don't do the range processing. find(1) does both for -user and -group,
so making -uid and -gid aliases is compatible for all non-error cases used
in GNU find. While not perfect emulation, this seems a reasonable thing
for us.


# 167102 28-Feb-2007 ru

Check in some insignificant fixes obtained as a result of
the translation work.


# 165179 13-Dec-2006 ru

Fix the description of the -Btime primary.

Noticed by: Vadim Goncharov <vadimnuclight tpu.ru>


# 163125 08-Oct-2006 ceri

Update the list of POSIX extensions.

PR: docs/103859
Submitted by: shaun
MFC after: 1 week


# 162792 29-Sep-2006 ru

Markup fixes.


# 160466 18-Jul-2006 stefanf

Document that the pathname(s) following the options need not be given if
-f pathname was specified.


# 158986 27-May-2006 krion

Add the capability for a trailing scale indicator to cause the
specified size to be read in the more familiar units of kilobytes,
megabytes, gigabytes, terabytes and petabytes.

PR: bin/50988
Submitted by: Matthew Seaman <m.seaman@infracaninophile.co.uk>
MFC after: 7 days


# 157472 04-Apr-2006 ceri

Note that all of the birthtime related primaries are non-standard.


# 157441 03-Apr-2006 ceri

Bump .Dd for the birthtime options.


# 157440 03-Apr-2006 ceri

Add -Btime, -Bnewer, -Bmin, -newerB[Bacmt], -newer[acmt]B options to
work with the st_birthtime field of struct stat.

'B' has been chosen to match the format specifier from stat(1).

Approved by: jhb
MFC after: 2 weeks


# 147370 14-Jun-2005 ru

Markup and wording fixes.

Approved by: re (blanket)


# 144526 02-Apr-2005 tjr

Use rpmatch() instead of checking for responses that begin with 'y'
in queryuser(). This allows users to respond to -ok and -okdir
prompts with any affirmative reply defined by their current locale.


# 140055 11-Jan-2005 ru

Scheduled mdoc(7) sweep.


# 132813 29-Jul-2004 tjr

Now that fnmatch() supports multibyte characters, find does too; remove
entry from BUGS section that said otherwise.


# 132709 27-Jul-2004 cperciva

Start new sentence on new line.

Pointed out by: simon


# 132707 27-Jul-2004 cperciva

Add a BUGS entry pointing out that -mindepth and -maxdepth are global
options even though they look like primaries. (This is already documented
in the options themselves, but is sufficiently astonishing that I think it
deserves a BUGS entry as well.)


# 132706 27-Jul-2004 cperciva

Merge the "multibyte not supported" BUG into the pre-existing BUGS
section.

Move the HISTORY section to place it before BUGS rather than after BUGS,
in order to minimize the chance of this error being reproduced in the
future. (Both mdoc(7) and 63% of manual pages have these sections listed
in this order.)


# 131754 07-Jul-2004 ru

mdoc(7) fixes.


# 131511 02-Jul-2004 tjr

Document missing multibyte character support in utilities specified
by POSIX.


# 131509 02-Jul-2004 tjr

Re-add half of UCB copyright notice that went missing in 1.20.


# 129812 28-May-2004 eik

- introduce a new primary `-depth n', which tests whether
the depth of the current file relative to the starting
point of the traversal is n. The usual +/- modifiers
to the argument apply.

- while I'm here, fix -maxdepth in the case of a depth-first
traversal

Print the top ten maintainers of python module ports
(works with p5-* too):

find /usr/ports -depth 2 \! -name 'py-*' -prune -o \
-depth 3 -name Makefile -execdir make -VMAINTAINER \; \
| sort | uniq -c | sort -nr | head

PR: 66667
Reviewed by: ru, joerg
Approved by: joerg
MFC after: 2 weeks


# 129428 19-May-2004 ru

Bumped document date.
Fixed a bunch of hyphen misspellings.
Fixed one warning.


# 129273 16-May-2004 eik

snafu, exchanged the descriptions of -maxdepth and -mindepth.

Noticed by: ru


# 129211 14-May-2004 eik

-maxdepth and -mindepth are global variables

PR: 66613
Approved by: ru
MFC after: 3 days


# 128505 20-Apr-2004 des

Clarify and correct some compatibility notes.

PR: 65822


# 128010 07-Apr-2004 trhodes

Add -acl and a small blurb about it to the options list.
Update date.


# 126331 27-Feb-2004 trhodes

Update the find manual page:

1: Document -follow under COMPATIBILITY.
2: Update an example to be a little more 'safe'.
3: Use '/' in place of '.' for an example; similar to other manual pages.

PR: 40196 (1), 39532 (2, 3)
Submitted by: Marc Silver <marcs@draenor.org> (2 and 3)
Discussed with: des (1)


# 126158 23-Feb-2004 des

Typo.


# 118021 25-Jul-2003 schweikh

State that in -exec ... ; the semicolon should be quoted if invoked from
a shell.

PR: docs/54667
Submitted by: Patrick Alken <pa59@cornell.edu>
MFC after: 3 days


# 107788 12-Dec-2002 ru

Uniformly refer to a file system as "file system".

Approved by: re


# 107261 26-Nov-2002 ru

mdoc(7) police: markup polishing.

Approved by: re


# 102498 27-Aug-2002 charnier

Do not repeat the name of the flag in its description


# 102083 19-Aug-2002 jmallett

Add a unary -not operator ala -false and !, for sake of completeness.

Obtained from: OpenDarwin
MFC after: 1 week


# 101932 15-Aug-2002 jmallett

Oops, add -false to the operators list in the manual page for find(1), as added
in revision 1.17 of option.c.

MFC after: 1 week


# 98863 26-Jun-2002 tjr

Indicate that the semicolon that terminates argument lists should be in
its own argument for -ok and -okdir.


# 98862 26-Jun-2002 tjr

Make it more obvious that the semicolon that terminates -exec and -execdir
argument lists must be in an argument by itself, not on the end of the
previous one.


# 97736 02-Jun-2002 tjr

Support the SysV-style -exec utility args.. {} + function, required by
SUSv3. This is similar to find foo -print0 | xargs -0 utility args.


# 97496 29-May-2002 ru

mdoc(7) police: markup nits.


# 96704 16-May-2002 trhodes

More consistancy. file system > filesystem


# 95124 20-Apr-2002 charnier

Use `The .Nm utility'


# 94366 10-Apr-2002 trhodes

find.1 does not encourage users to DTRT when piping to xargs(1)

PR: 36602
Submitted by: Joshua Goodall <joshua@roughtrade.net>
No objections from: ru
MFC after: 2 days


# 93528 01-Apr-2002 keramida

Run find.1 through ispell.

PR: docs/36601
Submitted by: Joshua Goodall <joshua@roughtrade.net>
MFC after: 3 days


# 86674 20-Nov-2001 ru

Add a missing comma.


# 84595 06-Oct-2001 obrien

Document -depth


# 83450 14-Sep-2001 ru

Bloat find(1) even more, and introduce the concept
of time units to be used with -[acm]time primaries.

Based on patch from Nils M Holm <nmh@t3x.org>.

PR: bin/29165, bin/30309


# 82972 04-Sep-2001 ru

The implementation of -flags was broken and did not match the (poorly)
documented behavior. Only a certain set of file flags were recognized,
and "no" flags did not match files that have corresponding flags bits
turned off.

Fix and extend the -flags functionality as follows:

: -flags [-|+]<flags>,<notflags>
: The flags are specified using symbolic names (see chflags(1)).
: Those with the "no" prefix (except "nodump") are said to be
: <notflags>. Flags in <flags> are checked to be set, and flags in
: <notflags> are checked to be not set. Note that this is different
: from -perm, which only allows the user to specify mode bits that
: are set.
:
: If flags are preceded by a dash (``-''), this primary evaluates
: to true if at least all of the bits in <flags> and none of the bits
: in <notflags> are set in the file's flags bits. If flags are pre-
: ceded by a plus (``+''), this primary evaluates to true if any of
: the bits in <flags> is set in the file's flags bits, or any of the
: bits in <notflags> is not set in the file's flags bits. Otherwise,
: this primary evaluates to true if the bits in <flags> exactly match
: the file's flags bits, and none of the <flags> bits match those of
: <notflags>.

MFC after: 2 weeks


# 82662 31-Aug-2001 ru

Sort predicates.

PR: docs/30237


# 78966 29-Jun-2001 yar

Clarify the feature that -exec parameters won't get
shell-expanded when the specified utility is run.

MFC after: 5 days


# 76681 16-May-2001 ru

mdoc(7) police: fix markup.


# 76250 03-May-2001 phk

They add the following commands:
-anewer
-cnewer
-mnewer
-okdir
-newer[acm][acmt]

With it, you can form queries like

find . -newerct '1 minute ago' -print

As an extra bonus, the program is ANSI-fied - the original version
relies on some obscure features of K&R C.

(This PR was submitted in 1999, and the submittor has kept the patch
updated ever since, hats off for him guys, and how about you close a PR ??)

PR: 9374
Submitted by: Martin Birgmeier <Martin.Birgmeier@aon.at>


# 72974 24-Feb-2001 ru

mdoc(7) police: restore correct order of references in the SEE ALSO.


# 72945 23-Feb-2001 knu

Implement the following options and primaries:

-E Interpret regular expressions followed by -regex and -iregex op-
tions as extended (modern) regular expressions rather than basic
regular expressions (BRE's). The re_format(7) manual page fully
describes both formats.

-iname pattern
Like -name, but the match is case insensitive.

-ipath pattern
Like -path, but the match is case insensitive.

-regex pattern
True if the whole path of the file matches pattern using regular
expression. To match a file named ``./foo/xyzzy'', you can use
the regular expression ``.*/[xyz]*'' or ``.*/foo/.*'', but not
``xyzzy'' or ``/foo/''.

-iregex pattern
Like -regex, but the match is case insensitive.

These are meant to be compatible with other find(1) implementations
such as GNU's or NetBSD's except regexp library differences.

Reviewed by: sobomax, dcs, and some other people on -current


# 71895 01-Feb-2001 ru

mdoc(7) police: split punctuation characters + misc fixes.


# 71422 23-Jan-2001 peter

Add the -empty flag, from OpenBSD. It returns true if the directory
is empty. There doesn't appear to be another easy way to do this.

mobile# mkdir foo
mobile# mkdir foo/bar
mobile# mkdir bar
mobile# find . -empty
./foo/bar
./bar


# 71102 16-Jan-2001 ru

Prepare for mdoc(7)NG.


# 70197 19-Dec-2000 ru

Prepare for mdoc(7)NG.


# 68963 20-Nov-2000 ru

mdoc(7) police: use the new features of the Nm macro.


# 68866 17-Nov-2000 mph

"minute(s) period(s)" --> "minute(s)"


# 61575 12-Jun-2000 roberto

This patch adds the -mindepth and -maxdepth options to find(1), which
behave as in GNU find (and of course as described in the manual page
diff included). I think these options would be useful for some people.

Some missing $FreeBSD$ tags are also added.

The patch was slightly modified (send-pr mangling of TABS).

PR: bin/18941
Submitted by: Ben Smithurst <ben@scientia.demon.co.uk>


# 61573 12-Jun-2000 roberto

The find -perm option currently supports an exact match,
or if the mode is preceded by a '-', it checks for a match
in at least the bits specified on the command line. It is
often desirable to find things with any execute or setuid or
setgid bits set.

PR: bin/10169
Submitted by: Monte Mitzelfelt <monte@gonefishing.org>


# 57666 01-Mar-2000 nik

Fix errors in .Xr usage.

PR: docs/17057
Submitted by: Submitted by: Udo Erdelhoff <ue@nathan.ruhr.de>


# 54828 19-Dec-1999 roberto

Second part of bin/3648: add -flags to search for specific flags.
I added $FreeBSD$ whicle I was here. The patch wasn't usable anymore
due to its age so I adapted it.

PR: bin/3648
Submitted by: Martin Birgmeier <mbirg@austria.ds.philips.com>


# 50477 27-Aug-1999 peter

$Id$ -> $FreeBSD$


# 47776 06-Jun-1999 kris

The -perm option takes argument [-]mode, not [-mode]

Obtained from: NetBSD, by way of OpenBSD


# 45809 19-Apr-1999 jkoshy

Clarify wording to indicate that the arguments to find(1) are path names
(and can be both files or directories). Show white space between
"(", ")", "!" and their corresponding `expression' arguments as
expected by the expression parser inside find(1).

Prompted by: David Honig <David.Honig@idt.com> on freebsd-doc
Message-Id: <199904132055.NAA09432@justinian.Eng.idt.com>


# 42212 31-Dec-1998 billf

Typo - "the -delete primary do not.." -> "the -delete primary does not.."

PR: docs/9255
Submitted by: Christian Weisgerber <naddy@bigeye.rhein-neckar.de>


# 41402 29-Nov-1998 bde

Fixed English in previous commit. Clarify "lexicographical order".
Don't format paragraphs manually (new sentences not beginning on new
lines give hard-formatted line breaks).


# 41391 28-Nov-1998 wosch

Added a sort option to find(1).

The sort option make it possible to build the locate
database without large (usually 20-100MB) temp files.


# 36057 15-May-1998 jkoshy

Add cross references for find(1), locate(1), whereis(1) and which(1).

Submitted by: Josh Gillam <josh@quick.net>
PR: docs/6642


# 30781 27-Oct-1997 steve

Better wording explaining that all single character options
are extensions along with the previous list of primaries.

Suggested by: bde


# 30759 27-Oct-1997 steve

Offending statement removed from STANDARDS section. From what I
can gather from the Posix spec that I have (which is very old)
all one character options are extensions to Posix.

PR: docs/4701


# 30395 13-Oct-1997 wosch

Add the primaries -mmin, -amin, -cmin to find, similar to the GNU find.


# 28914 29-Aug-1997 imp

Add -execdir which will execute the exec command in the dir of the file
in question. This change and the fts changes should be merged into 2.2-stable
as soon as they are vetted in -current. This should allow cleaning of files
in /tmp to be reneabled.
Obtained from: OpenBSD


# 25941 19-May-1997 jdp

Mention that "-P" is the default.


# 25932 19-May-1997 eivind

`it's'' -> `its'' where appropriate and typo fixes in time2posix.3.

Closes PR docs/3612.

Submitted by: Josh Gilliam <soil@quick.net>


# 25395 02-May-1997 max

Minor typo.
PR: 3472
Submitted by: Josh Gilliam <soil@quick.net>


# 23695 11-Mar-1997 peter

Merge from Lite2 - use new getvfsbyname() and related changes.
understand whiteouts (FTS_W from fts()).


# 23012 22-Feb-1997 peter

Revert $FreeBSD$ to $Id$


# 21673 14-Jan-1997 jkh

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


# 18681 04-Oct-1996 peter

Implement a -delete option to find. The code is extremely paranoid and
goes to a fair degree of trouble to enable something like this to
be safe: cd /tmp && find . -mtime +7 -delete

It removes both files and directories. It does not attempt to remove
immutable files (an earlier version I showed to a few people did a chflags
and tried to blow away even immutable files. Too risky..)

It is thought to be safe because it forces the fts(3) driven descent to
only do "minimal risk" stuff. specifically, -follow is disabled, it does
checking to see that it chdir'ed to the directory it thought it was
going to, it will *not* pass a pathname with a '/' character in it to
unlink(), so it should be totally immune to symlink tree races. If it runs
into something "fishy", it bails out rather than blunder ahead.. It's better
to do that if somebody is trying to compromise security rather than risk
giving them an opportunity. Since the unlink()/rmdir() is being called
from within the current working directory during the tree descent, there
are no fork/exec overheads or races.

As a side effect of this paranoia, you cannot do a
"find /somewhere/dir -delete", as the last argument to rmdir() is
"/somewhere/dir", and the checking won't allow it. Besides, one would use
rm -rf for that case anyway. :-)

Reviewed by: pst (some time ago, but I've removed the immutable file
deletion code that he complained about since he last saw it)


# 17891 29-Aug-1996 wosch

[HISTORY] command appeared in Version 1 AT&T UNIX
Obtained from: A Quarter Century of UNIX, Peter H. Salus, page 41


# 8389 09-May-1995 wollman

Add GNU-style `-print0' primary. This exists so that one can safely
do `find some-nasty-expression -print0 | perl -n0e unlink' and have all
the files actuallly get deleted. (Using `xargs' and `rm' is not safe.)


# 1591 27-May-1994 rgrimes

This commit was generated by cvs2svn to compensate for changes in r1590,
which included commits to RCS files with non-trunk default branches.


# 1590 27-May-1994 rgrimes

BSD 4.4 Lite Usr.bin Sources