home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / gnustuff / tos / futils / futils~1 / man / manpages.zoo / find.1 < prev    next >
Encoding:
Text File  |  1991-11-12  |  14.7 KB  |  595 lines

  1.  
  2.  
  3.  
  4. FIND(1L)                                                 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 pathname by
  17.      evaluating the given expression from left to right, accord-
  18.      ing to the rules of precedence (see section OPERATORS),
  19.      until the outcome is known (left hand side false for _✓a_✓n_✓d
  20.      operations, true for _✓o_✓r), at which point find moves on to
  21.      the next pathname.
  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.  
  45.      -daystart
  46.           Measure times (for -amin, -atime, -cmin, -ctime, -mmin,
  47.           and -mtime) from the beginning of today rather than
  48.           from 24 hours ago.
  49.  
  50.      -depth
  51.           Process each directory's contents before the directory
  52.           itself.
  53.  
  54.      -follow
  55.           Dereference symbolic links.
  56.  
  57.      -maxdepth _✓l_✓e_✓v_✓e_✓l_✓s
  58.           Descend at most _✓l_✓e_✓v_✓e_✓l_✓s (a non-negative integer) levels
  59.           of directories below the command line arguments.
  60.  
  61.  
  62.  
  63. Page 1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. FIND(1L)                                                 FIND(1L)
  71.  
  72.  
  73.  
  74.           `-maxdepth 0' means only apply the tests and actions to
  75.           the command line arguments.
  76.  
  77.      -mindepth _✓l_✓e_✓v_✓e_✓l_✓s
  78.           Do not apply any tests or actions at levels less than
  79.           _✓l_✓e_✓v_✓e_✓l_✓s (a non-negative integer).  `-mindepth 1' means
  80.           process all files except the command line arguments.
  81.  
  82.      -version
  83.           True; print find version number on standard error.
  84.  
  85.      -xdev
  86.           True; don't descend directories on other filesystems.
  87.  
  88.      TESTS
  89.  
  90.      Numeric arguments can be specified as
  91.  
  92.      +_✓n   for greater than _✓n,
  93.  
  94.      -_✓n   for less than _✓n,
  95.  
  96.      _✓n    for exactly _✓n.
  97.  
  98.      -amin _✓n
  99.           File was last accessed _✓n minutes ago.
  100.  
  101.      -anewer _✓f_✓i_✓l_✓e
  102.           File was last accessed more recently than _✓f_✓i_✓l_✓e was
  103.           modified.  -anewer is affected by -follow only if -fol-
  104.           low comes before -anewer on the command line.
  105.  
  106.      -atime _✓n
  107.           File was last accessed _✓n*24 hours ago.
  108.  
  109.      -cmin _✓n
  110.           File's status was last changed _✓n minutes ago.
  111.  
  112.      -cnewer _✓f_✓i_✓l_✓e
  113.           File's status was last changed more recently than _✓f_✓i_✓l_✓e
  114.           was modified.  -cnewer is affected by -follow only if
  115.           -follow comes before -cnewer on the command line.
  116.  
  117.      -ctime _✓n
  118.           File's status was last changed _✓n*24 hours ago.
  119.  
  120.      -empty
  121.           File is empty and is either a regular file or a direc-
  122.           tory.
  123.  
  124.      -false
  125.           Always false.
  126.  
  127.  
  128.  
  129. Page 2
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. FIND(1L)                                                 FIND(1L)
  137.  
  138.  
  139.  
  140.      -fstype _✓t_✓y_✓p_✓e
  141.           File is on a filesystem of type _✓t_✓y_✓p_✓e.  The valid
  142.           filesystem types vary among different versions of Unix;
  143.           an incomplete list of filesystem types that are
  144.           accepted on some version of Unix or another is: ufs,
  145.           4.2, 4.3, nfs, tmp, mfs, S51K, S52K.
  146.  
  147.      -gid _✓n
  148.           File's numeric group ID is _✓n.
  149.  
  150.      -group _✓g_✓n_✓a_✓m_✓e
  151.           File belongs to group _✓g_✓n_✓a_✓m_✓e (numeric group ID allowed).
  152.  
  153.      -inum _✓n
  154.           File has inode number _✓n.
  155.  
  156.      -links _✓n
  157.           File has _✓n links.
  158.  
  159.      -lname _✓p_✓a_✓t_✓t_✓e_✓r_✓n
  160.           File is a symbolic link whose contents match shell pat-
  161.           tern _✓p_✓a_✓t_✓t_✓e_✓r_✓n.  `*' and `?' match `.' at the start of
  162.           the link contents.  Slash characters have no special
  163.           meaning in the comparison.
  164.  
  165.      -mmin _✓n
  166.           File's data was last modified _✓n minutes ago.
  167.  
  168.      -mtime _✓n
  169.           File's data was last modified _✓n*24 hours ago.
  170.  
  171.      -name _✓p_✓a_✓t_✓t_✓e_✓r_✓n
  172.           Base of path name (the path with the leading direc-
  173.           tories removed) matches shell pattern _✓p_✓a_✓t_✓t_✓e_✓r_✓n.  `*' and
  174.           `?' do not match `.' at the start of the filename.
  175.  
  176.      -newer _✓f_✓i_✓l_✓e
  177.           File was modified more recently than _✓f_✓i_✓l_✓e.  -newer is
  178.           affected by -follow only if -follow comes before -newer
  179.           on the command line.
  180.  
  181.      -nouser
  182.           No user corresponds to file's numeric user ID.
  183.  
  184.      -nogroup
  185.           No group corresponds to file's numeric group ID.
  186.  
  187.      -perm _✓m_✓o_✓d_✓e
  188.           File's permission bits are exactly _✓m_✓o_✓d_✓e (octal or sym-
  189.           bolic).
  190.  
  191.      -perm -_✓m_✓o_✓d_✓e
  192.  
  193.  
  194.  
  195. Page 3
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. FIND(1L)                                                 FIND(1L)
  203.  
  204.  
  205.  
  206.           Permission bits _✓m_✓o_✓d_✓e are set for the file.
  207.  
  208.      -regex _✓p_✓a_✓t_✓t_✓e_✓r_✓n
  209.           Pathname matches regular expression _✓p_✓a_✓t_✓t_✓e_✓r_✓n.
  210.  
  211.      -size _✓n[ck]
  212.           File uses _✓n 512-byte blocks (bytes if `c' follows _✓n,
  213.           kilobytes if `k' follows _✓n).  The size does not count
  214.           indirect blocks, and does count blocks in sparse files
  215.           that are not actually allocated.
  216.  
  217.      -true
  218.           Always true.
  219.  
  220.      -type _✓c
  221.           File is of type _✓c:
  222.  
  223.           b    block (buffered) character
  224.  
  225.           c    character (unbuffered) character
  226.  
  227.           d    directory
  228.  
  229.           p    named pipe (FIFO)
  230.  
  231.           f    regular file
  232.  
  233.           l    symbolic link
  234.  
  235.           s    socket
  236.  
  237.      -uid _✓n
  238.           File's numeric user ID is _✓n.
  239.  
  240.      -used _✓n
  241.           File was last accessed _✓n days after its status was last
  242.           changed.
  243.  
  244.      -user _✓u_✓n_✓a_✓m_✓e
  245.           File is owned by user _✓u_✓n_✓a_✓m_✓e (numeric user ID allowed).
  246.  
  247.      -xtype _✓c
  248.           The same as -type unless the file is a symbolic link.
  249.           For symbolic links, if -follow has not been given, true
  250.           if the file is a link to a file of type _✓c; if -follow
  251.           has been given, true if _✓c is `l'.  For symbolic links,
  252.           -xtype checks the type of the file that -type does not
  253.           check.
  254.  
  255.      ACTIONS
  256.  
  257.      -exec _✓c_✓o_✓m_✓m_✓a_✓n_✓d ;
  258.  
  259.  
  260.  
  261. Page 4
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. FIND(1L)                                                 FIND(1L)
  269.  
  270.  
  271.  
  272.           Execute _✓c_✓o_✓m_✓m_✓a_✓n_✓d; true if 0 status is returned.  All
  273.           following arguments to find are taken to be arguments
  274.           to the command until an argument consisting of `;' is
  275.           encountered.  The string `{}' is replaced by the
  276.           current pathname being processed everywhere it occurs
  277.           in the arguments to the command.  Both of these con-
  278.           structions might need to be escaped (with a `\') or
  279.           quoted to protect them from expansion by the shell.
  280.  
  281.      -fprint _✓f_✓i_✓l_✓e
  282.           True; print the full pathname into file _✓f_✓i_✓l_✓e.  If _✓f_✓i_✓l_✓e
  283.           does not exist when find is run, it is created; if it
  284.           does exist, it is truncated.  The filenames
  285.           ``/dev/stdout'' and ``/dev/stderr'' are handled spe-
  286.           cially; they refer to the standard output and standard
  287.           error output, respectively.
  288.  
  289.      -fprint0 _✓f_✓i_✓l_✓e
  290.           True; like -print0 but write to _✓f_✓i_✓l_✓e like -fprint.
  291.  
  292.      -fprintf _✓f_✓i_✓l_✓e _✓f_✓o_✓r_✓m_✓a_✓t
  293.           True; like -printf but write to _✓f_✓i_✓l_✓e like -fprint.
  294.  
  295.      -ok _✓c_✓o_✓m_✓m_✓a_✓n_✓d ;
  296.           Like -exec but ask user first; if the response does not
  297.           start with `y' or `Y', do not run the command, and
  298.           return false.
  299.  
  300.      -print
  301.           True; print the full pathname on the standard output,
  302.           followed by a newline.
  303.  
  304.      -print0
  305.           True; print the full pathname on the standard output,
  306.           followed by a null character.  This allows filenames
  307.           that contain newlines to be correctly interpreted by
  308.           programs that process the find output.
  309.  
  310.      -printf _✓f_✓o_✓r_✓m_✓a_✓t
  311.           True; print _✓f_✓o_✓r_✓m_✓a_✓t on the standard output, interpreting
  312.           `\' escapes and `%' directives.  Field widths and pre-
  313.           cisions can be specified as with the `printf' C func-
  314.           tion.  The escapes and directives are:
  315.  
  316.           \a   Alarm bell.
  317.  
  318.           \b   Backspace.
  319.  
  320.           \c   Stop printing from this format immediately.
  321.  
  322.           \f   Form feed.
  323.  
  324.  
  325.  
  326.  
  327. Page 5
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. FIND(1L)                                                 FIND(1L)
  335.  
  336.  
  337.  
  338.           \n   Newline.
  339.  
  340.           \r   Carriage return.
  341.  
  342.           \t   Horizontal tab.
  343.  
  344.           \v   Vertical tab.
  345.  
  346.           A `\' character followed by any other character is
  347.           treated as an ordinary character, so they both are
  348.           printed.
  349.  
  350.           %%   A literal percent sign.
  351.  
  352.           %a   File's last access time in the format returned by
  353.                the C `ctime' function.
  354.  
  355.           %A_✓k  File's last access time in the format specified by
  356.                _✓k, which is either `@' or a directive for the C
  357.                `strftime' function.  The possible values for _✓k
  358.                are listed below; some of them might not be avail-
  359.                able on all systems, due to differences in
  360.                `strftime' between systems.
  361.  
  362.                @    seconds since Jan. 1, 1970, 00:00 GMT.
  363.  
  364.                Time fields:
  365.  
  366.                H    hour (00..23)
  367.  
  368.                I    hour (00..12)
  369.  
  370.                M    minute (00..59)
  371.  
  372.                p    locale's AM or PM
  373.  
  374.                r    time, 12-hour (hh:mm:ss [AP]M)
  375.  
  376.                S    second (00..61)
  377.  
  378.                T    time, 24-hour (hh:mm:ss)
  379.  
  380.                X    locale's time representation (H:M:S)
  381.  
  382.                Z    time zone (e.g., EDT), or nothing if no time
  383.                     zone is determinable
  384.  
  385.                Date fields:
  386.  
  387.                a    locale's abbreviated weekday name (Sun..Sat)
  388.  
  389.                A    locale's full weekday name, variable length
  390.  
  391.  
  392.  
  393. Page 6
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400. FIND(1L)                                                 FIND(1L)
  401.  
  402.  
  403.  
  404.                     (Sunday..Saturday)
  405.  
  406.                b    locale's abbreviated month name (Jan..Dec)
  407.  
  408.                B    locale's full month name, variable length
  409.                     (January..December)
  410.  
  411.                c    locale's date and time (Sat Nov 04 12:02:33
  412.                     EST 1989)
  413.  
  414.                d    day of month (01..31)
  415.  
  416.                D    date (mm/dd/yy)
  417.  
  418.                h    same as b
  419.  
  420.                j    day of year (001..366)
  421.  
  422.                m    month (01..12)
  423.  
  424.                U    week number of year with Sunday as first day
  425.                     of week (00..53)
  426.  
  427.                w    day of week (0..6)
  428.  
  429.                W    week number of year with Monday as first day
  430.                     of week (00..53)
  431.  
  432.                x    locale's date representation (mm/dd/yy)
  433.  
  434.                y    last two digits of year (00..99)
  435.  
  436.                Y    year (1970...)
  437.  
  438.           %b   File's size in 512-byte blocks (rounded up).
  439.  
  440.           %c   File's last status change time in the format
  441.                returned by the C `ctime' function.
  442.  
  443.           %C_✓k  File's last status change time in the format
  444.                specified by _✓k, which is the same as for %A.
  445.  
  446.           %d   File's depth in the directory tree; 0 means the
  447.                file is a command line argument.
  448.  
  449.           %f   File's pathname with any leading directories
  450.                removed.
  451.  
  452.           %g   File's group name, or numeric group ID if the
  453.                group has no name.
  454.  
  455.           %G   File's numeric group ID.
  456.  
  457.  
  458.  
  459. Page 7
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466. FIND(1L)                                                 FIND(1L)
  467.  
  468.  
  469.  
  470.           %h   Leading directories of file's pathname.
  471.  
  472.           %H   Command line argument under which file was found.
  473.  
  474.           %i   File's inode number (in decimal).
  475.  
  476.           %k   File's size in 1K blocks (rounded up).
  477.  
  478.           %l   Object of symbolic link (empty string if file is
  479.                not a symbolic link).
  480.  
  481.           %m   File's permission bits (in octal).
  482.  
  483.           %n   Number of hard links to file.
  484.  
  485.           %p   File's pathname.
  486.  
  487.           %P   File's pathname with the name of the command line
  488.                argument under which it was found removed.
  489.  
  490.           %s   File's size in bytes.
  491.  
  492.           %t   File's last modification time in the format
  493.                returned by the C `ctime' function.
  494.  
  495.           %T_✓k  File's last modification time in the format speci-
  496.                fied by _✓k, which is the same as for %A.
  497.  
  498.           %u   File's user name, or numeric user ID if the user
  499.                has no name.
  500.  
  501.           %U   File's numeric user ID.
  502.  
  503.           A `%' character followed by any other character is dis-
  504.           carded (but the other character is printed).
  505.  
  506.      -prune
  507.           If -depth is not given, true; do not descend the
  508.           current directory.
  509.           If -depth is given, false; no effect.
  510.  
  511.      -ls  True; list current file in `ls -dils' format on stan-
  512.           dard output.  The block counts are of 1K blocks, unless
  513.           the environment variable POSIX_ME_HARDER is set, in
  514.           which case 512-byte blocks are used.
  515.  
  516.      OPERATORS
  517.  
  518.      Listed in order of decreasing precendence:
  519.  
  520.      ( _✓e_✓x_✓p_✓r )
  521.           Force precedence.
  522.  
  523.  
  524.  
  525. Page 8
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532. FIND(1L)                                                 FIND(1L)
  533.  
  534.  
  535.  
  536.      ! _✓e_✓x_✓p_✓r
  537.           True if _✓e_✓x_✓p_✓r is false.
  538.  
  539.      -not _✓e_✓x_✓p_✓r
  540.           Same as ! _✓e_✓x_✓p_✓r.
  541.  
  542.      _✓e_✓x_✓p_✓r_✓1 _✓e_✓x_✓p_✓r_✓2
  543.           And (implied); _✓e_✓x_✓p_✓r_✓2 is not evaluated if _✓e_✓x_✓p_✓r_✓1 is
  544.           false.
  545.  
  546.      _✓e_✓x_✓p_✓r_✓1 -a _✓e_✓x_✓p_✓r_✓2
  547.           Same as _✓e_✓x_✓p_✓r_✓1 _✓e_✓x_✓p_✓r_✓2.
  548.  
  549.      _✓e_✓x_✓p_✓r_✓1 -and _✓e_✓x_✓p_✓r_✓2
  550.           Same as _✓e_✓x_✓p_✓r_✓1 _✓e_✓x_✓p_✓r_✓2.
  551.  
  552.      _✓e_✓x_✓p_✓r_✓1 -o _✓e_✓x_✓p_✓r_✓2
  553.           Or; _✓e_✓x_✓p_✓r_✓2 is not evaluated if _✓e_✓x_✓p_✓r_✓1 is true.
  554.  
  555.      _✓e_✓x_✓p_✓r_✓1 -or _✓e_✓x_✓p_✓r_✓2
  556.           Same as _✓e_✓x_✓p_✓r_✓1 -o _✓e_✓x_✓p_✓r_✓2.
  557.  
  558.      _✓e_✓x_✓p_✓r_✓1 , _✓e_✓x_✓p_✓r_✓2
  559.           List; both _✓e_✓x_✓p_✓r_✓1 and _✓e_✓x_✓p_✓r_✓2 are always evaluated.  The
  560.           value of _✓e_✓x_✓p_✓r_✓1 is discarded; the value of the list is
  561.           the value of _✓e_✓x_✓p_✓r_✓1.
  562.  
  563.  
  564.  
  565.  
  566.  
  567.  
  568.  
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591. Page 9
  592.  
  593.  
  594.  
  595.