1.\" Copyright (c) 1990, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" This code is derived from software contributed to Berkeley by 5.\" the Institute of Electrical and Electronics Engineers, Inc. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions 9.\" are met: 10.\" 1. Redistributions of source code must retain the above copyright 11.\" notice, this list of conditions and the following disclaimer. 12.\" 2. Redistributions in binary form must reproduce the above copyright 13.\" notice, this list of conditions and the following disclaimer in the 14.\" documentation and/or other materials provided with the distribution. 15.\" 4. Neither the name of the University nor the names of its contributors 16.\" may be used to endorse or promote products derived from this software 17.\" without specific prior written permission. 18.\" 19.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 23.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29.\" SUCH DAMAGE. 30.\" 31.\" @(#)find.1 8.7 (Berkeley) 5/9/95 32.\" $FreeBSD$ 33.\" 34.Dd May 6, 2012 35.Dt FIND 1 36.Os 37.Sh NAME 38.Nm find 39.Nd walk a file hierarchy 40.Sh SYNOPSIS 41.Nm 42.Op Fl H | Fl L | Fl P 43.Op Fl EXdsx 44.Op Fl f Ar path 45.Ar path ... 46.Op Ar expression 47.Nm 48.Op Fl H | Fl L | Fl P 49.Op Fl EXdsx 50.Fl f Ar path 51.Op Ar path ... 52.Op Ar expression 53.Sh DESCRIPTION 54The 55.Nm 56utility recursively descends the directory tree for each 57.Ar path 58listed, evaluating an 59.Ar expression 60(composed of the 61.Dq primaries 62and 63.Dq operands 64listed below) in terms 65of each file in the tree. 66.Pp 67The options are as follows: 68.Bl -tag -width indent 69.It Fl E 70Interpret regular expressions followed by 71.Ic -regex 72and 73.Ic -iregex 74primaries as extended (modern) regular expressions rather than basic 75regular expressions (BRE's). 76The 77.Xr re_format 7 78manual page fully describes both formats. 79.It Fl H 80Cause the file information and file type (see 81.Xr stat 2 ) 82returned for each symbolic link specified on the command line to be 83those of the file referenced by the link, not the link itself. 84If the referenced file does not exist, the file information and type will 85be for the link itself. 86File information of all symbolic links not on 87the command line is that of the link itself. 88.It Fl L 89Cause the file information and file type (see 90.Xr stat 2 ) 91returned for each symbolic link to be those of the file referenced by the 92link, not the link itself. 93If the referenced file does not exist, the file information and type will 94be for the link itself. 95.Pp 96This option is equivalent to the deprecated 97.Ic -follow 98primary. 99.It Fl P 100Cause the file information and file type (see 101.Xr stat 2 ) 102returned for each symbolic link to be those of the link itself. 103This is the default. 104.It Fl X 105Permit 106.Nm 107to be safely used in conjunction with 108.Xr xargs 1 . 109If a file name contains any of the delimiting characters used by 110.Xr xargs 1 , 111a diagnostic message is displayed on standard error, and the file 112is skipped. 113The delimiting characters include single 114.Pq Dq Li " ' " 115and double 116.Pq Dq Li " \*q " 117quotes, backslash 118.Pq Dq Li \e , 119space, tab and newline characters. 120.Pp 121However, you may wish to consider the 122.Fl print0 123primary in conjunction with 124.Dq Nm xargs Fl 0 125as an effective alternative. 126.It Fl d 127Cause 128.Nm 129to perform a depth-first traversal, i.e., directories 130are visited in post-order and all entries in a directory will be acted 131on before the directory itself. 132By default, 133.Nm 134visits directories in pre-order, i.e., before their contents. 135Note, the default is 136.Em not 137a breadth-first traversal. 138.Pp 139This option is equivalent to the 140.Ic -depth 141primary of 142.St -p1003.1-2001 . 143The 144.Fl d 145option 146can be useful when 147.Nm 148is used with 149.Xr cpio 1 150to process files that are contained in directories with unusual permissions. 151It ensures that you have write permission while you are placing files in a 152directory, then sets the directory's permissions as the last thing. 153.It Fl f 154Specify a file hierarchy for 155.Nm 156to traverse. 157File hierarchies may also be specified as the operands immediately 158following the options. 159.It Fl s 160Cause 161.Nm 162to traverse the file hierarchies in lexicographical order, 163i.e., alphabetical order within each directory. 164Note: 165.Ql find -s 166and 167.Ql "find | sort" 168may give different results. 169.It Fl x 170Prevent 171.Nm 172from descending into directories that have a device number different 173than that of the file from which the descent began. 174.Pp 175This option is equivalent to the deprecated 176.Ic -xdev 177primary. 178.El 179.Sh PRIMARIES 180All primaries which take a numeric argument allow the number to be 181preceded by a plus sign 182.Pq Dq Li + 183or a minus sign 184.Pq Dq Li - . 185A preceding plus sign means 186.Dq more than n , 187a preceding minus sign means 188.Dq less than n 189and neither means 190.Dq exactly n . 191.Bl -tag -width indent 192.It Ic -Bmin Ar n 193True if the difference between the time of a file's inode creation 194and the time 195.Nm 196was started, rounded up to the next full minute, is 197.Ar n 198minutes. 199.It Ic -Bnewer Ar file 200Same as 201.Ic -newerBm . 202.It Ic -Btime Ar n Ns Op Cm smhdw 203If no units are specified, this primary evaluates to 204true if the difference between the time of a file's inode creation 205and the time 206.Nm 207was started, rounded up to the next full 24-hour period, is 208.Ar n 20924-hour periods. 210.Pp 211If units are specified, this primary evaluates to 212true if the difference between the time of a file's inode creation 213and the time 214.Nm 215was started is exactly 216.Ar n 217units. 218Please refer to the 219.Ic -atime 220primary description for information on supported time units. 221.It Ic -acl 222May be used in conjunction with other primaries to locate 223files with extended ACLs. 224See 225.Xr acl 3 226for more information. 227.It Ic -amin Ar n 228True if the difference between the file last access time and the time 229.Nm 230was started, rounded up to the next full minute, is 231.Ar n 232minutes. 233.It Ic -anewer Ar file 234Same as 235.Ic -neweram . 236.It Ic -atime Ar n Ns Op Cm smhdw 237If no units are specified, this primary evaluates to 238true if the difference between the file last access time and the time 239.Nm 240was started, rounded up to the next full 24-hour period, is 241.Ar n 24224-hour periods. 243.Pp 244If units are specified, this primary evaluates to 245true if the difference between the file last access time and the time 246.Nm 247was started is exactly 248.Ar n 249units. 250Possible time units are as follows: 251.Pp 252.Bl -tag -width indent -compact 253.It Cm s 254second 255.It Cm m 256minute (60 seconds) 257.It Cm h 258hour (60 minutes) 259.It Cm d 260day (24 hours) 261.It Cm w 262week (7 days) 263.El 264.Pp 265Any number of units may be combined in one 266.Ic -atime 267argument, for example, 268.Dq Li "-atime -1h30m" . 269Units are probably only useful when used in conjunction with the 270.Cm + 271or 272.Cm - 273modifier. 274.It Ic -cmin Ar n 275True if the difference between the time of last change of file status 276information and the time 277.Nm 278was started, rounded up to the next full minute, is 279.Ar n 280minutes. 281.It Ic -cnewer Ar file 282Same as 283.Ic -newercm . 284.It Ic -ctime Ar n Ns Op Cm smhdw 285If no units are specified, this primary evaluates to 286true if the difference between the time of last change of file status 287information and the time 288.Nm 289was started, rounded up to the next full 24-hour period, is 290.Ar n 29124-hour periods. 292.Pp 293If units are specified, this primary evaluates to 294true if the difference between the time of last change of file status 295information and the time 296.Nm 297was started is exactly 298.Ar n 299units. 300Please refer to the 301.Ic -atime 302primary description for information on supported time units. 303.It Ic -d 304Same as 305.Ic depth . 306GNU find implements this as a primary in mistaken emulation of 307.Fx 308.Xr find 1 . 309.It Ic -delete 310Delete found files and/or directories. 311Always returns true. 312This executes 313from the current working directory as 314.Nm 315recurses down the tree. 316It will not attempt to delete a filename with a 317.Dq Pa / 318character in its pathname relative to 319.Dq Pa \&. 320for security reasons. 321Depth-first traversal processing is implied by this option. 322The 323.Ic -delete 324primary will fail to delete a directory if it is not empty. 325Following symlinks is incompatible with this option. 326.It Ic -depth 327Always true; 328same as the 329.Fl d 330option. 331.It Ic -depth Ar n 332True if the depth of the file relative to the starting point of the traversal 333is 334.Ar n . 335.It Ic -empty 336True if the current file or directory is empty. 337.It Ic -exec Ar utility Oo Ar argument ... Oc Li \&; 338True if the program named 339.Ar utility 340returns a zero value as its exit status. 341Optional 342.Ar arguments 343may be passed to the utility. 344The expression must be terminated by a semicolon 345.Pq Dq Li \&; . 346If you invoke 347.Nm 348from a shell you may need to quote the semicolon if the shell would 349otherwise treat it as a control operator. 350If the string 351.Dq Li {} 352appears anywhere in the utility name or the 353arguments it is replaced by the pathname of the current file. 354.Ar Utility 355will be executed from the directory from which 356.Nm 357was executed. 358.Ar Utility 359and 360.Ar arguments 361are not subject to the further expansion of shell patterns 362and constructs. 363.It Ic -exec Ar utility Oo Ar argument ... Oc Li {} + 364Same as 365.Ic -exec , 366except that 367.Dq Li {} 368is replaced with as many pathnames as possible for each invocation of 369.Ar utility . 370This behaviour is similar to that of 371.Xr xargs 1 . 372.It Ic -execdir Ar utility Oo Ar argument ... Oc Li \&; 373The 374.Ic -execdir 375primary is identical to the 376.Ic -exec 377primary with the exception that 378.Ar utility 379will be executed from the directory that holds 380the current file. 381The filename substituted for 382the string 383.Dq Li {} 384is not qualified. 385.It Ic -execdir Ar utility Oo Ar argument ... Oc Li {} + 386Same as 387.Ic -execdir , 388except that 389.Dq Li {} 390is replaced with as many pathnames as possible for each invocation of 391.Ar utility . 392This behaviour is similar to that of 393.Xr xargs 1 . 394.It Ic -flags Oo Cm - Ns | Ns Cm + Oc Ns Ar flags , Ns Ar notflags 395The flags are specified using symbolic names (see 396.Xr chflags 1 ) . 397Those with the 398.Qq Li no 399prefix (except 400.Qq Li nodump ) 401are said to be 402.Ar notflags . 403Flags in 404.Ar flags 405are checked to be set, and flags in 406.Ar notflags 407are checked to be not set. 408Note that this is different from 409.Ic -perm , 410which only allows the user to specify mode bits that are set. 411.Pp 412If flags are preceded by a dash 413.Pq Dq Li - , 414this primary evaluates to true 415if at least all of the bits in 416.Ar flags 417and none of the bits in 418.Ar notflags 419are set in the file's flags bits. 420If flags are preceded by a plus 421.Pq Dq Li + , 422this primary evaluates to true 423if any of the bits in 424.Ar flags 425is set in the file's flags bits, 426or any of the bits in 427.Ar notflags 428is not set in the file's flags bits. 429Otherwise, 430this primary evaluates to true 431if the bits in 432.Ar flags 433exactly match the file's flags bits, 434and none of the 435.Ar flags 436bits match those of 437.Ar notflags . 438.It Ic -fstype Ar type 439True if the file is contained in a file system of type 440.Ar type . 441The 442.Xr lsvfs 1 443command can be used to find out the types of file systems 444that are available on the system. 445In addition, there are two pseudo-types, 446.Dq Li local 447and 448.Dq Li rdonly . 449The former matches any file system physically mounted on the system where 450the 451.Nm 452is being executed and the latter matches any file system which is 453mounted read-only. 454.It Ic -gid Ar gname 455The same thing as 456.Ar -group Ar gname 457for compatibility with GNU find. 458GNU find imposes a restriction that 459.Ar gname 460is numeric, while 461.Xr find 1 462does not. 463.It Ic -group Ar gname 464True if the file belongs to the group 465.Ar gname . 466If 467.Ar gname 468is numeric and there is no such group name, then 469.Ar gname 470is treated as a group ID. 471.It Ic -ignore_readdir_race 472This option is for GNU find compatibility and is ignored. 473.It Ic -ilname Ar pattern 474Like 475.Ic -lname , 476but the match is case insensitive. 477This is a GNU find extension. 478.It Ic -iname Ar pattern 479Like 480.Ic -name , 481but the match is case insensitive. 482.It Ic -inum Ar n 483True if the file has inode number 484.Ar n . 485.It Ic -ipath Ar pattern 486Like 487.Ic -path , 488but the match is case insensitive. 489.It Ic -iregex Ar pattern 490Like 491.Ic -regex , 492but the match is case insensitive. 493.It Ic -iwholename Ar pattern 494The same thing as 495.Ic -ipath , 496for GNU find compatibility. 497.It Ic -links Ar n 498True if the file has 499.Ar n 500links. 501.It Ic -lname Ar pattern 502Like 503.Ic -name , 504but the contents of the symbolic link are matched instead of the file 505name. 506This is a GNU find extension. 507.It Ic -ls 508This primary always evaluates to true. 509The following information for the current file is written to standard output: 510its inode number, size in 512-byte blocks, file permissions, number of hard 511links, owner, group, size in bytes, last modification time, and pathname. 512If the file is a block or character special file, the device number 513will be displayed instead of the size in bytes. 514If the file is a symbolic link, the pathname of the linked-to file will be 515displayed preceded by 516.Dq Li -> . 517The format is identical to that produced by 518.Bk -words 519.Dq Nm ls Fl dgils . 520.Ek 521.It Ic -maxdepth Ar n 522Always true; descend at most 523.Ar n 524directory levels below the command line arguments. 525If any 526.Ic -maxdepth 527primary is specified, it applies to the entire expression even if it would 528not normally be evaluated. 529.Dq Ic -maxdepth Li 0 530limits the whole search to the command line arguments. 531.It Ic -mindepth Ar n 532Always true; do not apply any tests or actions at levels less than 533.Ar n . 534If any 535.Ic -mindepth 536primary is specified, it applies to the entire expression even if it would 537not normally be evaluated. 538.Dq Ic -mindepth Li 1 539processes all but the command line arguments. 540.It Ic -mmin Ar n 541True if the difference between the file last modification time and the time 542.Nm 543was started, rounded up to the next full minute, is 544.Ar n 545minutes. 546.It Ic -mnewer Ar file 547Same as 548.Ic -newer . 549.It Ic -mount 550The same thing as 551.Ic -xdev , 552for GNU find compatibility. 553.It Ic -mtime Ar n Ns Op Cm smhdw 554If no units are specified, this primary evaluates to 555true if the difference between the file last modification time and the time 556.Nm 557was started, rounded up to the next full 24-hour period, is 558.Ar n 55924-hour periods. 560.Pp 561If units are specified, this primary evaluates to 562true if the difference between the file last modification time and the time 563.Nm 564was started is exactly 565.Ar n 566units. 567Please refer to the 568.Ic -atime 569primary description for information on supported time units. 570.It Ic -name Ar pattern 571True if the last component of the pathname being examined matches 572.Ar pattern . 573Special shell pattern matching characters 574.Dq ( Li \&[ , 575.Dq Li \&] , 576.Dq Li * , 577and 578.Dq Li \&? ) 579may be used as part of 580.Ar pattern . 581These characters may be matched explicitly by escaping them with a 582backslash 583.Pq Dq Li \e . 584.It Ic -newer Ar file 585True if the current file has a more recent last modification time than 586.Ar file . 587.It Ic -newer Ns Ar X Ns Ar Y Ar file 588True if the current file has a more recent last access time 589.Pq Ar X Ns = Ns Cm a , 590inode creation time 591.Pq Ar X Ns = Ns Cm B , 592change time 593.Pq Ar X Ns = Ns Cm c , 594or modification time 595.Pq Ar X Ns = Ns Cm m 596than the last access time 597.Pq Ar Y Ns = Ns Cm a , 598inode creation time 599.Pq Ar Y Ns = Ns Cm B , 600change time 601.Pq Ar Y Ns = Ns Cm c , 602or modification time 603.Pq Ar Y Ns = Ns Cm m 604of 605.Ar file . 606In addition, if 607.Ar Y Ns = Ns Cm t , 608then 609.Ar file 610is instead interpreted as a direct date specification of the form 611understood by 612.Xr cvs 1 . 613Note that 614.Ic -newermm 615is equivalent to 616.Ic -newer . 617.It Ic -nogroup 618True if the file belongs to an unknown group. 619.It Ic -noignore_readdir_race 620This option is for GNU find compatibility and is ignored. 621.It Ic -noleaf 622This option is for GNU find compatibility. 623In GNU find it disables an optimization not relevant to 624.Xr find 1 , 625so it is ignored. 626.It Ic -nouser 627True if the file belongs to an unknown user. 628.It Ic -ok Ar utility Oo Ar argument ... Oc Li \&; 629The 630.Ic -ok 631primary is identical to the 632.Ic -exec 633primary with the exception that 634.Nm 635requests user affirmation for the execution of the 636.Ar utility 637by printing 638a message to the terminal and reading a response. 639If the response is not affirmative 640.Ql ( y 641in the 642.Dq Li POSIX 643locale), 644the command is not executed and the 645value of the 646.Ic -ok 647expression is false. 648.It Ic -okdir Ar utility Oo Ar argument ... Oc Li \&; 649The 650.Ic -okdir 651primary is identical to the 652.Ic -execdir 653primary with the same exception as described for the 654.Ic -ok 655primary. 656.It Ic -path Ar pattern 657True if the pathname being examined matches 658.Ar pattern . 659Special shell pattern matching characters 660.Dq ( Li \&[ , 661.Dq Li \&] , 662.Dq Li * , 663and 664.Dq Li \&? ) 665may be used as part of 666.Ar pattern . 667These characters may be matched explicitly by escaping them with a 668backslash 669.Pq Dq Li \e . 670Slashes 671.Pq Dq Li / 672are treated as normal characters and do not have to be 673matched explicitly. 674.It Ic -perm Oo Cm - Ns | Ns Cm + Oc Ns Ar mode 675The 676.Ar mode 677may be either symbolic (see 678.Xr chmod 1 ) 679or an octal number. 680If the 681.Ar mode 682is symbolic, a starting value of zero is assumed and the 683.Ar mode 684sets or clears permissions without regard to the process' file mode 685creation mask. 686If the 687.Ar mode 688is octal, only bits 07777 689.Pq Dv S_ISUID | S_ISGID | S_ISTXT | S_IRWXU | S_IRWXG | S_IRWXO 690of the file's mode bits participate 691in the comparison. 692If the 693.Ar mode 694is preceded by a dash 695.Pq Dq Li - , 696this primary evaluates to true 697if at least all of the bits in the 698.Ar mode 699are set in the file's mode bits. 700If the 701.Ar mode 702is preceded by a plus 703.Pq Dq Li + , 704this primary evaluates to true 705if any of the bits in the 706.Ar mode 707are set in the file's mode bits. 708Otherwise, this primary evaluates to true if 709the bits in the 710.Ar mode 711exactly match the file's mode bits. 712Note, the first character of a symbolic mode may not be a dash 713.Pq Dq Li - . 714.It Ic -print 715This primary always evaluates to true. 716It prints the pathname of the current file to standard output. 717If none of 718.Ic -exec , -ls , -print0 , 719or 720.Ic -ok 721is specified, the given expression shall be effectively replaced by 722.Cm \&( Ar "given expression" Cm \&) Ic -print . 723.It Ic -print0 724This primary always evaluates to true. 725It prints the pathname of the current file to standard output, followed by an 726.Tn ASCII 727.Dv NUL 728character (character code 0). 729.It Ic -prune 730This primary always evaluates to true. 731It causes 732.Nm 733to not descend into the current file. 734Note, the 735.Ic -prune 736primary has no effect if the 737.Fl d 738option was specified. 739.It Ic -regex Ar pattern 740True if the whole path of the file matches 741.Ar pattern 742using regular expression. 743To match a file named 744.Dq Pa ./foo/xyzzy , 745you can use the regular expression 746.Dq Li ".*/[xyz]*" 747or 748.Dq Li ".*/foo/.*" , 749but not 750.Dq Li xyzzy 751or 752.Dq Li /foo/ . 753.It Ic -samefile Ar name 754True if the file is a hard link to 755.Ar name . 756If the command option 757.Ic -L 758is specified, it is also true if the file is a symbolic link and 759points to 760.Ar name . 761.It Ic -size Ar n Ns Op Cm ckMGTP 762True if the file's size, rounded up, in 512-byte blocks is 763.Ar n . 764If 765.Ar n 766is followed by a 767.Cm c , 768then the primary is true if the 769file's size is 770.Ar n 771bytes (characters). 772Similarly if 773.Ar n 774is followed by a scale indicator then the file's size is compared to 775.Ar n 776scaled as: 777.Pp 778.Bl -tag -width indent -compact 779.It Cm k 780kilobytes (1024 bytes) 781.It Cm M 782megabytes (1024 kilobytes) 783.It Cm G 784gigabytes (1024 megabytes) 785.It Cm T 786terabytes (1024 gigabytes) 787.It Cm P 788petabytes (1024 terabytes) 789.El 790.It Ic -type Ar t 791True if the file is of the specified type. 792Possible file types are as follows: 793.Pp 794.Bl -tag -width indent -compact 795.It Cm b 796block special 797.It Cm c 798character special 799.It Cm d 800directory 801.It Cm f 802regular file 803.It Cm l 804symbolic link 805.It Cm p 806FIFO 807.It Cm s 808socket 809.El 810.It Ic -uid Ar uname 811The same thing as 812.Ar -user Ar uname 813for compatibility with GNU find. 814GNU find imposes a restriction that 815.Ar uname 816is numeric, while 817.Xr find 1 818does not. 819.It Ic -user Ar uname 820True if the file belongs to the user 821.Ar uname . 822If 823.Ar uname 824is numeric and there is no such user name, then 825.Ar uname 826is treated as a user ID. 827.It Ic -wholename Ar pattern 828The same thing as 829.Ic -path , 830for GNU find compatibility. 831.El 832.Sh OPERATORS 833The primaries may be combined using the following operators. 834The operators are listed in order of decreasing precedence. 835.Pp 836.Bl -tag -width indent -compact 837.It Cm \&( Ar expression Cm \&) 838This evaluates to true if the parenthesized expression evaluates to 839true. 840.Pp 841.It Cm \&! Ar expression 842.It Cm -not Ar expression 843This is the unary 844.Tn NOT 845operator. 846It evaluates to true if the expression is false. 847.Pp 848.It Cm -false 849Always false. 850.It Cm -true 851Always true. 852.Pp 853.It Ar expression Cm -and Ar expression 854.It Ar expression expression 855The 856.Cm -and 857operator is the logical 858.Tn AND 859operator. 860As it is implied by the juxtaposition of two expressions it does not 861have to be specified. 862The expression evaluates to true if both expressions are true. 863The second expression is not evaluated if the first expression is false. 864.Pp 865.It Ar expression Cm -or Ar expression 866The 867.Cm -or 868operator is the logical 869.Tn OR 870operator. 871The expression evaluates to true if either the first or the second expression 872is true. 873The second expression is not evaluated if the first expression is true. 874.El 875.Pp 876All operands and primaries must be separate arguments to 877.Nm . 878Primaries which themselves take arguments expect each argument 879to be a separate argument to 880.Nm . 881.Sh ENVIRONMENT 882The 883.Ev LANG , LC_ALL , LC_COLLATE , LC_CTYPE , LC_MESSAGES 884and 885.Ev LC_TIME 886environment variables affect the execution of the 887.Nm 888utility as described in 889.Xr environ 7 . 890.Sh EXAMPLES 891The following examples are shown as given to the shell: 892.Bl -tag -width indent 893.It Li "find / \e! -name \*q*.c\*q -print" 894Print out a list of all the files whose names do not end in 895.Pa .c . 896.It Li "find / -newer ttt -user wnj -print" 897Print out a list of all the files owned by user 898.Dq wnj 899that are newer 900than the file 901.Pa ttt . 902.It Li "find / \e! \e( -newer ttt -user wnj \e) -print" 903Print out a list of all the files which are not both newer than 904.Pa ttt 905and owned by 906.Dq wnj . 907.It Li "find / \e( -newer ttt -or -user wnj \e) -print" 908Print out a list of all the files that are either owned by 909.Dq wnj 910or that are newer than 911.Pa ttt . 912.It Li "find / -newerct '1 minute ago' -print" 913Print out a list of all the files whose inode change time is more 914recent than the current time minus one minute. 915.It Li "find / -type f -exec echo {} \e;" 916Use the 917.Xr echo 1 918command to print out a list of all the files. 919.It Li "find -L /usr/ports/packages -type l -exec rm -- {} +" 920Delete all broken symbolic links in 921.Pa /usr/ports/packages . 922.It Li "find /usr/src -name CVS -prune -o -depth +6 -print" 923Find files and directories that are at least seven levels deep 924in the working directory 925.Pa /usr/src . 926.It Li "find /usr/src -name CVS -prune -o -mindepth 7 -print" 927Is not equivalent to the previous example, since 928.Ic -prune 929is not evaluated below level seven. 930.El 931.Sh COMPATIBILITY 932The 933.Ic -follow 934primary is deprecated; the 935.Fl L 936option should be used instead. 937See the 938.Sx STANDARDS 939section below for details. 940.Sh SEE ALSO 941.Xr chflags 1 , 942.Xr chmod 1 , 943.Xr cvs 1 , 944.Xr locate 1 , 945.Xr lsvfs 1 , 946.Xr whereis 1 , 947.Xr which 1 , 948.Xr xargs 1 , 949.Xr stat 2 , 950.Xr acl 3 , 951.Xr fts 3 , 952.Xr getgrent 3 , 953.Xr getpwent 3 , 954.Xr strmode 3 , 955.Xr re_format 7 , 956.Xr symlink 7 957.Sh STANDARDS 958The 959.Nm 960utility syntax is a superset of the syntax specified by the 961.St -p1003.1-2001 962standard. 963.Pp 964All the single character options except 965.Fl H 966and 967.Fl L 968as well as 969.Ic -amin , -anewer , -cmin , -cnewer , -delete , -empty , -fstype , 970.Ic -iname , -inum , -iregex , -ls , -maxdepth , -mindepth , -mmin , 971.Ic -path , -print0 , -regex 972and all of the 973.Ic -B* 974birthtime related primaries are extensions to 975.St -p1003.1-2001 . 976.Pp 977Historically, the 978.Fl d , L 979and 980.Fl x 981options were implemented using the primaries 982.Ic -depth , -follow , 983and 984.Ic -xdev . 985These primaries always evaluated to true. 986As they were really global variables that took effect before the traversal 987began, some legal expressions could have unexpected results. 988An example is the expression 989.Ic -print Cm -o Ic -depth . 990As 991.Ic -print 992always evaluates to true, the standard order of evaluation 993implies that 994.Ic -depth 995would never be evaluated. 996This is not the case. 997.Pp 998The operator 999.Cm -or 1000was implemented as 1001.Cm -o , 1002and the operator 1003.Cm -and 1004was implemented as 1005.Cm -a . 1006.Pp 1007Historic implementations of the 1008.Ic -exec 1009and 1010.Ic -ok 1011primaries did not replace the string 1012.Dq Li {} 1013in the utility name or the 1014utility arguments if it had preceding or following non-whitespace characters. 1015This version replaces it no matter where in the utility name or arguments 1016it appears. 1017.Pp 1018The 1019.Fl E 1020option was inspired by the equivalent 1021.Xr grep 1 1022and 1023.Xr sed 1 1024options. 1025.Sh HISTORY 1026A 1027.Nm 1028command appeared in 1029.At v1 . 1030.Sh BUGS 1031The special characters used by 1032.Nm 1033are also special characters to many shell programs. 1034In particular, the characters 1035.Dq Li * , 1036.Dq Li \&[ , 1037.Dq Li \&] , 1038.Dq Li \&? , 1039.Dq Li \&( , 1040.Dq Li \&) , 1041.Dq Li \&! , 1042.Dq Li \e 1043and 1044.Dq Li \&; 1045may have to be escaped from the shell. 1046.Pp 1047As there is no delimiter separating options and file names or file 1048names and the 1049.Ar expression , 1050it is difficult to specify files named 1051.Pa -xdev 1052or 1053.Pa \&! . 1054These problems are handled by the 1055.Fl f 1056option and the 1057.Xr getopt 3 1058.Dq Fl Fl 1059construct. 1060.Pp 1061The 1062.Ic -delete 1063primary does not interact well with other options that cause the file system 1064tree traversal options to be changed. 1065.Pp 1066The 1067.Ic -mindepth 1068and 1069.Ic -maxdepth 1070primaries are actually global options (as documented above). 1071They should 1072probably be replaced by options which look like options. 1073