find.1 (3528B)
1 .Dd 2015-10-08 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. In 30 the following descriptions the number n can be replaced by +n, n, or -n, 31 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. Do not enter directory on a different device. 44 .It Fl prune 45 True. Do not enter directory. 46 .It Fl perm Ar mode 47 True if permissions on the file match mode. Mode is a symbolic mode 48 as used in chmod. A leading '-' in mode checks that at least all bits 49 in mode are set in permissions for file. Without the leading '-' the 50 permissions for file must exactly match mode. 51 .It Fl type Ar t 52 True if file is of type specified by 53 .Ar t . 54 .Bl -tag -width Ds 55 .It Ar b 56 block special 57 .It Ar c 58 character special 59 .It Ar d 60 directory 61 .It Ar l 62 symbolic link 63 .It Ar p 64 FIFO 65 .It Ar f 66 regular file 67 .It Ar s 68 socket 69 .El 70 .It Fl links Ar n 71 True if file has 72 .Ar n 73 links. 74 .It Fl user Ar name 75 True if file belongs to user 76 .Ar name . 77 .It Fl group Ar name 78 True if file belongs to group 79 .Ar name . 80 .It Fl size Ar n[c] 81 True if file size in 512 byte sectors (rounded up), or bytes (if 82 .Ar c 83 is given), is 84 .Ar n . 85 .It Fl atime n 86 True if file access time is 87 .Ar n 88 days. 89 .It Fl ctime 90 True if file status change time is 91 .Ar n 92 days. 93 .It Fl mtime 94 True if file modified time is 95 .Ar n 96 days. 97 .It Fl exec Ar cmd [arg ...] \&; 98 Execute cmd with given arguments, replacing each {} in argument list 99 with the current file. True if cmd exits with status 0. 100 .It Fl exec Ar cmd [arg ...] {} + 101 True. Add as many files as possible to argument list and execute when 102 the list is full or all files have been found. 103 .It Fl ok Ar cmd [arg ...] \&; 104 Prompt the user on each file encountered whether or not to execute cmd 105 as with -exec. True if the user responds yes and cmd exits with status 0, 106 false otherwise. 107 .It Fl print 108 True. Print the path to the current file. 109 .It Fl newer Ar file 110 True if the modification time of the current file is newer than that of 111 the provided file. 112 .It Fl depth 113 True. Causes find to evaluate files within in a directory before the 114 directory itself. 115 .El 116 .Ss Operators 117 In order of decreasing precedence 118 .Bl -tag -width Ds 119 .It Ar \&( expression \&) 120 True if expression is true. 121 .It Ar \&! expression 122 True if expression if false. 123 .It Ar expression [ Fl a ] Ar expression 124 True if both expressions are true. Second expression is not evaluated 125 if first expression is false. 126 .Fl a 127 is implied if there is no operator between primaries. 128 .It Ar expression Fl o Ar expression 129 True if either expression is true. Second expression is not evaluated 130 if first expression is true. 131 .El 132 .Pp 133 If no expression is supplied, -print is used. If an expression is supplied 134 but none of -print, -exec, or -ok is supplied, then -a -print is appended 135 to the expressions.