|
|
1.1 ! root 1: ! 2: ! 3: find Command find ! 4: ! 5: ! 6: ! 7: ! 8: Search for files satisfying a pattern ! 9: ! 10: ffiinndd _d_i_r_e_c_t_o_r_y ... [_e_x_p_r_e_s_s_i_o_n ...] ! 11: ! 12: find traverses each given directory, testing each file or sub- ! 13: directory found with the expression part of the command line. ! 14: The test can be the basis for deciding whether to process the ! 15: file with a given command. ! 16: ! 17: If the command line specifies no expression or specifies no ex- ! 18: ecution or printing (-pprriinntt, -exec, or -ok), by default find ! 19: prints the pathnames of the files found. ! 20: ! 21: In the following, file means any file: directory, special file, ! 22: ordinary file, and so on. Numbers represented by n may be ! 23: optionally prefixed by a `+' or `-' sign to signify values ! 24: greater than n or less than n, respectively. ! 25: ! 26: find recognizes the following expression primitives: ! 27: ! 28: -aattiimmee _n ! 29: Match if the file was accessed in the last n days. ! 30: ! 31: -ccttiimmee _n ! 32: Match if the i-node associated with the file was changed ! 33: in the last n days, as by chmod. ! 34: ! 35: -eexxeecc _c_o_m_m_a_n_d ! 36: Match if command executes successfully (has a zero exit ! 37: status). The command consists of the following arguments ! 38: to find, terminated by a semicolon `;' (escaped to get ! 39: past the shell). find substitutes the current pathname ! 40: being tested for any argument of the form `{}'. ! 41: ! 42: -ggrroouupp _n_a_m_e ! 43: Match if the file is owned by group name. If name is a ! 44: number, the owner must have that group number. ! 45: ! 46: -iinnuumm _n ! 47: Match if the file is associated with i-number n. ! 48: ! 49: -lliinnkkss _n ! 50: Match if the number of links to the file is n. ! 51: ! 52: -mmttiimmee _n ! 53: Match if the most recent modification to the file was n ! 54: days ago. ! 55: ! 56: -nnaammee _p_a_t_t_e_r_n ! 57: Match if the file name corresponds to pattern, which may ! 58: include the special characters `*', `?', and `[...]' ! 59: recognized by the shell sh. The pattern matches only the ! 60: part of the file name after any slash (`/') characters. ! 61: ! 62: ! 63: ! 64: COHERENT Lexicon Page 1 ! 65: ! 66: ! 67: ! 68: ! 69: find Command find ! 70: ! 71: ! 72: ! 73: -nneewweerr _f_i_l_e ! 74: Match if the file is newer than file. ! 75: ! 76: -nnoopp Always match; does nothing. ! 77: ! 78: -ookk _c_o_m_m_a_n_d ! 79: Same as -exec above, except prompt interactively and only ! 80: executes command if the user types response `y'. ! 81: ! 82: -ppeerrmm _o_c_t_a_l ! 83: Match if owner, group, and other permissions of the file ! 84: are the octal bit pattern, as described in chmod. When ! 85: octal begins with a `-' character, more of the permission ! 86: bits (setuid, setgid, and sticky bit) become significant. ! 87: ! 88: -pprriinntt Always match; print the file name. ! 89: ! 90: -ssiizzee _n ! 91: Match if the file is n blocks in length; a block is 512 ! 92: bytes long. ! 93: ! 94: -ttyyppee _c ! 95: Match if the type of the file is c, chosen from the set ! 96: bcdfmp (for block special, character special, directory, ! 97: ordinary file, multiplexed file, or pipe, respectively). ! 98: ! 99: -uusseerr _n_a_m_e ! 100: Match if the file is owned by user name. If name is a ! 101: number, the owner must have that user number. ! 102: ! 103: _e_x_p_1 _e_x_p_2 ! 104: Match if both expressions match. find evaluates exp2 ! 105: only if exp1 matches. ! 106: ! 107: _e_x_p_1 -aa _e_x_p_2 ! 108: Match if both expressions match, as above. ! 109: ! 110: _e_x_p_1 -oo _e_x_p_2 ! 111: Match if either expression matches. find evaluates exp2 ! 112: only if exp1 does not match. ! 113: ! 114: ! _e_x_p Match if the expression does not match. ! 115: ! 116: ( _e_x_p ) ! 117: Parentheses are available for expression grouping. ! 118: ! 119: ***** Examples ***** ! 120: ! 121: A find command to print the names of all files and directories in ! 122: user fred's directory is: ! 123: ! 124: ! 125: ! 126: ! 127: ! 128: ! 129: ! 130: COHERENT Lexicon Page 2 ! 131: ! 132: ! 133: ! 134: ! 135: find Command find ! 136: ! 137: ! 138: ! 139: find /usr/fred ! 140: ! 141: ! 142: The following, more complicated find command prints out informa- ! 143: tion on all core and object (.oo) files that have not been changed ! 144: for a day. Because some characters are special both to find and ! 145: sh, they must be escaped with `\' to avoid interpretation by the ! 146: shell. ! 147: ! 148: ! 149: find / \( -name core -o -name \*.o \) -mtime +1 \ ! 150: -exec ls -l {} \; ! 151: ! 152: ! 153: ***** See Also ***** ! 154: ! 155: chmod, commands, ls, sh, test ! 156: ! 157: ! 158: ! 159: ! 160: ! 161: ! 162: ! 163: ! 164: ! 165: ! 166: ! 167: ! 168: ! 169: ! 170: ! 171: ! 172: ! 173: ! 174: ! 175: ! 176: ! 177: ! 178: ! 179: ! 180: ! 181: ! 182: ! 183: ! 184: ! 185: ! 186: ! 187: ! 188: ! 189: ! 190: ! 191: ! 192: ! 193: ! 194: ! 195: ! 196: COHERENT Lexicon Page 3 ! 197: ! 198:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.