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