sbase

suckless unix tools
git clone git://git.suckless.org/sbase
Log | Files | Refs | README | LICENSE

find.1 (3533B)


      1 .Dd October 8, 2015
      2 .Dt FIND 1
      3 .Os sbase
      4 .Sh NAME
      5 .Nm find
      6 .Nd find files
      7 .Sh SYNOPSIS
      8 .Nm
      9 .Op Fl H | L
     10 .Ar path Op ...
     11 .Op Ar expression
     12 .Sh DESCRIPTION
     13 .Nm
     14 walks a file hierarchy starting at each
     15 .Ar path
     16 and applies the
     17 .Ar expression
     18 to each file encountered.
     19 .Sh OPTIONS
     20 .Bl -tag -width Ds
     21 .It Fl H
     22 Dereference symbolic links provided as
     23 .Ar path .
     24 .It Fl L
     25 Dereference all symbolic links encountered.
     26 .El
     27 .Sh EXTENDED DESCRIPTION
     28 .Ar expression
     29 is a combination of the following primaries and boolean operators.
     30 In the following descriptions the number n can be replaced by +n, n, or
     31 -n, to mean more than, exactly, or less than n respectively.
     32 .Ss Primaries
     33 .Bl -tag -width Ds
     34 .It Fl name Ar pattern
     35 True if the name of the file matches the given pattern.
     36 .It Fl path Ar pattern
     37 True if the path to the file matches the given pattern.
     38 .It Fl nouser
     39 True if the file belongs to a user for which getpwuid() returns NULL.
     40 .It Fl nogroup
     41 True if the file belongs to a group for which getgrgid() returns NULL.
     42 .It Fl xdev
     43 True.
     44 Do not enter directory on a different device.
     45 .It Fl prune
     46 True.
     47 Do not enter directory.
     48 .It Fl perm Ar mode
     49 True if permissions on the file match mode.
     50 Mode is a symbolic mode as used in chmod.
     51 A leading '-' in mode checks that at least all bits in mode are set in
     52 permissions for file.
     53 Without the leading '-' the permissions for file must exactly match
     54 mode.
     55 .It Fl type Ar t
     56 True if file is of type specified by
     57 .Ar t .
     58 .Bl -tag -width Ds
     59 .It Ar b
     60 block special
     61 .It Ar c
     62 character special
     63 .It Ar d
     64 directory
     65 .It Ar l
     66 symbolic link
     67 .It Ar p
     68 FIFO
     69 .It Ar f
     70 regular file
     71 .It Ar s
     72 socket
     73 .El
     74 .It Fl links Ar n
     75 True if file has
     76 .Ar n
     77 links.
     78 .It Fl user Ar name
     79 True if file belongs to user
     80 .Ar name .
     81 .It Fl group Ar name
     82 True if file belongs to group
     83 .Ar name .
     84 .It Fl size Ar n[c]
     85 True if file size in 512 byte sectors (rounded up), or bytes (if
     86 .Ar c
     87 is given), is
     88 .Ar n .
     89 .It Fl atime n
     90 True if file access time is
     91 .Ar n
     92 days.
     93 .It Fl ctime
     94 True if file status change time is
     95 .Ar n
     96 days.
     97 .It Fl mtime
     98 True if file modified time is
     99 .Ar n
    100 days.
    101 .It Fl exec Ar cmd [arg ...] \&;
    102 Execute cmd with given arguments, replacing each {} in argument list
    103 with the current file.
    104 True if cmd exits with status 0.
    105 .It Fl exec Ar cmd [arg ...] {} +
    106 True.
    107 Add as many files as possible to argument list and execute when the list
    108 is full or all files have been found.
    109 .It Fl ok Ar cmd [arg ...] \&;
    110 Prompt the user on each file encountered whether or not to execute cmd
    111 as with -exec.
    112 True if the user responds yes and cmd exits with status 0, false
    113 otherwise.
    114 .It Fl print
    115 True.
    116 Print the path to the current file.
    117 .It Fl newer Ar file
    118 True if the modification time of the current file is newer than that of
    119 the provided file.
    120 .It Fl depth
    121 True.
    122 Causes find to evaluate files within in a directory before the directory
    123 itself.
    124 .El
    125 .Ss Operators
    126 In order of decreasing precedence
    127 .Bl -tag -width Ds
    128 .It Ar \&( expression \&)
    129 True if expression is true.
    130 .It Ar \&! expression
    131 True if expression if false.
    132 .It Ar expression [ Fl a ] Ar expression
    133 True if both expressions are true.
    134 Second expression is not evaluated if first expression is false.
    135 .Fl a
    136 is implied if there is no operator between primaries.
    137 .It Ar expression Fl o Ar expression
    138 True if either expression is true.
    139 Second expression is not evaluated if first expression is true.
    140 .El
    141 .Pp
    142 If no expression is supplied, -print is used.
    143 If an expression is supplied but none of -print, -exec, or -ok is
    144 supplied, then -a -print is appended to the expressions.