2017-07-04 00:28:48 +03:00
|
|
|
.\" $NetBSD: find.1,v 1.89 2017/07/03 21:34:57 wiz Exp $
|
1997-01-09 23:18:21 +03:00
|
|
|
.\"
|
1993-12-31 00:15:18 +03:00
|
|
|
.\" Copyright (c) 1990, 1993
|
|
|
|
.\" The Regents of the University of California. All rights reserved.
|
1993-03-21 12:45:37 +03:00
|
|
|
.\"
|
|
|
|
.\" This code is derived from software contributed to Berkeley by
|
|
|
|
.\" the Institute of Electrical and Electronics Engineers, Inc.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
2003-08-07 15:13:06 +04:00
|
|
|
.\" 3. Neither the name of the University nor the names of its contributors
|
1993-03-21 12:45:37 +03:00
|
|
|
.\" may be used to endorse or promote products derived from this software
|
|
|
|
.\" without specific prior written permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
1998-02-02 17:02:06 +03:00
|
|
|
.\" from: @(#)find.1 8.7 (Berkeley) 5/9/95
|
1993-03-21 12:45:37 +03:00
|
|
|
.\"
|
2016-06-13 03:04:40 +03:00
|
|
|
.Dd June 13, 2016
|
1993-03-21 12:45:37 +03:00
|
|
|
.Dt FIND 1
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm find
|
|
|
|
.Nd walk a file hierarchy
|
|
|
|
.Sh SYNOPSIS
|
2006-09-23 09:03:33 +04:00
|
|
|
.Nm
|
1998-02-02 17:02:06 +03:00
|
|
|
.Op Fl H | Fl L | Fl P
|
2007-07-19 11:49:30 +04:00
|
|
|
.Op Fl dEhsXx
|
2005-08-10 10:51:24 +04:00
|
|
|
.Ar file
|
1993-03-21 12:45:37 +03:00
|
|
|
.Op Ar file ...
|
2006-09-23 09:03:33 +04:00
|
|
|
.Op Ar expression
|
|
|
|
.Nm
|
|
|
|
.Op Fl H | Fl L | Fl P
|
2007-07-19 11:49:30 +04:00
|
|
|
.Op Fl dEhsXx
|
2006-09-23 09:03:33 +04:00
|
|
|
.Fl f Ar file
|
|
|
|
.Op Ar file ...
|
|
|
|
.Op Ar expression
|
1993-03-21 12:45:37 +03:00
|
|
|
.Sh DESCRIPTION
|
1997-10-19 15:52:12 +04:00
|
|
|
.Nm
|
1993-03-21 12:45:37 +03:00
|
|
|
recursively descends the directory tree for each
|
|
|
|
.Ar file
|
|
|
|
listed, evaluating an
|
|
|
|
.Ar expression
|
2002-09-27 20:56:53 +04:00
|
|
|
(composed of the
|
|
|
|
.Dq primaries
|
|
|
|
and
|
|
|
|
.Dq operands
|
|
|
|
listed below) in terms
|
1993-03-21 12:45:37 +03:00
|
|
|
of each file in the tree.
|
|
|
|
.Pp
|
|
|
|
The options are as follows:
|
|
|
|
.Bl -tag -width Ds
|
1993-12-31 00:15:18 +03:00
|
|
|
.It Fl H
|
2012-08-16 17:34:10 +04:00
|
|
|
Causes the file information and file type (see
|
|
|
|
.Xr stat 2 )
|
2001-12-01 19:43:07 +03:00
|
|
|
returned for each symbolic link encountered on the command line to be
|
1993-12-31 00:15:18 +03:00
|
|
|
those of the file referenced by the link, not the link itself.
|
|
|
|
If the referenced file does not exist, the file information and type will
|
2002-09-27 20:56:53 +04:00
|
|
|
be for the link itself.
|
|
|
|
File information of all symbolic links not on the command line is that
|
|
|
|
of the link itself.
|
1998-02-02 17:02:06 +03:00
|
|
|
.It Fl L
|
2012-08-16 17:34:10 +04:00
|
|
|
Causes the file information and file type (see
|
2001-07-06 22:12:02 +04:00
|
|
|
.Xr stat 2 )
|
1998-02-02 17:02:06 +03:00
|
|
|
returned for each symbolic link to be those of the file referenced by the
|
|
|
|
link, not the link itself.
|
|
|
|
If the referenced file does not exist, the file information and type will
|
|
|
|
be for the link itself.
|
|
|
|
.It Fl P
|
2012-08-16 17:34:10 +04:00
|
|
|
Causes the file information and file type (see
|
2001-12-01 22:11:27 +03:00
|
|
|
.Xr stat 2 )
|
1998-02-02 17:02:06 +03:00
|
|
|
returned for each symbolic link to be those of the link itself.
|
1993-03-21 12:45:37 +03:00
|
|
|
.It Fl d
|
2012-08-16 17:34:10 +04:00
|
|
|
Causes
|
1997-10-19 15:52:12 +04:00
|
|
|
.Nm
|
2002-09-28 16:59:49 +04:00
|
|
|
to perform a depth-first traversal, i.e., directories
|
2012-08-16 17:34:10 +04:00
|
|
|
are visited in post-order, and all entries in a directory will be acted
|
1993-03-21 12:45:37 +03:00
|
|
|
on before the directory itself.
|
|
|
|
By default,
|
1997-10-19 15:52:12 +04:00
|
|
|
.Nm
|
2002-09-28 16:59:49 +04:00
|
|
|
visits directories in pre-order, i.e., before their contents.
|
1993-03-21 12:45:37 +03:00
|
|
|
Note, the default is
|
2016-06-12 06:21:35 +03:00
|
|
|
.Em not
|
2002-09-28 16:59:49 +04:00
|
|
|
a breadth-first traversal.
|
2007-07-19 11:49:30 +04:00
|
|
|
.It Fl E
|
2012-08-16 17:34:10 +04:00
|
|
|
Causes
|
2007-07-19 11:49:30 +04:00
|
|
|
.Ar regexp
|
|
|
|
arguments to primaries to be interpreted as extended regular
|
|
|
|
expressions (see
|
|
|
|
.Xr re_format 7 ) .
|
1993-03-21 12:45:37 +03:00
|
|
|
.It Fl f
|
2012-08-16 17:34:10 +04:00
|
|
|
Specifies a file hierarchy for
|
1997-10-19 15:52:12 +04:00
|
|
|
.Nm
|
1993-03-21 12:45:37 +03:00
|
|
|
to traverse.
|
|
|
|
File hierarchies may also be specified as the operands immediately
|
|
|
|
following the options.
|
1993-12-31 00:15:18 +03:00
|
|
|
.It Fl h
|
2012-08-16 17:34:10 +04:00
|
|
|
Causes the file information and file type (see
|
|
|
|
.Xr stat 2 )
|
1993-03-21 12:45:37 +03:00
|
|
|
returned for each symbolic link to be those of the file referenced by the
|
|
|
|
link, not the link itself.
|
|
|
|
If the referenced file does not exist, the file information and type will
|
|
|
|
be for the link itself.
|
2000-03-10 14:49:14 +03:00
|
|
|
.It Fl s
|
2012-08-16 17:34:10 +04:00
|
|
|
Causes the entries of each directory to be sorted in
|
2000-07-11 10:47:21 +04:00
|
|
|
lexicographical order.
|
2000-03-10 14:49:14 +03:00
|
|
|
Note that the sorting is done only inside of each directory;
|
|
|
|
files in different directories are not sorted.
|
|
|
|
Therefore,
|
|
|
|
.Sq Li a/b
|
|
|
|
appears before
|
|
|
|
.Sq Li a.b ,
|
2000-03-16 21:56:41 +03:00
|
|
|
which is different from
|
2000-03-10 14:49:14 +03:00
|
|
|
.Dq Li "find ... \&| sort"
|
|
|
|
order.
|
2004-03-31 05:46:22 +04:00
|
|
|
.It Fl X
|
2012-08-16 17:34:10 +04:00
|
|
|
Modifies the output to permit
|
2004-03-31 05:46:22 +04:00
|
|
|
.Nm
|
|
|
|
to be safely used in conjunction with
|
|
|
|
.Xr xargs 1 .
|
|
|
|
If a file name contains any of the delimiting characters used by
|
2012-06-28 02:31:26 +04:00
|
|
|
.Xr xargs 1 ,
|
2004-03-31 05:46:22 +04:00
|
|
|
a diagnostic message is displayed on standard error, and the file
|
|
|
|
is skipped.
|
|
|
|
The delimiting characters include single
|
|
|
|
.Pq Dq \&'
|
|
|
|
and double
|
|
|
|
.Pq Dq \&"
|
|
|
|
quotes, backslash
|
|
|
|
.Pq Dq \e ,
|
2013-02-08 16:50:51 +04:00
|
|
|
space, tab, and newline characters.
|
2004-03-31 05:46:22 +04:00
|
|
|
Alternatively, the
|
|
|
|
.Ic -print0
|
|
|
|
or
|
|
|
|
.Ic -printx
|
|
|
|
primaries can be used to format the output in a way that
|
2012-06-28 02:31:26 +04:00
|
|
|
.Xr xargs 1
|
2004-03-31 05:46:22 +04:00
|
|
|
can accept.
|
1993-03-21 12:45:37 +03:00
|
|
|
.It Fl x
|
2012-08-16 17:34:10 +04:00
|
|
|
Restricts the search to the file system containing the
|
2002-09-27 20:56:53 +04:00
|
|
|
directory specified.
|
|
|
|
Does not list mount points to other file systems.
|
1993-03-21 12:45:37 +03:00
|
|
|
.El
|
|
|
|
.Sh PRIMARIES
|
2011-09-24 17:45:43 +04:00
|
|
|
All primaries which take a numeric argument of
|
|
|
|
.Ar n
|
|
|
|
allow the number to be preceded by a plus sign
|
|
|
|
.Pq Dq \&+
|
|
|
|
or a minus sign
|
|
|
|
.Pq Dq \- .
|
|
|
|
A preceding plus sign means
|
|
|
|
.Dq more than Ar n ,
|
|
|
|
a preceding minus sign means
|
|
|
|
.Dq less than Ar n ,
|
|
|
|
and neither means
|
|
|
|
.Dq exactly Ar n .
|
2016-06-13 01:17:18 +03:00
|
|
|
(The argument specified for the
|
2016-06-13 01:25:13 +03:00
|
|
|
.Ic -user
|
2016-06-13 09:17:19 +03:00
|
|
|
and
|
2016-06-13 01:25:13 +03:00
|
|
|
.Ic -group
|
2016-06-13 01:17:18 +03:00
|
|
|
primaries
|
|
|
|
are similarly treated if the value is numeric and does not correspond to a
|
|
|
|
valid user or group name.)
|
2012-08-16 17:34:10 +04:00
|
|
|
.Pp
|
2016-06-13 03:04:40 +03:00
|
|
|
For primaries which take a
|
|
|
|
.Ar timestamp
|
|
|
|
argument, the argument must be valid input to
|
|
|
|
.Xr parsedate 3 .
|
|
|
|
If the argument contains multiple words, enclose the argument in quotes.
|
|
|
|
.Pp
|
2009-10-15 06:26:38 +04:00
|
|
|
.Bl -tag -width Ds -compact
|
2001-12-01 19:43:07 +03:00
|
|
|
.It Ic -amin Ar n
|
1999-01-16 16:27:30 +03:00
|
|
|
True if the difference between the file last access time and the time
|
|
|
|
.Nm
|
|
|
|
was started, rounded up to the next full minute, is
|
|
|
|
.Ar n
|
|
|
|
minutes.
|
2009-10-15 06:26:38 +04:00
|
|
|
.Pp
|
2001-12-02 15:46:39 +03:00
|
|
|
.It Ic -anewer Ar file
|
|
|
|
True if the current file has a more recent last access time than
|
2012-08-16 17:34:10 +04:00
|
|
|
.Ar file .
|
2009-10-15 06:26:38 +04:00
|
|
|
.Pp
|
2016-06-13 09:17:19 +03:00
|
|
|
.It Ic -asince Ar timestamp
|
2016-06-13 03:04:40 +03:00
|
|
|
True if the file last access time is greater than the specified
|
|
|
|
.Ar timestamp .
|
|
|
|
.Pp
|
2001-12-01 19:43:07 +03:00
|
|
|
.It Ic -atime Ar n
|
1993-03-21 12:45:37 +03:00
|
|
|
True if the difference between the file last access time and the time
|
1997-10-19 15:52:12 +04:00
|
|
|
.Nm
|
2002-09-28 16:59:49 +04:00
|
|
|
was started, rounded up to the next full 24-hour period, is
|
1993-03-21 12:45:37 +03:00
|
|
|
.Ar n
|
2002-09-28 16:59:49 +04:00
|
|
|
24-hour periods.
|
2009-10-15 06:26:38 +04:00
|
|
|
.Pp
|
2001-12-01 19:43:07 +03:00
|
|
|
.It Ic -cmin Ar n
|
1999-01-16 16:27:30 +03:00
|
|
|
True if the difference between the time of last change of file status
|
|
|
|
information and the time
|
|
|
|
.Nm
|
|
|
|
was started, rounded up to the next full minute, is
|
|
|
|
.Ar n
|
|
|
|
minutes.
|
2009-10-15 06:26:38 +04:00
|
|
|
.Pp
|
2001-12-01 19:43:07 +03:00
|
|
|
.It Ic -cnewer Ar file
|
2001-12-01 17:10:04 +03:00
|
|
|
True if the current file has a more recent last change time than
|
2012-08-16 17:34:10 +04:00
|
|
|
.Ar file .
|
2009-10-15 06:26:38 +04:00
|
|
|
.Pp
|
2016-06-13 09:17:19 +03:00
|
|
|
.It Ic -csince Ar timestamp
|
2016-06-13 03:04:40 +03:00
|
|
|
True if the file last status change time is greater than the specified
|
|
|
|
.Ar timestamp .
|
|
|
|
.Pp
|
2001-12-01 19:43:07 +03:00
|
|
|
.It Ic -ctime Ar n
|
1993-03-21 12:45:37 +03:00
|
|
|
True if the difference between the time of last change of file status
|
|
|
|
information and the time
|
1997-10-19 15:52:12 +04:00
|
|
|
.Nm
|
2002-09-28 16:59:49 +04:00
|
|
|
was started, rounded up to the next full 24-hour period, is
|
1993-03-21 12:45:37 +03:00
|
|
|
.Ar n
|
2002-09-28 16:59:49 +04:00
|
|
|
24-hour periods.
|
2009-10-15 06:26:38 +04:00
|
|
|
.Pp
|
2007-02-06 16:25:01 +03:00
|
|
|
.It Ic -delete
|
2013-02-08 16:50:51 +04:00
|
|
|
Delete found files, symbolic links, and directories.
|
2012-08-26 18:26:07 +04:00
|
|
|
Always returns true.
|
2007-02-06 16:25:01 +03:00
|
|
|
This executes from the current working directory as
|
|
|
|
.Nm
|
|
|
|
recurses down the tree.
|
2009-11-07 00:03:12 +03:00
|
|
|
To avoid deleting unexpected files, it will ignore any filenames that
|
|
|
|
.Xr fts 3
|
|
|
|
returns that contain a
|
2009-01-04 15:13:56 +03:00
|
|
|
.Dq /
|
2009-11-07 00:03:12 +03:00
|
|
|
.Xr ( fts 3
|
|
|
|
should not return such pathnames).
|
2007-02-06 16:25:01 +03:00
|
|
|
Depth-first traversal processing is implied by this option.
|
2012-08-26 18:26:07 +04:00
|
|
|
This primary can also be invoked as
|
2007-02-06 18:33:21 +03:00
|
|
|
.Ic -rm .
|
2009-10-15 06:26:38 +04:00
|
|
|
.Pp
|
2002-09-27 19:56:25 +04:00
|
|
|
.It Ic -empty
|
|
|
|
True if the current file or directory is empty.
|
2009-10-15 06:26:38 +04:00
|
|
|
.Pp
|
2011-09-24 17:45:43 +04:00
|
|
|
.It Ic -exec Ar utility Oo argument ... Oc Ic \&;
|
|
|
|
.It Ic -exec Ar utility Oo argument ... Oc Ic {} Ic \&+
|
2006-10-07 21:06:28 +04:00
|
|
|
Execute the specified
|
|
|
|
.Ar utility
|
|
|
|
with the specified arguments.
|
2011-09-24 17:45:43 +04:00
|
|
|
.Pp
|
|
|
|
The list of arguments for
|
|
|
|
.Ar utility
|
|
|
|
is terminated by a lone semicolon
|
|
|
|
.Dq Ic \&;
|
|
|
|
or plus
|
|
|
|
.Dq Ic \&+
|
|
|
|
character as a separate parameter.
|
|
|
|
The command specified by
|
1993-03-21 12:45:37 +03:00
|
|
|
.Ar utility
|
2011-09-24 17:45:43 +04:00
|
|
|
will be executed with its current working directory being the directory
|
|
|
|
from which
|
1997-10-19 15:52:12 +04:00
|
|
|
.Nm
|
1993-03-21 12:45:37 +03:00
|
|
|
was executed.
|
2006-10-07 21:06:28 +04:00
|
|
|
.Pp
|
2011-09-24 17:45:43 +04:00
|
|
|
If the list of arguments is terminated by a semicolon
|
|
|
|
.Pq Dq Ic \&; ,
|
2012-06-20 21:55:06 +04:00
|
|
|
then
|
2006-10-07 21:06:28 +04:00
|
|
|
.Ar utility
|
2011-09-24 17:45:43 +04:00
|
|
|
is invoked once per pathname.
|
|
|
|
If
|
|
|
|
the string
|
|
|
|
.Dq Ic {}
|
2012-06-20 21:55:06 +04:00
|
|
|
appears one or more times in the utility name or arguments,
|
2011-09-24 17:45:43 +04:00
|
|
|
then it is replaced by the pathname of the current file
|
|
|
|
(but it need not appear, in which case the pathname
|
2012-06-20 21:55:06 +04:00
|
|
|
will not be passed to
|
2011-09-24 17:45:43 +04:00
|
|
|
.Ar utility ) .
|
|
|
|
The semicolon-terminated form of the
|
|
|
|
.Ic -exec
|
2012-06-20 21:55:06 +04:00
|
|
|
primary returns true if and only if
|
2011-09-24 17:45:43 +04:00
|
|
|
.Ar utility
|
|
|
|
exits with a zero exit status.
|
|
|
|
Note that the semicolon will have to be escaped on the shell command line
|
|
|
|
in order to be passed as a parameter.
|
|
|
|
.Pp
|
|
|
|
If the list of arguments is terminated by a plus sign
|
|
|
|
.Pq Dq Ic \&+ ,
|
|
|
|
then the pathnames for which the primary is evaluated are aggregated
|
|
|
|
into sets, and
|
2006-10-07 21:06:28 +04:00
|
|
|
.Ar utility
|
|
|
|
will be invoked once per set, similar to
|
|
|
|
.Xr xargs 1 .
|
2012-07-08 00:45:09 +04:00
|
|
|
In this case the string
|
2011-09-24 17:45:43 +04:00
|
|
|
.Dq Ic {}
|
2012-06-20 21:55:06 +04:00
|
|
|
must appear, and must appear as the last item in the argument list,
|
|
|
|
just before the
|
2011-09-24 17:45:43 +04:00
|
|
|
.Dq Ic \&+
|
2012-07-08 00:45:09 +04:00
|
|
|
parameter, and is replaced by the pathnames of the current set of files.
|
2011-09-24 17:45:43 +04:00
|
|
|
Each set is limited to no more than 5,000 pathnames,
|
|
|
|
and is also limited such that the total number of bytes in the argument
|
|
|
|
list does not exceed
|
|
|
|
.Dv ARG_MAX .
|
|
|
|
The plus-terminated form of the
|
|
|
|
.Ic -exec
|
|
|
|
primary always returns true.
|
|
|
|
If the plus-terminated form of the
|
|
|
|
.Ic -exec
|
2012-06-20 21:55:06 +04:00
|
|
|
primary results in any invocation of
|
2011-09-24 17:45:43 +04:00
|
|
|
.Ar utility
|
|
|
|
exiting with non-zero exit status, then
|
2006-10-07 21:06:28 +04:00
|
|
|
.Nm
|
2011-09-24 17:45:43 +04:00
|
|
|
will eventually exit with non-zero status as well,
|
|
|
|
but this does not cause
|
2006-10-07 21:06:28 +04:00
|
|
|
.Nm
|
|
|
|
to exit early.
|
2009-10-15 06:26:38 +04:00
|
|
|
.Pp
|
2011-09-24 17:45:43 +04:00
|
|
|
.It Ic -execdir Ar utility Oo argument ... Oc Ic \&;
|
2002-09-27 19:56:25 +04:00
|
|
|
The
|
2002-09-28 16:59:49 +04:00
|
|
|
.Ic -execdir
|
2006-10-07 21:06:28 +04:00
|
|
|
primary is similar to the semicolon-terminated
|
2011-09-24 17:45:43 +04:00
|
|
|
.Pq Dq Ic \&;
|
2006-10-07 21:06:28 +04:00
|
|
|
variant of the
|
2002-09-27 19:56:25 +04:00
|
|
|
.Ic -exec
|
2006-10-07 21:06:28 +04:00
|
|
|
primary, with the exception that
|
|
|
|
.Ar utility
|
2002-09-27 19:56:25 +04:00
|
|
|
will be executed from the directory that holds
|
2002-09-27 20:56:53 +04:00
|
|
|
the current file.
|
2011-09-24 17:45:43 +04:00
|
|
|
Only the base filename is substituted for the string
|
|
|
|
.Dq Ic {} .
|
2006-10-07 21:06:28 +04:00
|
|
|
Set aggregation
|
2011-09-24 17:45:43 +04:00
|
|
|
.Pq Do Ic \&+ Dc termination
|
2006-10-07 21:06:28 +04:00
|
|
|
is not supported.
|
2009-10-15 06:26:38 +04:00
|
|
|
.Pp
|
2011-09-24 17:45:43 +04:00
|
|
|
.It Ic -exit Op Ar status
|
2006-02-20 19:31:02 +03:00
|
|
|
This primary causes
|
|
|
|
.Nm
|
2011-09-24 17:45:43 +04:00
|
|
|
to stop traversing the file system and exit immediately,
|
|
|
|
with the specified numeric exit status.
|
|
|
|
If the
|
|
|
|
.Ar status
|
|
|
|
value is not specified, then
|
|
|
|
.Nm
|
|
|
|
will exit with status zero.
|
|
|
|
Note that any preceding primaries will be evaluated and acted upon
|
|
|
|
before exiting.
|
2009-10-15 06:26:38 +04:00
|
|
|
.Pp
|
2005-11-09 03:47:16 +03:00
|
|
|
.It Ic -false
|
|
|
|
This primary always evaluates to false.
|
|
|
|
This can be used following a primary that caused the
|
|
|
|
expression to be true to make the expression to be false.
|
|
|
|
This can be useful after using a
|
|
|
|
.Ic -fprint
|
|
|
|
primary so it can continue to the next expression (using an
|
|
|
|
.Cm -or
|
|
|
|
operator, for example).
|
2009-10-15 06:26:38 +04:00
|
|
|
.Pp
|
2006-10-07 21:06:28 +04:00
|
|
|
.It Ic -flags Oo Fl Oc Ns Ar flags
|
1999-01-03 17:54:27 +03:00
|
|
|
If
|
|
|
|
.Ar flags
|
2002-09-28 16:59:49 +04:00
|
|
|
are preceded by a dash
|
2011-09-24 17:45:43 +04:00
|
|
|
.Pq Dq Ic \- ,
|
2002-09-28 16:59:49 +04:00
|
|
|
this primary evaluates to true
|
1999-01-03 17:54:27 +03:00
|
|
|
if at least all of the bits in
|
|
|
|
.Ar flags
|
|
|
|
are set in the file's flags bits.
|
|
|
|
If
|
|
|
|
.Ar flags
|
|
|
|
are not preceded by a dash, this primary evaluates to true if
|
|
|
|
the bits in
|
|
|
|
.Ar flags
|
|
|
|
exactly match the file's flags bits.
|
|
|
|
If
|
|
|
|
.Ar flags
|
|
|
|
is
|
|
|
|
.Dq none ,
|
|
|
|
files with no flags bits set are matched.
|
|
|
|
(See
|
|
|
|
.Xr chflags 1
|
|
|
|
for more information about file flags.)
|
2009-10-15 06:26:38 +04:00
|
|
|
.Pp
|
1996-01-14 06:52:44 +03:00
|
|
|
.It Ic -follow
|
|
|
|
Follow symbolic links.
|
2009-10-15 06:26:38 +04:00
|
|
|
.Pp
|
2005-10-13 00:03:59 +04:00
|
|
|
.It Ic -fprint Ar filename
|
|
|
|
This primary always evaluates to true.
|
|
|
|
This creates
|
|
|
|
.Ar filename
|
|
|
|
or overwrites the file if it already exists.
|
|
|
|
The file is created at startup.
|
|
|
|
It writes the pathname of the current file to this file, followed
|
|
|
|
by a newline character.
|
|
|
|
The file will be empty if no files are matched.
|
2009-10-15 06:26:38 +04:00
|
|
|
.Pp
|
2001-12-01 19:43:07 +03:00
|
|
|
.It Ic -fstype Ar type
|
1993-03-21 12:45:37 +03:00
|
|
|
True if the file is contained in a file system of type
|
|
|
|
.Ar type .
|
1998-02-02 17:02:06 +03:00
|
|
|
The
|
|
|
|
.Xr sysctl 8
|
2010-09-09 15:42:13 +04:00
|
|
|
command can be used to find out the types of file systems
|
1998-02-02 17:02:06 +03:00
|
|
|
that are available on the system:
|
|
|
|
.Bd -literal -offset indent
|
2004-04-19 04:18:46 +04:00
|
|
|
sysctl vfs.generic.fstypes
|
1998-02-02 17:02:06 +03:00
|
|
|
.Ed
|
2004-04-19 04:28:11 +04:00
|
|
|
.Pp
|
2002-09-27 20:56:53 +04:00
|
|
|
In addition, there are two pseudo-types,
|
|
|
|
.Dq local
|
|
|
|
and
|
|
|
|
.Dq rdonly .
|
1998-02-02 17:02:06 +03:00
|
|
|
The former matches any file system physically mounted on the system where
|
1993-03-21 12:45:37 +03:00
|
|
|
the
|
1997-10-19 15:52:12 +04:00
|
|
|
.Nm
|
1994-04-14 07:34:13 +04:00
|
|
|
is being executed, and the latter matches any file system which is
|
1993-03-21 12:45:37 +03:00
|
|
|
mounted read-only.
|
2009-10-15 06:26:38 +04:00
|
|
|
.Pp
|
2001-12-01 19:43:07 +03:00
|
|
|
.It Ic -group Ar gname
|
1993-03-21 12:45:37 +03:00
|
|
|
True if the file belongs to the group
|
2012-08-16 17:34:10 +04:00
|
|
|
.Ar gname .
|
1993-03-21 12:45:37 +03:00
|
|
|
If
|
|
|
|
.Ar gname
|
|
|
|
is numeric and there is no such group name, then
|
|
|
|
.Ar gname
|
2016-06-12 23:50:10 +03:00
|
|
|
is treated as a group id (and considered a numeric argument).
|
2009-10-15 06:26:38 +04:00
|
|
|
.Pp
|
2003-08-03 23:46:03 +04:00
|
|
|
.It Ic -iname Ar pattern
|
2012-08-16 17:34:10 +04:00
|
|
|
True if the last component of the pathname being examined matches
|
|
|
|
.Ar pattern
|
|
|
|
in a case-insensitive manner.
|
|
|
|
Special shell pattern matching characters
|
|
|
|
.Po
|
|
|
|
.Dq \&[ ,
|
|
|
|
.Dq \&] ,
|
|
|
|
.Dq \&* ,
|
|
|
|
and
|
|
|
|
.Dq \&?
|
|
|
|
.Pc
|
|
|
|
may be used as part of
|
2003-08-03 23:46:03 +04:00
|
|
|
.Ar pattern .
|
2012-08-16 17:34:10 +04:00
|
|
|
These characters may be matched explicitly by escaping them with a
|
|
|
|
backslash
|
|
|
|
.Pq Dq \e .
|
2009-10-15 06:26:38 +04:00
|
|
|
.Pp
|
2001-12-01 19:43:07 +03:00
|
|
|
.It Ic -inum Ar n
|
1993-03-21 12:45:37 +03:00
|
|
|
True if the file has inode number
|
2012-08-16 17:34:10 +04:00
|
|
|
.Ar n .
|
2009-10-15 06:26:38 +04:00
|
|
|
.Pp
|
1999-07-20 05:28:41 +04:00
|
|
|
.It Ic -iregex Ar regexp
|
|
|
|
True if the path name of the current file matches the case-insensitive
|
|
|
|
basic regular expression
|
|
|
|
.Pq see Xr re_format 7
|
|
|
|
.Ar regexp .
|
|
|
|
This is a match on the whole path, not a search for the regular expression
|
|
|
|
within the path.
|
2009-10-15 06:26:38 +04:00
|
|
|
.Pp
|
2001-12-01 19:43:07 +03:00
|
|
|
.It Ic -links Ar n
|
1993-03-21 12:45:37 +03:00
|
|
|
True if the file has
|
|
|
|
.Ar n
|
|
|
|
links.
|
2009-10-15 06:26:38 +04:00
|
|
|
.Pp
|
2007-02-06 18:33:21 +03:00
|
|
|
.It Ic -rm
|
2012-08-26 18:26:07 +04:00
|
|
|
This primary is an alias for
|
2007-02-06 18:33:21 +03:00
|
|
|
.Ic -delete .
|
2009-10-15 06:26:38 +04:00
|
|
|
.Pp
|
1993-03-21 12:45:37 +03:00
|
|
|
.It Ic -ls
|
|
|
|
This primary always evaluates to true.
|
|
|
|
The following information for the current file is written to standard output:
|
2002-09-28 16:59:49 +04:00
|
|
|
its inode number, size in 512-byte blocks, file permissions, number of hard
|
1993-03-21 12:45:37 +03:00
|
|
|
links, owner, group, size in bytes, last modification time, and pathname.
|
|
|
|
If the file is a block or character special file, the major and minor numbers
|
|
|
|
will be displayed instead of the size in bytes.
|
2002-09-28 16:59:49 +04:00
|
|
|
If the file is a symbolic link, the pathname of the linked-to file will be
|
2002-09-27 20:56:53 +04:00
|
|
|
displayed preceded by
|
2017-07-04 00:28:48 +03:00
|
|
|
.Dq -> .
|
2002-09-27 20:56:53 +04:00
|
|
|
The format is identical to that produced by
|
2002-09-28 16:59:49 +04:00
|
|
|
.Dq ls -dgils .
|
2009-10-15 06:26:38 +04:00
|
|
|
.Pp
|
2016-06-12 06:21:35 +03:00
|
|
|
.It Ic -maxdepth Ar depth
|
2002-09-27 19:56:25 +04:00
|
|
|
True if the current search depth is less than or equal to what is specified in
|
2016-06-12 06:21:35 +03:00
|
|
|
.Ar depth .
|
2009-10-15 06:26:38 +04:00
|
|
|
.Pp
|
2016-06-12 06:21:35 +03:00
|
|
|
.It Ic -mindepth Ar depth
|
2002-09-27 19:56:25 +04:00
|
|
|
True if the current search depth is at least what is specified in
|
2016-06-12 06:21:35 +03:00
|
|
|
.Ar depth .
|
2009-10-15 06:26:38 +04:00
|
|
|
.Pp
|
2001-12-01 19:43:07 +03:00
|
|
|
.It Ic -mmin Ar n
|
1999-01-16 16:27:30 +03:00
|
|
|
True if the difference between the file last modification time and the time
|
|
|
|
.Nm
|
|
|
|
was started, rounded up to the next full minute, is
|
|
|
|
.Ar n
|
|
|
|
minutes.
|
2009-10-15 06:26:38 +04:00
|
|
|
.Pp
|
2001-12-01 19:43:07 +03:00
|
|
|
.It Ic -mtime Ar n
|
1993-03-21 12:45:37 +03:00
|
|
|
True if the difference between the file last modification time and the time
|
1997-10-19 15:52:12 +04:00
|
|
|
.Nm
|
2002-09-28 16:59:49 +04:00
|
|
|
was started, rounded up to the next full 24-hour period, is
|
1993-03-21 12:45:37 +03:00
|
|
|
.Ar n
|
2002-09-28 16:59:49 +04:00
|
|
|
24-hour periods.
|
2009-10-15 06:26:38 +04:00
|
|
|
.Pp
|
2012-06-28 02:31:26 +04:00
|
|
|
.It Ic -ok Ar utility Oo argument ... Oc Ic \&;
|
1993-03-21 12:45:37 +03:00
|
|
|
The
|
2002-09-28 16:59:49 +04:00
|
|
|
.Ic -ok
|
2006-10-07 21:06:28 +04:00
|
|
|
primary is similar to the semicolon-terminated
|
|
|
|
.Pq Dq \&;
|
|
|
|
variant of the
|
1993-03-21 12:45:37 +03:00
|
|
|
.Ic -exec
|
2006-10-07 21:06:28 +04:00
|
|
|
primary, with the exception that
|
1997-10-19 15:52:12 +04:00
|
|
|
.Nm
|
2012-06-20 21:55:06 +04:00
|
|
|
requests user affirmation for the execution of
|
|
|
|
.Ar utility
|
|
|
|
by printing
|
1993-03-21 12:45:37 +03:00
|
|
|
a message to the terminal and reading a response.
|
2002-09-27 20:56:53 +04:00
|
|
|
If the response is other than
|
2006-10-07 21:06:28 +04:00
|
|
|
.Dq y ,
|
2002-09-27 20:56:53 +04:00
|
|
|
the command is not executed and the
|
2011-09-24 17:45:43 +04:00
|
|
|
.Ic -ok
|
2006-10-07 21:06:28 +04:00
|
|
|
primary evaluates to false.
|
|
|
|
Set aggregation
|
|
|
|
.Pq Do \&+ Dc termination
|
|
|
|
is not supported.
|
2009-10-15 06:26:38 +04:00
|
|
|
.Pp
|
2001-12-01 19:43:07 +03:00
|
|
|
.It Ic -name Ar pattern
|
1993-03-21 12:45:37 +03:00
|
|
|
True if the last component of the pathname being examined matches
|
2012-08-16 17:34:10 +04:00
|
|
|
.Ar pattern .
|
1999-03-07 03:12:13 +03:00
|
|
|
Special shell pattern matching characters
|
|
|
|
.Po
|
|
|
|
.Dq \&[ ,
|
|
|
|
.Dq \&] ,
|
|
|
|
.Dq \&* ,
|
2012-08-16 17:34:10 +04:00
|
|
|
and
|
1999-03-07 03:12:13 +03:00
|
|
|
.Dq \&?
|
|
|
|
.Pc
|
1993-03-21 12:45:37 +03:00
|
|
|
may be used as part of
|
2012-08-16 17:34:10 +04:00
|
|
|
.Ar pattern .
|
1993-03-21 12:45:37 +03:00
|
|
|
These characters may be matched explicitly by escaping them with a
|
2002-09-28 16:59:49 +04:00
|
|
|
backslash
|
|
|
|
.Pq Dq \e .
|
2009-10-15 06:26:38 +04:00
|
|
|
.Pp
|
2001-12-01 19:43:07 +03:00
|
|
|
.It Ic -newer Ar file
|
1993-03-21 12:45:37 +03:00
|
|
|
True if the current file has a more recent last modification time than
|
2012-08-16 17:34:10 +04:00
|
|
|
.Ar file .
|
2009-10-15 06:26:38 +04:00
|
|
|
.Pp
|
2016-06-13 03:04:40 +03:00
|
|
|
.It Ic -newerXY Ar reference
|
2017-06-04 11:48:05 +03:00
|
|
|
For compatibility with Gnu findutils.
|
2016-06-13 03:04:40 +03:00
|
|
|
.Bl -column -offset indent ".Sy findutils" ".Sy equivalent"
|
|
|
|
.It Sy findutils Ta Sy find
|
|
|
|
.It Sy option Ta Sy equivalent
|
|
|
|
.It -neweraa Ta -anewer
|
|
|
|
.It -newerat Ta -asince
|
|
|
|
.It -newercc Ta -cnewer
|
|
|
|
.It -newerct Ta -csince
|
|
|
|
.It -newermm Ta -newer
|
|
|
|
.It -newermt Ta -since
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
Other option variants from findutils are not implemented.
|
|
|
|
.Pp
|
1993-03-21 12:45:37 +03:00
|
|
|
.It Ic -nouser
|
|
|
|
True if the file belongs to an unknown user.
|
2009-10-15 06:26:38 +04:00
|
|
|
.Pp
|
1993-03-21 12:45:37 +03:00
|
|
|
.It Ic -nogroup
|
|
|
|
True if the file belongs to an unknown group.
|
2009-10-15 06:26:38 +04:00
|
|
|
.Pp
|
2001-12-01 19:43:07 +03:00
|
|
|
.It Ic -path Ar pattern
|
1993-03-21 12:45:37 +03:00
|
|
|
True if the pathname being examined matches
|
2012-08-16 17:34:10 +04:00
|
|
|
.Ar pattern .
|
2002-09-28 16:59:49 +04:00
|
|
|
Special shell pattern matching characters
|
|
|
|
.Po
|
2002-09-27 20:56:53 +04:00
|
|
|
.Dq \&[ ,
|
|
|
|
.Dq \&] ,
|
|
|
|
.Dq \&* ,
|
|
|
|
and
|
|
|
|
.Dq \&?
|
2002-09-28 16:59:49 +04:00
|
|
|
.Pc
|
1993-03-21 12:45:37 +03:00
|
|
|
may be used as part of
|
2012-08-16 17:34:10 +04:00
|
|
|
.Ar pattern .
|
1993-03-21 12:45:37 +03:00
|
|
|
These characters may be matched explicitly by escaping them with a
|
2002-09-28 16:59:49 +04:00
|
|
|
backslash
|
|
|
|
.Pq Dq \e .
|
|
|
|
Slashes
|
|
|
|
.Pq Dq /
|
|
|
|
are treated as normal characters and do not have to be
|
1993-03-21 12:45:37 +03:00
|
|
|
matched explicitly.
|
2009-10-15 06:26:38 +04:00
|
|
|
.Pp
|
2006-10-07 21:06:28 +04:00
|
|
|
.It Ic -perm Oo Fl Oc Ns Ar mode
|
1993-03-21 12:45:37 +03:00
|
|
|
The
|
|
|
|
.Ar mode
|
|
|
|
may be either symbolic (see
|
2012-03-22 11:58:16 +04:00
|
|
|
.Xr chmod 1 )
|
1993-03-21 12:45:37 +03:00
|
|
|
or an octal number.
|
|
|
|
If the mode is symbolic, a starting value of zero is assumed and the
|
|
|
|
mode sets or clears permissions without regard to the process' file mode
|
|
|
|
creation mask.
|
|
|
|
If the mode is octal, only bits 07777
|
|
|
|
.Pf ( Dv S_ISUID
|
|
|
|
|
|
|
|
|
.Dv S_ISGID
|
|
|
|
|
|
|
|
|
.Dv S_ISTXT
|
|
|
|
|
|
|
|
|
.Dv S_IRWXU
|
|
|
|
|
|
|
|
|
.Dv S_IRWXG
|
|
|
|
|
|
|
|
|
.Dv S_IRWXO )
|
|
|
|
of the file's mode bits participate
|
|
|
|
in the comparison.
|
2002-09-28 16:59:49 +04:00
|
|
|
If the mode is preceded by a dash
|
2011-09-24 17:45:43 +04:00
|
|
|
.Pq Dq Ic \- ,
|
2002-09-28 16:59:49 +04:00
|
|
|
this primary evaluates to true
|
1993-03-21 12:45:37 +03:00
|
|
|
if at least all of the bits in the mode are set in the file's mode bits.
|
|
|
|
If the mode is not preceded by a dash, this primary evaluates to true if
|
|
|
|
the bits in the mode exactly match the file's mode bits.
|
2002-09-28 16:59:49 +04:00
|
|
|
Note, the first character of a symbolic mode may not be a dash
|
2011-09-24 17:45:43 +04:00
|
|
|
.Pq Dq Ic \- .
|
2009-10-15 06:26:38 +04:00
|
|
|
.Pp
|
1993-03-21 12:45:37 +03:00
|
|
|
.It Ic -print
|
|
|
|
This primary always evaluates to true.
|
1993-10-27 20:52:30 +03:00
|
|
|
It prints the pathname of the current file to standard output, followed
|
|
|
|
by a newline character.
|
1998-02-02 17:02:06 +03:00
|
|
|
If none of
|
2012-08-26 18:26:07 +04:00
|
|
|
.Ic -delete ,
|
1993-03-21 12:45:37 +03:00
|
|
|
.Ic -exec ,
|
2012-08-26 18:26:07 +04:00
|
|
|
.Ic -execdir ,
|
2006-02-20 19:31:02 +03:00
|
|
|
.Ic -exit ,
|
2005-10-13 00:03:59 +04:00
|
|
|
.Ic -fprint ,
|
1994-07-18 13:55:31 +04:00
|
|
|
.Ic -ls ,
|
|
|
|
.Ic -ok ,
|
1999-01-12 03:18:50 +03:00
|
|
|
.Ic -print0 ,
|
2012-08-26 18:26:07 +04:00
|
|
|
.Ic -printx ,
|
1993-10-27 20:52:30 +03:00
|
|
|
nor
|
2012-08-26 18:26:07 +04:00
|
|
|
.Ic -rm
|
1994-07-18 13:55:31 +04:00
|
|
|
is specified, the given expression shall be effectively replaced by
|
2001-12-01 19:43:07 +03:00
|
|
|
.Cm \&( Ns Ar given\& expression Ns Cm \&)
|
1994-07-18 13:55:31 +04:00
|
|
|
.Ic -print .
|
2009-10-15 06:26:38 +04:00
|
|
|
.Pp
|
1993-10-27 20:52:30 +03:00
|
|
|
.It Ic -print0
|
|
|
|
This primary always evaluates to true.
|
|
|
|
It prints the pathname of the current file to standard output, followed
|
2011-09-24 17:45:43 +04:00
|
|
|
by a NUL character.
|
2009-10-15 06:26:38 +04:00
|
|
|
.Pp
|
1999-01-12 03:18:50 +03:00
|
|
|
.It Ic -printx
|
|
|
|
This primary always evaluates to true.
|
|
|
|
It prints the pathname of the current file to standard output,
|
2003-01-26 10:07:31 +03:00
|
|
|
with each space, tab, newline, backslash, dollar sign, and single,
|
|
|
|
double, or back quotation mark prefixed by a backslash, so the output of
|
2012-06-28 02:31:26 +04:00
|
|
|
.Nm
|
1999-01-12 03:18:50 +03:00
|
|
|
can safely be used as input to
|
2012-06-28 02:31:26 +04:00
|
|
|
.Xr xargs 1 .
|
2009-10-15 06:26:38 +04:00
|
|
|
.Pp
|
1993-03-21 12:45:37 +03:00
|
|
|
.It Ic -prune
|
|
|
|
This primary always evaluates to true.
|
|
|
|
It causes
|
1997-10-19 15:52:12 +04:00
|
|
|
.Nm
|
1993-03-21 12:45:37 +03:00
|
|
|
to not descend into the current file.
|
|
|
|
Note, the
|
|
|
|
.Ic -prune
|
|
|
|
primary has no effect if the
|
|
|
|
.Fl d
|
|
|
|
option was specified.
|
2009-10-15 06:26:38 +04:00
|
|
|
.Pp
|
1999-07-20 05:28:41 +04:00
|
|
|
.It Ic -regex Ar regexp
|
|
|
|
True if the path name of the current file matches the case-sensitive
|
|
|
|
basic regular expression
|
|
|
|
.Pq see Xr re_format 7
|
|
|
|
.Ar regexp .
|
|
|
|
This is a match on the whole path, not a search for the regular expression
|
|
|
|
within the path.
|
2009-10-15 06:26:38 +04:00
|
|
|
.Pp
|
2016-06-13 09:17:19 +03:00
|
|
|
.It Ic -since Ar timestamp
|
2016-06-13 03:04:40 +03:00
|
|
|
True if the file last modification time is more recent than
|
|
|
|
.Ar timestamp .
|
|
|
|
.Pp
|
2001-12-01 19:43:07 +03:00
|
|
|
.It Ic -size Ar n Ns Op Cm c
|
2002-09-28 16:59:49 +04:00
|
|
|
True if the file's size, rounded up, in 512-byte blocks is
|
2012-08-16 17:34:10 +04:00
|
|
|
.Ar n .
|
1993-03-21 12:45:37 +03:00
|
|
|
If
|
|
|
|
.Ar n
|
2002-09-27 20:56:53 +04:00
|
|
|
is followed by a
|
2011-09-24 17:45:43 +04:00
|
|
|
.Dq Ic c ,
|
2002-09-28 16:59:49 +04:00
|
|
|
then the primary is true if the file's size is
|
1993-03-21 12:45:37 +03:00
|
|
|
.Ar n
|
|
|
|
bytes.
|
2009-10-15 06:26:38 +04:00
|
|
|
.Pp
|
2001-12-01 19:43:07 +03:00
|
|
|
.It Ic -type Ar t
|
1993-03-21 12:45:37 +03:00
|
|
|
True if the file is of the specified type.
|
|
|
|
Possible file types are as follows:
|
|
|
|
.Pp
|
|
|
|
.Bl -tag -width flag -offset indent -compact
|
|
|
|
.It Cm b
|
|
|
|
block special
|
|
|
|
.It Cm c
|
|
|
|
character special
|
|
|
|
.It Cm d
|
|
|
|
directory
|
|
|
|
.It Cm f
|
|
|
|
regular file
|
|
|
|
.It Cm l
|
|
|
|
symbolic link
|
|
|
|
.It Cm p
|
|
|
|
FIFO
|
|
|
|
.It Cm s
|
|
|
|
socket
|
2004-03-31 05:46:22 +04:00
|
|
|
.It Cm W
|
|
|
|
whiteout
|
2004-03-31 02:54:04 +04:00
|
|
|
.It Cm w
|
|
|
|
whiteout
|
1993-03-21 12:45:37 +03:00
|
|
|
.El
|
|
|
|
.Pp
|
2016-06-12 23:50:10 +03:00
|
|
|
.It Ic -user Ar username
|
1993-03-21 12:45:37 +03:00
|
|
|
True if the file belongs to the user
|
2016-06-12 23:50:10 +03:00
|
|
|
.Ar username .
|
1993-03-21 12:45:37 +03:00
|
|
|
If
|
2016-06-12 23:50:10 +03:00
|
|
|
.Ar username
|
|
|
|
is numeric and there is no such user on the system, then
|
|
|
|
.Ar username
|
2003-01-30 13:49:18 +03:00
|
|
|
is treated as a user id (and considered a numeric argument).
|
2009-10-15 06:26:38 +04:00
|
|
|
.Pp
|
2007-02-01 22:00:16 +03:00
|
|
|
.It Ic -xdev
|
|
|
|
This primary always evaluates to true.
|
2007-02-02 10:27:15 +03:00
|
|
|
It causes find not to descend past directories that have a different
|
2012-08-16 17:34:10 +04:00
|
|
|
device ID
|
|
|
|
.Va ( st_dev ,
|
|
|
|
see
|
2007-02-01 22:00:16 +03:00
|
|
|
.Xr stat 2
|
|
|
|
S5.6.2 [POSIX.1]).
|
1993-03-21 12:45:37 +03:00
|
|
|
.El
|
|
|
|
.Sh OPERATORS
|
|
|
|
The primaries may be combined using the following operators.
|
|
|
|
The operators are listed in order of decreasing precedence.
|
2001-12-01 19:43:07 +03:00
|
|
|
.Bl -tag -width (expression)
|
2006-09-23 09:03:33 +04:00
|
|
|
.It Cm \&( Ar expression Cm \&)
|
1993-03-21 12:45:37 +03:00
|
|
|
This evaluates to true if the parenthesized expression evaluates to
|
|
|
|
true.
|
2006-09-23 09:03:33 +04:00
|
|
|
.It Cm \&! Ar expression
|
1993-03-21 12:45:37 +03:00
|
|
|
This is the unary
|
|
|
|
.Tn NOT
|
|
|
|
operator.
|
|
|
|
It evaluates to true if the expression is false.
|
2001-12-01 19:43:07 +03:00
|
|
|
.It Ar expression Cm -and Ar expression
|
|
|
|
.It Ar expression expression
|
1993-03-21 12:45:37 +03:00
|
|
|
The
|
|
|
|
.Cm -and
|
|
|
|
operator is the logical
|
|
|
|
.Tn AND
|
|
|
|
operator.
|
|
|
|
As it is implied by the juxtaposition of two expressions it does not
|
|
|
|
have to be specified.
|
|
|
|
The expression evaluates to true if both expressions are true.
|
|
|
|
The second expression is not evaluated if the first expression is false.
|
2001-12-01 19:43:07 +03:00
|
|
|
.It Ar expression Cm -or Ar expression
|
1993-03-21 12:45:37 +03:00
|
|
|
The
|
|
|
|
.Cm -or
|
|
|
|
operator is the logical
|
|
|
|
.Tn OR
|
|
|
|
operator.
|
|
|
|
The expression evaluates to true if either the first or the second expression
|
|
|
|
is true.
|
|
|
|
The second expression is not evaluated if the first expression is true.
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
All operands and primaries must be separate arguments to
|
2012-06-28 02:31:26 +04:00
|
|
|
.Nm .
|
1993-03-21 12:45:37 +03:00
|
|
|
Primaries which themselves take arguments expect each argument
|
|
|
|
to be a separate argument to
|
2012-06-28 02:31:26 +04:00
|
|
|
.Nm .
|
2006-10-07 21:06:28 +04:00
|
|
|
.Sh EXIT STATUS
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
utility normally exits 0 on success, and exits with 1 under certain
|
|
|
|
internal error conditions.
|
2010-09-09 15:42:13 +04:00
|
|
|
If any invocations of
|
2011-09-24 17:45:43 +04:00
|
|
|
.Dq Ic -exec Ar ... Ic \&+
|
2006-10-07 21:06:28 +04:00
|
|
|
primaries return non-zero exit-status, then
|
|
|
|
.Nm
|
|
|
|
will do so as well.
|
1993-03-21 12:45:37 +03:00
|
|
|
.Sh EXAMPLES
|
|
|
|
The following examples are shown as given to the shell:
|
|
|
|
.Bl -tag -width findx
|
2012-08-16 17:34:10 +04:00
|
|
|
.It Li "find / \e! -name \*q*.c\*q \-print"
|
2002-09-27 20:56:53 +04:00
|
|
|
Print out a list of all the files whose names do not end in
|
2002-09-28 16:59:49 +04:00
|
|
|
.Dq \&.c .
|
2012-08-16 17:34:10 +04:00
|
|
|
.It Li "find / \-newer ttt \-user wnj \-print"
|
2002-09-27 20:56:53 +04:00
|
|
|
Print out a list of all the files owned by user
|
|
|
|
.Dq wnj
|
|
|
|
that are newer than the file
|
|
|
|
.Dq ttt .
|
2012-08-16 17:34:10 +04:00
|
|
|
.It Li "find . \-type f \-mmin \-30 \-print \-or \-mindepth 1 \-prune"
|
2011-09-24 17:45:43 +04:00
|
|
|
Print out a list of all the files in the current directory that are
|
|
|
|
newer than 30 minutes.
|
2012-08-16 17:34:10 +04:00
|
|
|
.It Li "find . \-type f \-atime +10 \-mindepth 2 \-print"
|
2011-09-24 17:45:43 +04:00
|
|
|
Print out a list of all the files in any sub-directories that have not
|
|
|
|
been accessed in the past ten days.
|
2012-08-16 17:34:10 +04:00
|
|
|
.It Li "find . \-mtime +90 \-exec rm \-i {} + \-or \-mindepth 1 \-prune"
|
2011-09-24 17:45:43 +04:00
|
|
|
Interactively remove all of the files in the current directory that have
|
|
|
|
not been modified in 90 days.
|
2012-08-16 17:34:10 +04:00
|
|
|
.It Li "find . \-type f \-mtime +90 \-ok mv {} {}.old \e;"
|
2011-09-24 17:45:43 +04:00
|
|
|
Interactively rename all of the files in the current directory and all
|
|
|
|
sub-directories that have not been modified in 90 days.
|
2012-08-16 17:34:10 +04:00
|
|
|
.It Li "find / \e! \e( \-newer ttt \-user wnj \e) \-print"
|
2002-09-27 20:56:53 +04:00
|
|
|
Print out a list of all the files which are not both newer than
|
|
|
|
.Dq ttt
|
|
|
|
and owned by
|
|
|
|
.Dq wnj .
|
2012-08-16 17:34:10 +04:00
|
|
|
.It Li "find / \e( \-newer ttt \-or \-user wnj \e) \-print"
|
2002-09-27 20:56:53 +04:00
|
|
|
Print out a list of all the files that are either owned by
|
|
|
|
.Dq wnj
|
|
|
|
or that are newer than
|
|
|
|
.Dq ttt .
|
2012-08-16 17:34:10 +04:00
|
|
|
.It Li "find / \e( \-newer ttt \-or \-user wnj \e) \-exit 1"
|
2006-02-20 19:31:02 +03:00
|
|
|
Return immediately with a value of 1 if any files are found that are either
|
|
|
|
owned by
|
|
|
|
.Dq wnj
|
|
|
|
or that are newer than
|
|
|
|
.Dq ttt ,
|
|
|
|
but do not print them.
|
2012-08-16 17:34:10 +04:00
|
|
|
.It Li "find / \e( \-newer ttt \-or \-user wnj \e) \-ls \-exit 1"
|
2006-02-20 19:31:02 +03:00
|
|
|
Same as above, but list the first file matching the criteria before exiting
|
|
|
|
with a value of 1.
|
2014-05-17 15:31:40 +04:00
|
|
|
.It Li "find . \-type f \-exec sh \-c 'file=\*[q]$1\*[q]; ...;' - {} \;"
|
|
|
|
Perform an arbitrarily complex shell command for every file.
|
1993-03-21 12:45:37 +03:00
|
|
|
.El
|
|
|
|
.Sh SEE ALSO
|
1999-01-03 17:54:27 +03:00
|
|
|
.Xr chflags 1 ,
|
1993-03-21 12:45:37 +03:00
|
|
|
.Xr chmod 1 ,
|
1993-12-31 00:15:18 +03:00
|
|
|
.Xr locate 1 ,
|
2006-10-07 21:06:28 +04:00
|
|
|
.Xr xargs 1 ,
|
1993-03-21 12:45:37 +03:00
|
|
|
.Xr stat 2 ,
|
1993-12-31 00:15:18 +03:00
|
|
|
.Xr fts 3 ,
|
1993-03-21 12:45:37 +03:00
|
|
|
.Xr getgrent 3 ,
|
2001-12-01 22:11:27 +03:00
|
|
|
.Xr getpwent 3 ,
|
1993-12-31 00:15:18 +03:00
|
|
|
.Xr strmode 3 ,
|
2012-08-16 17:34:10 +04:00
|
|
|
.Xr re_format 7 ,
|
2006-10-07 20:34:06 +04:00
|
|
|
.Xr symlink 7 ,
|
|
|
|
.Xr sysctl 8
|
1993-03-21 12:45:37 +03:00
|
|
|
.Sh STANDARDS
|
|
|
|
The
|
1997-10-19 15:52:12 +04:00
|
|
|
.Nm
|
1993-03-21 12:45:37 +03:00
|
|
|
utility syntax is a superset of the syntax specified by the
|
|
|
|
.St -p1003.2
|
|
|
|
standard.
|
|
|
|
.Pp
|
1993-12-30 01:22:44 +03:00
|
|
|
The options and the
|
1999-01-20 02:22:27 +03:00
|
|
|
.Ic -amin ,
|
2001-12-02 15:46:39 +03:00
|
|
|
.Ic -anewer ,
|
2016-06-13 03:04:40 +03:00
|
|
|
.Ic -asince ,
|
1999-01-20 02:22:27 +03:00
|
|
|
.Ic -cmin ,
|
2001-12-01 17:10:04 +03:00
|
|
|
.Ic -cnewer ,
|
2016-06-13 03:04:40 +03:00
|
|
|
.Ic -csince ,
|
2007-02-06 18:33:21 +03:00
|
|
|
.Ic -delete ,
|
2002-09-27 19:56:25 +04:00
|
|
|
.Ic -empty ,
|
2006-10-07 20:34:06 +04:00
|
|
|
.Ic -execdir ,
|
1993-12-30 01:22:44 +03:00
|
|
|
.Ic -follow ,
|
|
|
|
.Ic -fstype ,
|
2003-08-03 23:46:03 +04:00
|
|
|
.Ic -iname ,
|
1996-01-14 06:52:44 +03:00
|
|
|
.Ic -inum ,
|
1999-07-20 13:02:24 +04:00
|
|
|
.Ic -iregex ,
|
1993-12-30 01:22:44 +03:00
|
|
|
.Ic -links ,
|
1999-01-20 02:22:27 +03:00
|
|
|
.Ic -ls ,
|
2002-09-27 19:56:25 +04:00
|
|
|
.Ic -maxdepth ,
|
|
|
|
.Ic -mindepth ,
|
1999-07-20 13:02:24 +04:00
|
|
|
.Ic -mmin ,
|
2002-09-16 23:24:59 +04:00
|
|
|
.Ic -path ,
|
2006-10-07 20:34:06 +04:00
|
|
|
.Ic -print0 ,
|
|
|
|
.Ic -printx ,
|
2007-02-06 18:33:21 +03:00
|
|
|
.Ic -regex ,
|
2016-06-13 03:04:40 +03:00
|
|
|
.Ic -rm ,
|
1999-07-20 13:02:24 +04:00
|
|
|
and
|
2016-06-13 03:04:40 +03:00
|
|
|
.Ic -since
|
1993-03-21 12:45:37 +03:00
|
|
|
primaries are extensions to
|
|
|
|
.St -p1003.2 .
|
|
|
|
.Pp
|
|
|
|
Historically, the
|
|
|
|
.Fl d ,
|
2006-10-07 20:34:06 +04:00
|
|
|
.Fl h ,
|
1993-03-21 12:45:37 +03:00
|
|
|
and
|
|
|
|
.Fl x
|
2002-09-27 20:56:53 +04:00
|
|
|
options were implemented using the primaries
|
2011-09-24 17:45:43 +04:00
|
|
|
.Dq Ic -depth ,
|
|
|
|
.Dq Ic -follow ,
|
2002-09-27 20:56:53 +04:00
|
|
|
and
|
2011-09-24 17:45:43 +04:00
|
|
|
.Dq Ic -xdev .
|
|
|
|
These primaries always evaluated to true, and always
|
|
|
|
took effect when the
|
|
|
|
.Ar expression
|
|
|
|
was parsed, before the file system traversal began.
|
|
|
|
As a result, some legal expressions could be confusing.
|
|
|
|
For example, in the expression
|
|
|
|
.Dq Ic -print Ic -or Ic -depth ,
|
|
|
|
.Ic -print
|
|
|
|
always evaluates to true, so the standard meaning of
|
|
|
|
.Ic -or
|
|
|
|
implies that
|
|
|
|
.Ic -depth
|
|
|
|
would never be evaluated, but that is not what happens;
|
|
|
|
in fact,
|
|
|
|
.Ic -depth
|
|
|
|
takes effect immediately, without testing whether
|
|
|
|
.Ic -print
|
|
|
|
returns true or false.
|
|
|
|
.Pp
|
|
|
|
Historically, the operator
|
|
|
|
.Dq Ic -or
|
2002-09-27 20:56:53 +04:00
|
|
|
was implemented as
|
2011-09-24 17:45:43 +04:00
|
|
|
.Dq Ic -o ,
|
2002-09-27 20:56:53 +04:00
|
|
|
and the operator
|
2011-09-24 17:45:43 +04:00
|
|
|
.Dq Ic -and
|
2002-09-27 20:56:53 +04:00
|
|
|
was implemented as
|
2011-09-24 17:45:43 +04:00
|
|
|
.Dq Ic -a .
|
1993-03-21 12:45:37 +03:00
|
|
|
.Pp
|
|
|
|
Historic implementations of the
|
2011-09-24 17:45:43 +04:00
|
|
|
.Dq Ic -exec
|
1993-03-21 12:45:37 +03:00
|
|
|
and
|
2011-09-24 17:45:43 +04:00
|
|
|
.Dq Ic -ok
|
2002-09-27 20:56:53 +04:00
|
|
|
primaries did not replace the string
|
2011-09-24 17:45:43 +04:00
|
|
|
.Dq Ic {}
|
2002-09-27 20:56:53 +04:00
|
|
|
in the utility name or the
|
2011-09-24 17:45:43 +04:00
|
|
|
utility arguments if it did not appear as a separate argument.
|
1993-03-21 12:45:37 +03:00
|
|
|
This version replaces it no matter where in the utility name or arguments
|
|
|
|
it appears.
|
2006-10-07 21:06:28 +04:00
|
|
|
.Pp
|
|
|
|
Support for
|
2011-09-24 17:45:43 +04:00
|
|
|
.Dq Ic -exec Ar ... Ic \&+
|
2006-10-07 21:06:28 +04:00
|
|
|
is consistent with
|
|
|
|
.Em IEEE PASC Interpretation 1003.2 #210 ,
|
|
|
|
though the feature originated in
|
|
|
|
.Tn SVR4 .
|
2007-03-09 00:23:00 +03:00
|
|
|
.Pp
|
2007-02-06 16:25:01 +03:00
|
|
|
The
|
|
|
|
.Ic -delete
|
2010-09-09 15:42:13 +04:00
|
|
|
primary does not interact well with other options that cause the file system
|
2007-02-06 16:25:01 +03:00
|
|
|
tree traversal options to be changed.
|
2001-12-01 22:11:27 +03:00
|
|
|
.Sh HISTORY
|
|
|
|
A much simpler
|
2012-06-28 02:57:27 +04:00
|
|
|
.Nm
|
2017-07-04 00:28:48 +03:00
|
|
|
command appeared in First Edition AT&T Unix.
|
2001-12-01 22:11:27 +03:00
|
|
|
The syntax had become similar to the present version by
|
|
|
|
the time of the Fifth Edition.
|
1993-03-21 12:45:37 +03:00
|
|
|
.Sh BUGS
|
|
|
|
The special characters used by
|
1997-10-19 15:52:12 +04:00
|
|
|
.Nm
|
1993-03-21 12:45:37 +03:00
|
|
|
are also special characters to many shell programs.
|
2002-09-27 20:56:53 +04:00
|
|
|
In particular, the characters
|
|
|
|
.Dq \&* ,
|
|
|
|
.Dq \&[ ,
|
|
|
|
.Dq \&] ,
|
|
|
|
.Dq \&? ,
|
|
|
|
.Dq \&( ,
|
|
|
|
.Dq \&) ,
|
|
|
|
.Dq \&! ,
|
2006-10-07 20:34:06 +04:00
|
|
|
.Dq \e ,
|
2002-09-27 20:56:53 +04:00
|
|
|
and
|
|
|
|
.Dq \&;
|
|
|
|
may have to be escaped from the shell.
|
1993-03-21 12:45:37 +03:00
|
|
|
.Pp
|
|
|
|
As there is no delimiter separating options and file names or file
|
|
|
|
names and the
|
|
|
|
.Ar expression ,
|
2002-09-27 20:56:53 +04:00
|
|
|
it is difficult to specify files named
|
|
|
|
.Dq -xdev
|
|
|
|
or
|
|
|
|
.Dq \&! .
|
1993-03-21 12:45:37 +03:00
|
|
|
These problems are handled by the
|
|
|
|
.Fl f
|
|
|
|
option and the
|
|
|
|
.Xr getopt 3
|
2002-09-27 20:56:53 +04:00
|
|
|
.Dq --
|
|
|
|
construct.
|