2015-10-08 11:15:08 -04:00
|
|
|
.Dd 2015-10-08
|
2015-02-28 07:46:20 -05:00
|
|
|
.Dt FIND 1
|
|
|
|
.Os sbase
|
|
|
|
.Sh NAME
|
|
|
|
.Nm find
|
2015-08-04 11:58:15 -04:00
|
|
|
.Nd find files
|
|
|
|
.Sh SYNOPSIS
|
|
|
|
.Nm
|
|
|
|
.Op Fl H | L
|
|
|
|
.Ar path Op ...
|
|
|
|
.Op Ar expression
|
|
|
|
.Sh DESCRIPTION
|
|
|
|
.Nm
|
|
|
|
walks a file hierarchy starting at each
|
|
|
|
.Ar path
|
|
|
|
and applies the
|
|
|
|
.Ar expression
|
|
|
|
to each file encountered.
|
|
|
|
.Sh OPTIONS
|
|
|
|
.Bl -tag -width Ds
|
|
|
|
.It Fl H
|
|
|
|
Dereference symbolic links provided as
|
|
|
|
.Ar path .
|
|
|
|
.It Fl L
|
|
|
|
Dereference all symbolic links encountered.
|
2015-08-04 14:51:40 -04:00
|
|
|
.El
|
2015-08-04 11:58:15 -04:00
|
|
|
.Sh EXTENDED DESCRIPTION
|
|
|
|
.Ar expression
|
2020-03-01 17:37:31 -05:00
|
|
|
is a combination of the following primaries and boolean operators.
|
|
|
|
In the following descriptions the number n can be replaced by +n, n, or
|
|
|
|
-n, to mean more than, exactly, or less than n respectively.
|
2015-08-04 11:58:15 -04:00
|
|
|
.Ss Primaries
|
|
|
|
.Bl -tag -width Ds
|
|
|
|
.It Fl name Ar pattern
|
|
|
|
True if the name of the file matches the given pattern.
|
|
|
|
.It Fl path Ar pattern
|
|
|
|
True if the path to the file matches the given pattern.
|
|
|
|
.It Fl nouser
|
|
|
|
True if the file belongs to a user for which getpwuid() returns NULL.
|
|
|
|
.It Fl nogroup
|
|
|
|
True if the file belongs to a group for which getgrgid() returns NULL.
|
|
|
|
.It Fl xdev
|
2020-03-01 17:37:31 -05:00
|
|
|
True.
|
|
|
|
Do not enter directory on a different device.
|
2015-08-04 11:58:15 -04:00
|
|
|
.It Fl prune
|
2020-03-01 17:37:31 -05:00
|
|
|
True.
|
|
|
|
Do not enter directory.
|
2015-08-04 11:58:15 -04:00
|
|
|
.It Fl perm Ar mode
|
2020-03-01 17:37:31 -05:00
|
|
|
True if permissions on the file match mode.
|
|
|
|
Mode is a symbolic mode as used in chmod.
|
|
|
|
A leading '-' in mode checks that at least all bits in mode are set in
|
|
|
|
permissions for file.
|
|
|
|
Without the leading '-' the permissions for file must exactly match
|
|
|
|
mode.
|
2015-08-04 11:58:15 -04:00
|
|
|
.It Fl type Ar t
|
|
|
|
True if file is of type specified by
|
|
|
|
.Ar t .
|
|
|
|
.Bl -tag -width Ds
|
|
|
|
.It Ar b
|
|
|
|
block special
|
|
|
|
.It Ar c
|
|
|
|
character special
|
|
|
|
.It Ar d
|
|
|
|
directory
|
|
|
|
.It Ar l
|
|
|
|
symbolic link
|
|
|
|
.It Ar p
|
|
|
|
FIFO
|
|
|
|
.It Ar f
|
|
|
|
regular file
|
|
|
|
.It Ar s
|
|
|
|
socket
|
|
|
|
.El
|
|
|
|
.It Fl links Ar n
|
|
|
|
True if file has
|
|
|
|
.Ar n
|
|
|
|
links.
|
|
|
|
.It Fl user Ar name
|
|
|
|
True if file belongs to user
|
|
|
|
.Ar name .
|
|
|
|
.It Fl group Ar name
|
|
|
|
True if file belongs to group
|
|
|
|
.Ar name .
|
|
|
|
.It Fl size Ar n[c]
|
|
|
|
True if file size in 512 byte sectors (rounded up), or bytes (if
|
|
|
|
.Ar c
|
|
|
|
is given), is
|
|
|
|
.Ar n .
|
|
|
|
.It Fl atime n
|
|
|
|
True if file access time is
|
|
|
|
.Ar n
|
|
|
|
days.
|
|
|
|
.It Fl ctime
|
|
|
|
True if file status change time is
|
|
|
|
.Ar n
|
|
|
|
days.
|
|
|
|
.It Fl mtime
|
|
|
|
True if file modified time is
|
|
|
|
.Ar n
|
|
|
|
days.
|
|
|
|
.It Fl exec Ar cmd [arg ...] \&;
|
|
|
|
Execute cmd with given arguments, replacing each {} in argument list
|
2020-03-01 17:37:31 -05:00
|
|
|
with the current file.
|
|
|
|
True if cmd exits with status 0.
|
2015-08-04 11:58:15 -04:00
|
|
|
.It Fl exec Ar cmd [arg ...] {} +
|
2020-03-01 17:37:31 -05:00
|
|
|
True.
|
|
|
|
Add as many files as possible to argument list and execute when the list
|
|
|
|
is full or all files have been found.
|
2015-08-04 11:58:15 -04:00
|
|
|
.It Fl ok Ar cmd [arg ...] \&;
|
|
|
|
Prompt the user on each file encountered whether or not to execute cmd
|
2020-03-01 17:37:31 -05:00
|
|
|
as with -exec.
|
|
|
|
True if the user responds yes and cmd exits with status 0, false
|
|
|
|
otherwise.
|
2015-08-04 11:58:15 -04:00
|
|
|
.It Fl print
|
2020-03-01 17:37:31 -05:00
|
|
|
True.
|
|
|
|
Print the path to the current file.
|
2015-08-04 11:58:15 -04:00
|
|
|
.It Fl newer Ar file
|
|
|
|
True if the modification time of the current file is newer than that of
|
|
|
|
the provided file.
|
|
|
|
.It Fl depth
|
2020-03-01 17:37:31 -05:00
|
|
|
True.
|
|
|
|
Causes find to evaluate files within in a directory before the directory
|
|
|
|
itself.
|
2015-08-04 11:58:15 -04:00
|
|
|
.El
|
|
|
|
.Ss Operators
|
|
|
|
In order of decreasing precedence
|
|
|
|
.Bl -tag -width Ds
|
|
|
|
.It Ar \&( expression \&)
|
|
|
|
True if expression is true.
|
|
|
|
.It Ar \&! expression
|
|
|
|
True if expression if false.
|
|
|
|
.It Ar expression [ Fl a ] Ar expression
|
2020-03-01 17:37:31 -05:00
|
|
|
True if both expressions are true.
|
|
|
|
Second expression is not evaluated if first expression is false.
|
2015-08-04 11:58:15 -04:00
|
|
|
.Fl a
|
|
|
|
is implied if there is no operator between primaries.
|
|
|
|
.It Ar expression Fl o Ar expression
|
2020-03-01 17:37:31 -05:00
|
|
|
True if either expression is true.
|
|
|
|
Second expression is not evaluated if first expression is true.
|
2015-08-04 11:58:15 -04:00
|
|
|
.El
|
|
|
|
.Pp
|
2020-03-01 17:37:31 -05:00
|
|
|
If no expression is supplied, -print is used.
|
|
|
|
If an expression is supplied but none of -print, -exec, or -ok is
|
|
|
|
supplied, then -a -print is appended to the expressions.
|