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