home *** CD-ROM | disk | FTP | other *** search
/ Aminet 4 / Aminet 4 - November 1994.iso / aminet / dev / gcc / gcc260utilsdoc.lha / gnu / man / man1 / find.1 < prev    next >
Encoding:
Text File  |  1994-07-31  |  18.8 KB  |  661 lines

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