home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / findutils-4.1-bin.lha / man / cat1 / find.1 next >
Text File  |  1996-10-12  |  23KB  |  727 lines

  1.  
  2.  
  3.  
  4. FIND(1L)                                                 FIND(1L)
  5.  
  6.  
  7. NNAAMMEE
  8.        find - search for files in a directory hierarchy
  9.  
  10. SSYYNNOOPPSSIISS
  11.        ffiinndd [path...] [expression]
  12.  
  13. DDEESSCCRRIIPPTTIIOONN
  14.        This  manual page documents the GNU version of ffiinndd.  ffiinndd
  15.        searches the directory tree rooted at each given file name
  16.        by  evaluating  the  given  expression from left to right,
  17.        according to the rules of precedence (see  section  OPERA-
  18.        TORS),  until  the outcome is known (the left hand side is
  19.        false for _a_n_d operations, true for  _o_r),  at  which  point
  20.        ffiinndd moves on to the next file name.
  21.  
  22.        The first argument that begins with `-', `(', `)', `,', or
  23.        `!' is taken to be the beginning of  the  expression;  any
  24.        arguments before it are paths to search, and any arguments
  25.        after it are the rest of the expression.  If no paths  are
  26.        given, the current directory is used.  If no expression is
  27.        given, the expression `-print' is used.
  28.  
  29.        ffiinndd exits with status 0 if all files are  processed  suc-
  30.        cessfully, greater than 0 if errors occur.
  31.  
  32. EEXXPPRREESSSSIIOONNSS
  33.        The expression is made up of options (which affect overall
  34.        operation rather than the processing of a  specific  file,
  35.        and  always  return  true),  tests (which return a true or
  36.        false value), and actions (which  have  side  effects  and
  37.        return a true or false value), all separated by operators.
  38.        -and is assumed where the operator  is  omitted.   If  the
  39.        expression  contains  no actions other than -prune, -print
  40.        is performed on all files  for  which  the  expression  is
  41.        true.
  42.  
  43.    OOPPTTIIOONNSS
  44.        All  options always return true.  They always take effect,
  45.        rather than being processed only when their place  in  the
  46.        expression is reached.  Therefore, for clarity, it is best
  47.        to place them at the beginning of the expression.
  48.  
  49.        -daystart
  50.               Measure times (for -amin,  -atime,  -cmin,  -ctime,
  51.               -mmin,  and  -mtime)  from  the  beginning of today
  52.               rather than from 24 hours ago.
  53.  
  54.        -depth Process each directory's contents before the direc-
  55.               tory itself.
  56.  
  57.        -follow
  58.               Dereference symbolic links.  Implies -noleaf.
  59.  
  60.  
  61.  
  62.  
  63.  
  64.                                                                 1
  65.  
  66.  
  67.  
  68.  
  69.  
  70. FIND(1L)                                                 FIND(1L)
  71.  
  72.  
  73.        -help, --help
  74.               Print  a  summary of the command-line usage of ffiinndd
  75.               and exit.
  76.  
  77.        -maxdepth _l_e_v_e_l_s
  78.               Descend at most  _l_e_v_e_l_s  (a  non-negative  integer)
  79.               levels  of directories below the command line argu-
  80.               ments.  `-maxdepth 0' means only  apply  the  tests
  81.               and actions to the command line arguments.
  82.  
  83.        -mindepth _l_e_v_e_l_s
  84.               Do  not  apply  any tests or actions at levels less
  85.               than _l_e_v_e_l_s (a non-negative  integer).   `-mindepth
  86.               1'  means process all files except the command line
  87.               arguments.
  88.  
  89.        -mount Don't descend directories on other filesystems.  An
  90.               alternate  name  for  -xdev, for compatibility with
  91.               some other versions of ffiinndd.
  92.  
  93.        -noleaf
  94.               Do not optimize by assuming that  directories  con-
  95.               tain  2  fewer  subdirectories than their hard link
  96.               count.   This  option  is  needed  when   searching
  97.               filesystems  that do not follow the Unix directory-
  98.               link convention, such as CD-ROM or MS-DOS  filesys-
  99.               tems or AFS volume mount points.  Each directory on
  100.               a normal Unix filesystem has at least 2 hard links:
  101.               its  name  and  its  `.'  entry.  Additionally, its
  102.               subdirectories (if any) each  have  a  `..'   entry
  103.               linked to that directory.  When ffiinndd is examining a
  104.               directory, after it has statted 2 fewer subdirecto-
  105.               ries than the directory's link count, it knows that
  106.               the rest of the entries in the directory  are  non-
  107.               directories  (`leaf'  files in the directory tree).
  108.               If only the files' names need to be examined, there
  109.               is  no  need to stat them; this gives a significant
  110.               increase in search speed.
  111.  
  112.        -version, --version
  113.               Print the ffiinndd version number and exit.
  114.  
  115.        -xdev  Don't descend directories on other filesystems.
  116.  
  117.    TTEESSTTSS
  118.        Numeric arguments can be specified as
  119.  
  120.        _+_n     for greater than _n,
  121.  
  122.        _-_n     for less than _n,
  123.  
  124.        _n      for exactly _n.
  125.  
  126.  
  127.  
  128.  
  129.  
  130.                                                                 2
  131.  
  132.  
  133.  
  134.  
  135.  
  136. FIND(1L)                                                 FIND(1L)
  137.  
  138.  
  139.        -amin _n
  140.               File was last accessed _n minutes ago.
  141.  
  142.        -anewer _f_i_l_e
  143.               File was last accessed more recently than _f_i_l_e  was
  144.               modified.   -anewer  is affected by -follow only if
  145.               -follow comes before -anewer on the command line.
  146.  
  147.        -atime _n
  148.               File was last accessed _n*24 hours ago.
  149.  
  150.        -cmin _n
  151.               File's status was last changed _n minutes ago.
  152.  
  153.        -cnewer _f_i_l_e
  154.               File's status was last changed more  recently  than
  155.               _f_i_l_e  was modified.  -cnewer is affected by -follow
  156.               only if -follow comes before -cnewer on the command
  157.               line.
  158.  
  159.        -ctime _n
  160.               File's status was last changed _n*24 hours ago.
  161.  
  162.        -empty File  is  empty  and  is either a regular file or a
  163.               directory.
  164.  
  165.        -false Always false.
  166.  
  167.        -fstype _t_y_p_e
  168.               File is on a filesystem of type  _t_y_p_e.   The  valid
  169.               filesystem  types  vary among different versions of
  170.               Unix; an incomplete list of filesystem  types  that
  171.               are accepted on some version of Unix or another is:
  172.               ufs, 4.2, 4.3, nfs, tmp, mfs, S51K, S52K.  You  can
  173.               use  -printf with the %F directive to see the types
  174.               of your filesystems.
  175.  
  176.        -gid _n File's numeric group ID is _n.
  177.  
  178.        -group _g_n_a_m_e
  179.               File belongs  to  group  _g_n_a_m_e  (numeric  group  ID
  180.               allowed).
  181.  
  182.        -ilname _p_a_t_t_e_r_n
  183.               Like -lname, but the match is case insensitive.
  184.  
  185.        -iname _p_a_t_t_e_r_n
  186.               Like -name, but the match is case insensitive.  For
  187.               example, the patterns `fo*'  and  `F??'  match  the
  188.               file names `Foo', `FOO', `foo', `fOo', etc.
  189.  
  190.        -inum _n
  191.               File has inode number _n.
  192.  
  193.  
  194.  
  195.  
  196.                                                                 3
  197.  
  198.  
  199.  
  200.  
  201.  
  202. FIND(1L)                                                 FIND(1L)
  203.  
  204.  
  205.        -ipath _p_a_t_t_e_r_n
  206.               Like -path, but the match is case insensitive.
  207.  
  208.        -iregex _p_a_t_t_e_r_n
  209.               Like -regex, but the match is case insensitive.
  210.  
  211.        -links _n
  212.               File has _n links.
  213.  
  214.        -lname _p_a_t_t_e_r_n
  215.               File  is a symbolic link whose contents match shell
  216.               pattern _p_a_t_t_e_r_n.  The metacharacters do  not  treat
  217.               `/' or `.' specially.
  218.  
  219.        -mmin _n
  220.               File's data was last modified _n minutes ago.
  221.  
  222.        -mtime _n
  223.               File's data was last modified _n*24 hours ago.
  224.  
  225.        -name _p_a_t_t_e_r_n
  226.               Base of file name (the path with the leading direc-
  227.               tories removed) matches shell pattern _p_a_t_t_e_r_n.  The
  228.               metacharacters  (`*', `?', and `[]') do not match a
  229.               `.' at the start of the base  name.   To  ignore  a
  230.               directory  and  the files under it, use -prune; see
  231.               an example in the description of -path.
  232.  
  233.        -newer _f_i_l_e
  234.               File was modified more recently than _f_i_l_e.   -newer
  235.               is affected by -follow only if -follow comes before
  236.               -newer on the command line.
  237.  
  238.        -nouser
  239.               No user corresponds to file's numeric user ID.
  240.  
  241.        -nogroup
  242.               No group corresponds to file's numeric group ID.
  243.  
  244.        -path _p_a_t_t_e_r_n
  245.               File  name  matches  shell  pattern  _p_a_t_t_e_r_n.   The
  246.               metacharacters  do  not treat `/' or `.' specially;
  247.               so, for example,
  248.                         find . -path './sr*sc'
  249.               will  print  an  entry  for  a   directory   called
  250.               './src/misc'  (if  one  exists).  To ignore a whole
  251.               directory tree, use  -prune  rather  than  checking
  252.               every  file  in the tree.  For example, to skip the
  253.               directory `src/emacs' and all files and directories
  254.               under  it,  and  print the names of the other files
  255.               found, do something like this:
  256.                         find  .  -path  './src/emacs'  -prune  -o
  257.                         -print
  258.  
  259.  
  260.  
  261.  
  262.                                                                 4
  263.  
  264.  
  265.  
  266.  
  267.  
  268. FIND(1L)                                                 FIND(1L)
  269.  
  270.  
  271.        -perm _m_o_d_e
  272.               File's  permission  bits are exactly _m_o_d_e (octal or
  273.               symbolic).  Symbolic modes use mode 0 as a point of
  274.               departure.
  275.  
  276.        -perm -_m_o_d_e
  277.               All  of  the  permission  bits _m_o_d_e are set for the
  278.               file.
  279.  
  280.        -perm +_m_o_d_e
  281.               Any of the permission bits _m_o_d_e  are  set  for  the
  282.               file.
  283.  
  284.        -regex _p_a_t_t_e_r_n
  285.               File name matches regular expression _p_a_t_t_e_r_n.  This
  286.               is a match on the whole path, not  a  search.   For
  287.               example,  to match a file named `./fubar3', you can
  288.               use the regular expression  `.*bar.'  or  `.*b.*3',
  289.               but not `b.*r3'.
  290.  
  291.        -size _n[bckw]
  292.               File uses _n units of space.  The units are 512-byte
  293.               blocks by default or if `b' follows _n, bytes if `c'
  294.               follows  _n,  kilobytes  if `k' follows _n, or 2-byte
  295.               words if `w' follows _n.  The size  does  not  count
  296.               indirect blocks, but it does count blocks in sparse
  297.               files that are not actually allocated.
  298.  
  299.        -true  Always true.
  300.  
  301.        -type _c
  302.               File is of type _c:
  303.  
  304.               b      block (buffered) special
  305.  
  306.               c      character (unbuffered) special
  307.  
  308.               d      directory
  309.  
  310.               p      named pipe (FIFO)
  311.  
  312.               f      regular file
  313.  
  314.               l      symbolic link
  315.  
  316.               s      socket
  317.  
  318.        -uid _n File's numeric user ID is _n.
  319.  
  320.        -used _n
  321.               File was last accessed _n days after its status  was
  322.               last changed.
  323.  
  324.  
  325.  
  326.  
  327.  
  328.                                                                 5
  329.  
  330.  
  331.  
  332.  
  333.  
  334. FIND(1L)                                                 FIND(1L)
  335.  
  336.  
  337.        -user _u_n_a_m_e
  338.               File  is  owned  by  user  _u_n_a_m_e  (numeric  user ID
  339.               allowed).
  340.  
  341.        -xtype _c
  342.               The same as -type unless the  file  is  a  symbolic
  343.               link.   For symbolic links: if -follow has not been
  344.               given, true if the file is a link to a file of type
  345.               _c; if -follow has been given, true if _c is `l'.  In
  346.               other words, for symbolic links, -xtype checks  the
  347.               type of the file that -type does not check.
  348.  
  349.    AACCTTIIOONNSS
  350.        -exec _c_o_m_m_a_n_d ;
  351.               Execute _c_o_m_m_a_n_d; true if 0 status is returned.  All
  352.               following arguments to ffiinndd are taken to  be  argu-
  353.               ments  to  the command until an argument consisting
  354.               of `;' is encountered.  The string `{}' is replaced
  355.               by the current file name being processed everywhere
  356.               it occurs in the arguments to the command, not just
  357.               in arguments where it is alone, as in some versions
  358.               of ffiinndd.  Both of these constructions might need to
  359.               be  escaped  (with a `\') or quoted to protect them
  360.               from expansion by the shell.  The command  is  exe-
  361.               cuted in the starting directory.
  362.  
  363.        -fls _f_i_l_e
  364.               True; like -ls but write to _f_i_l_e like -fprint.
  365.  
  366.        -fprint _f_i_l_e
  367.               True;  print the full file name into file _f_i_l_e.  If
  368.               _f_i_l_e does not exist when ffiinndd is run,  it  is  cre-
  369.               ated;  if it does exist, it is truncated.  The file
  370.               names ``/dev/stdout'' and ``/dev/stderr'' are  han-
  371.               dled  specially;  they refer to the standard output
  372.               and standard error output, respectively.
  373.  
  374.        -fprint0 _f_i_l_e
  375.               True; like -print0 but write to _f_i_l_e like  -fprint.
  376.  
  377.        -fprintf _f_i_l_e _f_o_r_m_a_t
  378.               True;  like -printf but write to _f_i_l_e like -fprint.
  379.  
  380.        -ok _c_o_m_m_a_n_d ;
  381.               Like -exec but ask the user first (on the  standard
  382.               input);  if the response does not start with `y' or
  383.               `Y', do not run the command, and return false.
  384.  
  385.        -print True; print the full file name on the standard out-
  386.               put, followed by a newline.
  387.  
  388.        -print0
  389.               True; print the full file name on the standard out-
  390.               put, followed by a  null  character.   This  allows
  391.  
  392.  
  393.  
  394.                                                                 6
  395.  
  396.  
  397.  
  398.  
  399.  
  400. FIND(1L)                                                 FIND(1L)
  401.  
  402.  
  403.               file  names  that  contain newlines to be correctly
  404.               interpreted by programs that process the ffiinndd  out-
  405.               put.
  406.  
  407.        -printf _f_o_r_m_a_t
  408.               True;  print  _f_o_r_m_a_t on the standard output, inter-
  409.               preting `\'  escapes  and  `%'  directives.   Field
  410.               widths  and precisions can be specified as with the
  411.               `printf' C function.  Unlike -print,  -printf  does
  412.               not  add  a  newline at the end of the string.  The
  413.               escapes and directives are:
  414.  
  415.               \a     Alarm bell.
  416.  
  417.               \b     Backspace.
  418.  
  419.               \c     Stop printing from this  format  immediately
  420.                      and flush the output.
  421.  
  422.               \f     Form feed.
  423.  
  424.               \n     Newline.
  425.  
  426.               \r     Carriage return.
  427.  
  428.               \t     Horizontal tab.
  429.  
  430.               \v     Vertical tab.
  431.  
  432.               \\     A literal backslash (`\').
  433.  
  434.               A  `\' character followed by any other character is
  435.               treated as an ordinary character, so they both  are
  436.               printed.
  437.  
  438.               %%     A literal percent sign.
  439.  
  440.               %a     File's   last  access  time  in  the  format
  441.                      returned by the C `ctime' function.
  442.  
  443.               %A_k    File's last access time in the format speci-
  444.                      fied  by  _k, which is either `@' or a direc-
  445.                      tive for the  C  `strftime'  function.   The
  446.                      possible values for _k are listed below; some
  447.                      of them might not be available on  all  sys-
  448.                      tems,   due  to  differences  in  `strftime'
  449.                      between systems.
  450.  
  451.                       @      seconds since Jan.  1,  1970,  00:00
  452.                              GMT.
  453.  
  454.                      Time fields:
  455.  
  456.                       H      hour (00..23)
  457.  
  458.  
  459.  
  460.                                                                 7
  461.  
  462.  
  463.  
  464.  
  465.  
  466. FIND(1L)                                                 FIND(1L)
  467.  
  468.  
  469.                       I      hour (01..12)
  470.  
  471.                       k      hour ( 0..23)
  472.  
  473.                       l      hour ( 1..12)
  474.  
  475.                       M      minute (00..59)
  476.  
  477.                       p      locale's AM or PM
  478.  
  479.                       r      time, 12-hour (hh:mm:ss [AP]M)
  480.  
  481.                       S      second (00..61)
  482.  
  483.                       T      time, 24-hour (hh:mm:ss)
  484.  
  485.                       X      locale's time representation (H:M:S)
  486.  
  487.                       Z      time zone (e.g., EDT), or nothing if
  488.                              no time zone is determinable
  489.  
  490.                      Date fields:
  491.  
  492.                       a      locale's  abbreviated  weekday  name
  493.                              (Sun..Sat)
  494.  
  495.                       A      locale's full weekday name, variable
  496.                              length (Sunday..Saturday)
  497.  
  498.                       b      locale's   abbreviated   month  name
  499.                              (Jan..Dec)
  500.  
  501.                       B      locale's full month  name,  variable
  502.                              length (January..December)
  503.  
  504.                       c      locale's  date  and time (Sat Nov 04
  505.                              12:02:33 EST 1989)
  506.  
  507.                       d      day of month (01..31)
  508.  
  509.                       D      date (mm/dd/yy)
  510.  
  511.                       h      same as b
  512.  
  513.                       j      day of year (001..366)
  514.  
  515.                       m      month (01..12)
  516.  
  517.                       U      week number of year with  Sunday  as
  518.                              first day of week (00..53)
  519.  
  520.                       w      day of week (0..6)
  521.  
  522.                       W      week  number  of year with Monday as
  523.  
  524.  
  525.  
  526.                                                                 8
  527.  
  528.  
  529.  
  530.  
  531.  
  532. FIND(1L)                                                 FIND(1L)
  533.  
  534.  
  535.                              first day of week (00..53)
  536.  
  537.                       x      locale's     date     representation
  538.                              (mm/dd/yy)
  539.  
  540.                       y      last two digits of year (00..99)
  541.  
  542.                       Y      year (1970...)
  543.  
  544.               %b     File's size in 512-byte blocks (rounded up).
  545.  
  546.               %c     File's last status change time in the format
  547.                      returned by the C `ctime' function.
  548.  
  549.               %C_k    File's last status change time in the format
  550.                      specified by _k, which is the same as for %A.
  551.  
  552.               %d     File's  depth in the directory tree; 0 means
  553.                      the file is a command line argument.
  554.  
  555.               %f     File's name  with  any  leading  directories
  556.                      removed (only the last element).
  557.  
  558.               %F     Type  of the filesystem the file is on; this
  559.                      value can be used for -fstype.
  560.  
  561.               %g     File's group name, or numeric  group  ID  if
  562.                      the group has no name.
  563.  
  564.               %G     File's numeric group ID.
  565.  
  566.               %h     Leading  directories of file's name (all but
  567.                      the last element).
  568.  
  569.               %H     Command line argument under which  file  was
  570.                      found.
  571.  
  572.               %i     File's inode number (in decimal).
  573.  
  574.               %k     File's size in 1K blocks (rounded up).
  575.  
  576.               %l     Object  of  symbolic  link  (empty string if
  577.                      file is not a symbolic link).
  578.  
  579.               %m     File's permission bits (in octal).
  580.  
  581.               %n     Number of hard links to file.
  582.  
  583.               %p     File's name.
  584.  
  585.               %P     File's name with the  name  of  the  command
  586.                      line  argument  under  which  it  was  found
  587.                      removed.
  588.  
  589.  
  590.  
  591.  
  592.                                                                 9
  593.  
  594.  
  595.  
  596.  
  597.  
  598. FIND(1L)                                                 FIND(1L)
  599.  
  600.  
  601.               %s     File's size in bytes.
  602.  
  603.               %t     File's last modification time in the  format
  604.                      returned by the C `ctime' function.
  605.  
  606.               %T_k    File's  last modification time in the format
  607.                      specified by _k, which is the same as for %A.
  608.  
  609.               %u     File's  user name, or numeric user ID if the
  610.                      user has no name.
  611.  
  612.               %U     File's numeric user ID.
  613.  
  614.               A `%' character followed by any other character  is
  615.               discarded (but the other character is printed).
  616.  
  617.        -prune If  -depth  is  not given, true; do not descend the
  618.               current directory.
  619.               If -depth is given, false; no effect.
  620.  
  621.        -ls    True; list current file in  `ls  -dils'  format  on
  622.               standard  output.   The  block  counts  are  of  1K
  623.               blocks,    unless    the    environment    variable
  624.               POSIXLY_CORRECT  is  set,  in  which  case 512-byte
  625.               blocks are used.
  626.  
  627.    OOPPEERRAATTOORRSS
  628.        Listed in order of decreasing precedence:
  629.  
  630.        ( _e_x_p_r )
  631.               Force precedence.
  632.  
  633.        ! _e_x_p_r True if _e_x_p_r is false.
  634.  
  635.        -not _e_x_p_r
  636.               Same as ! _e_x_p_r.
  637.  
  638.        _e_x_p_r_1 _e_x_p_r_2
  639.               And (implied); _e_x_p_r_2 is not evaluated if  _e_x_p_r_1  is
  640.               false.
  641.  
  642.        _e_x_p_r_1 -a _e_x_p_r_2
  643.               Same as _e_x_p_r_1 _e_x_p_r_2.
  644.  
  645.        _e_x_p_r_1 -and _e_x_p_r_2
  646.               Same as _e_x_p_r_1 _e_x_p_r_2.
  647.  
  648.        _e_x_p_r_1 -o _e_x_p_r_2
  649.               Or; _e_x_p_r_2 is not evaluated if _e_x_p_r_1 is true.
  650.  
  651.        _e_x_p_r_1 -or _e_x_p_r_2
  652.               Same as _e_x_p_r_1 -o _e_x_p_r_2.
  653.  
  654.  
  655.  
  656.  
  657.  
  658.                                                                10
  659.  
  660.  
  661.  
  662.  
  663.  
  664. FIND(1L)                                                 FIND(1L)
  665.  
  666.  
  667.        _e_x_p_r_1 , _e_x_p_r_2
  668.               List;  both  _e_x_p_r_1  and _e_x_p_r_2 are always evaluated.
  669.               The value of _e_x_p_r_1 is discarded; the value  of  the
  670.               list is the value of _e_x_p_r_2.
  671.  
  672. SSEEEE AALLSSOO
  673.        llooccaattee(1L),  llooccaatteeddbb(5L), uuppddaatteeddbb(1L), xxaarrggss(1L) FFiinnddiinngg
  674.        FFiilleess (on-line in Info, or printed)
  675.  
  676.  
  677.  
  678.  
  679.  
  680.  
  681.  
  682.  
  683.  
  684.  
  685.  
  686.  
  687.  
  688.  
  689.  
  690.  
  691.  
  692.  
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.                                                                11
  725.  
  726.  
  727.