* zip man pages, which fixes bug #10272: findutils manpages are not
[findutils.git] / doc / find.info-2
blobc3b45d7de9a39c65eb3eef7ebe29e8034e755976
1 This is Info file find.info, produced by Makeinfo version 1.67 from the
2 input file find.texi.
4 START-INFO-DIR-ENTRY
5 * Finding Files: (find).        Listing and operating on files
6                                 that match certain criteria.
7 END-INFO-DIR-ENTRY
9    This file documents the GNU utilities for finding files that match
10 certain criteria and performing various operations on them.
12    Copyright (C) 1994 Free Software Foundation, Inc.
14    Permission is granted to make and distribute verbatim copies of this
15 manual provided the copyright notice and this permission notice are
16 preserved on all copies.
18    Permission is granted to copy and distribute modified versions of
19 this manual under the conditions for verbatim copying, provided that
20 the entire resulting derived work is distributed under the terms of a
21 permission notice identical to this one.
23    Permission is granted to copy and distribute translations of this
24 manual into another language, under the above conditions for modified
25 versions, except that this permission notice may be stated in a
26 translation approved by the Foundation.
28 \x1f
29 File: find.info,  Node: Viewing And Editing,  Next: Archiving,  Up: Common Tasks
31 Viewing And Editing
32 ===================
34    To view a list of files that meet certain criteria, simply run your
35 file viewing program with the file names as arguments.  Shells
36 substitute a command enclosed in backquotes with its output, so the
37 whole command looks like this:
39      less `find /usr/include -name '*.h' | xargs grep -l mode_t`
41 You can edit those files by giving an editor name instead of a file
42 viewing program.
44 \x1f
45 File: find.info,  Node: Archiving,  Next: Cleaning Up,  Prev: Viewing And Editing,  Up: Common Tasks
47 Archiving
48 =========
50    You can pass a list of files produced by `find' to a file archiving
51 program.  GNU `tar' and `cpio' can both read lists of file names from
52 the standard input--either delimited by nulls (the safe way) or by
53 blanks (the lazy, risky default way).  To use null-delimited names,
54 give them the `--null' option.  You can store a file archive in a file,
55 write it on a tape, or send it over a network to extract on another
56 machine.
58    One common use of `find' to archive files is to send a list of the
59 files in a directory tree to `cpio'.  Use `-depth' so if a directory
60 does not have write permission for its owner, its contents can still be
61 restored from the archive since the directory's permissions are
62 restored after its contents.  Here is an example of doing this using
63 `cpio'; you could use a more complex `find' expression to archive only
64 certain files.
66      find . -depth -print0 |
67        cpio --create --null --format=crc --file=/dev/nrst0
69    You could restore that archive using this command:
71      cpio --extract --null --make-dir --unconditional \
72        --preserve --file=/dev/nrst0
74    Here are the commands to do the same things using `tar':
76      find . -depth -print0 |
77        tar --create --null --files-from=- --file=/dev/nrst0
78      
79      tar --extract --null --preserve-perm --same-owner \
80        --file=/dev/nrst0
82    Here is an example of copying a directory from one machine to
83 another:
85      find . -depth -print0 | cpio -0o -Hnewc |
86        rsh OTHER-MACHINE "cd `pwd` && cpio -i0dum"
88 \x1f
89 File: find.info,  Node: Cleaning Up,  Next: Strange File Names,  Prev: Archiving,  Up: Common Tasks
91 Cleaning Up
92 ===========
94    This section gives examples of removing unwanted files in various
95 situations.  Here is a command to remove the CVS backup files created
96 when an update requires a merge:
98      find . -name '.#*' -print0 | xargs -0r rm -f
100    You can run this command to clean out your clutter in `/tmp'.  You
101 might place it in the file your shell runs when you log out
102 (`.bash_logout', `.logout', or `.zlogout', depending on which shell you
103 use).
105      find /tmp -user $LOGNAME -type f -print0 | xargs -0 -r rm -f
107    To remove old Emacs backup and auto-save files, you can use a command
108 like the following.  It is especially important in this case to use
109 null-terminated file names because Emacs packages like the VM mailer
110 often create temporary file names with spaces in them, like `#reply to
111 David J. MacKenzie<1>#'.
113      find ~ \( -name '*~' -o -name '#*#' \) -print0 |
114        xargs --no-run-if-empty --null rm -vf
116    Removing old files from `/tmp' is commonly done from `cron':
118      find /tmp /var/tmp -not -type d -mtime +3 -print0 |
119        xargs --null --no-run-if-empty rm -f
120      
121      find /tmp /var/tmp -depth -mindepth 1 -type d -empty -print0 |
122        xargs --null --no-run-if-empty rmdir
124    The second `find' command above uses `-depth' so it cleans out empty
125 directories depth-first, hoping that the parents become empty and can
126 be removed too.  It uses `-mindepth' to avoid removing `/tmp' itself if
127 it becomes totally empty.
129 \x1f
130 File: find.info,  Node: Strange File Names,  Next: Fixing Permissions,  Prev: Cleaning Up,  Up: Common Tasks
132 Strange File Names
133 ==================
135    `find' can help you remove or rename a file with strange characters
136 in its name.  People are sometimes stymied by files whose names contain
137 characters such as spaces, tabs, control characters, or characters with
138 the high bit set.  The simplest way to remove such files is:
140      rm -i SOME*PATTERN*THAT*MATCHES*THE*PROBLEM*FILE
142    `rm' asks you whether to remove each file matching the given
143 pattern.  If you are using an old shell, this approach might not work if
144 the file name contains a character with the high bit set; the shell may
145 strip it off.  A more reliable way is:
147      find . -maxdepth 1 TESTS -ok rm '{}' \;
149 where TESTS uniquely identify the file.  The `-maxdepth 1' option
150 prevents `find' from wasting time searching for the file in any
151 subdirectories; if there are no subdirectories, you may omit it.  A
152 good way to uniquely identify the problem file is to figure out its
153 inode number; use
155      ls -i
157    Suppose you have a file whose name contains control characters, and
158 you have found that its inode number is 12345.  This command prompts
159 you for whether to remove it:
161      find . -maxdepth 1 -inum 12345 -ok rm -f '{}' \;
163    If you don't want to be asked, perhaps because the file name may
164 contain a strange character sequence that will mess up your screen when
165 printed, then use `-exec' instead of `-ok'.
167    If you want to rename the file instead, you can use `mv' instead of
168 `rm':
170      find . -maxdepth 1 -inum 12345 -ok mv '{}' NEW-FILE-NAME \;
172 \x1f
173 File: find.info,  Node: Fixing Permissions,  Next: Classifying Files,  Prev: Strange File Names,  Up: Common Tasks
175 Fixing Permissions
176 ==================
178    Suppose you want to make sure that everyone can write to the
179 directories in a certain directory tree.  Here is a way to find
180 directories lacking either user or group write permission (or both),
181 and fix their permissions:
183      find . -type d -not -perm -ug=w | xargs chmod ug+w
185 You could also reverse the operations, if you want to make sure that
186 directories do *not* have world write permission.
188 \x1f
189 File: find.info,  Node: Classifying Files,  Prev: Fixing Permissions,  Up: Common Tasks
191 Classifying Files
192 =================
194    If you want to classify a set of files into several groups based on
195 different criteria, you can use the comma operator to perform multiple
196 independent tests on the files.  Here is an example:
198      find / -type d \( -perm -o=w -fprint allwrite , \
199        -perm -o=x -fprint allexec \)
200      
201      echo "Directories that can be written to by everyone:"
202      cat allwrite
203      echo ""
204      echo "Directories with search permissions for everyone:"
205      cat allexec
207    `find' has only to make one scan through the directory tree (which
208 is one of the most time consuming parts of its work).
210 \x1f
211 File: find.info,  Node: Databases,  Next: File Permissions,  Prev: Common Tasks,  Up: Top
213 File Name Databases
214 *******************
216    The file name databases used by `locate' contain lists of files that
217 were in particular directory trees when the databases were last
218 updated.  The file name of the default database is determined when
219 `locate' and `updatedb' are configured and installed.  The frequency
220 with which the databases are updated and the directories for which they
221 contain entries depend on how often `updatedb' is run, and with which
222 arguments.
224 * Menu:
226 * Database Locations::
227 * Database Formats::
229 \x1f
230 File: find.info,  Node: Database Locations,  Next: Database Formats,  Up: Databases
232 Database Locations
233 ==================
235    There can be multiple file name databases.  Users can select which
236 databases `locate' searches using an environment variable or a command
237 line option.  The system administrator can choose the file name of the
238 default database, the frequency with which the databases are updated,
239 and the directories for which they contain entries.  File name
240 databases are updated by running the `updatedb' program, typically
241 nightly.
243    In networked environments, it often makes sense to build a database
244 at the root of each filesystem, containing the entries for that
245 filesystem.  `updatedb' is then run for each filesystem on the
246 fileserver where that filesystem is on a local disk, to prevent
247 thrashing the network.  Here are the options to `updatedb' to select
248 which directories each database contains entries for:
250 `--localpaths='PATH...''
251      Non-network directories to put in the database.  Default is `/'.
253 `--netpaths='PATH...''
254      Network (NFS, AFS, RFS, etc.) directories to put in the database.
255      Default is none.
257 `--prunepaths='PATH...''
258      Directories to not put in the database, which would otherwise be.
259      Default is `/tmp /usr/tmp /var/tmp /afs'.
261 `--prunefs='PATH...''
262      File systems to not put in the database, which would otherwise be.
263      Note that files are pruned when a file system is reached; Any file
264      system mounted under an undesired file system will be ignored.
265      Default is `nfs NFS proc'.
267 `--output=DBFILE'
268      The database file to build.  Default is system-dependent, but
269      typically `/usr/local/var/locatedb'.
271 `--localuser=USER'
272      The user to search the non-network directories as, using `su'.
273      Default is to search the non-network directories as the current
274      user.  You can also use the environment variable `LOCALUSER' to
275      set this user.
277 `--netuser=USER'
278      The user to search network directories as, using `su'.  Default is
279      `daemon'.  You can also use the environment variable `NETUSER' to
280      set this user.
282 \x1f
283 File: find.info,  Node: Database Formats,  Prev: Database Locations,  Up: Databases
285 Database Formats
286 ================
288    The file name databases contain lists of files that were in
289 particular directory trees when the databases were last updated.  The
290 file name database format changed starting with GNU `locate' version
291 4.0 to allow machines with diffent byte orderings to share the
292 databases.  The new GNU `locate' can read both the old and new database
293 formats.  However, old versions of `locate' and `find' produce incorrect
294 results if given a new-format database.
296 * Menu:
298 * New Database Format::
299 * Sample Database::
300 * Old Database Format::
302 \x1f
303 File: find.info,  Node: New Database Format,  Next: Sample Database,  Up: Database Formats
305 New Database Format
306 -------------------
308    `updatedb' runs a program called `frcode' to "front-compress" the
309 list of file names, which reduces the database size by a factor of 4 to
310 5.  Front-compression (also known as incremental encoding) works as
311 follows.
313    The database entries are a sorted list (case-insensitively, for
314 users' convenience).  Since the list is sorted, each entry is likely to
315 share a prefix (initial string) with the previous entry.  Each database
316 entry begins with an offset-differential count byte, which is the
317 additional number of characters of prefix of the preceding entry to use
318 beyond the number that the preceding entry is using of its predecessor.
319 (The counts can be negative.)  Following the count is a
320 null-terminated ASCII remainder--the part of the name that follows the
321 shared prefix.
323    If the offset-differential count is larger than can be stored in a
324 byte (+/-127), the byte has the value 0x80 and the count follows in a
325 2-byte word, with the high byte first (network byte order).
327    Every database begins with a dummy entry for a file called
328 `LOCATE02', which `locate' checks for to ensure that the database file
329 has the correct format; it ignores the entry in doing the search.
331    Databases can not be concatenated together, even if the first (dummy)
332 entry is trimmed from all but the first database.  This is because the
333 offset-differential count in the first entry of the second and following
334 databases will be wrong.
336 \x1f
337 File: find.info,  Node: Sample Database,  Next: Old Database Format,  Prev: New Database Format,  Up: Database Formats
339 Sample Database
340 ---------------
342    Sample input to `frcode':
344      /usr/src
345      /usr/src/cmd/aardvark.c
346      /usr/src/cmd/armadillo.c
347      /usr/tmp/zoo
349    Length of the longest prefix of the preceding entry to share:
351      0 /usr/src
352      8 /cmd/aardvark.c
353      14 rmadillo.c
354      5 tmp/zoo
356    Output from `frcode', with trailing nulls changed to newlines and
357 count bytes made printable:
359      0 LOCATE02
360      0 /usr/src
361      8 /cmd/aardvark.c
362      6 rmadillo.c
363      -9 tmp/zoo
365    (6 = 14 - 8, and -9 = 5 - 14)
367 \x1f
368 File: find.info,  Node: Old Database Format,  Prev: Sample Database,  Up: Database Formats
370 Old Database Format
371 -------------------
373    The old database format is used by Unix `locate' and `find' programs
374 and earlier releases of the GNU ones.  `updatedb' produces this format
375 if given the `--old-format' option.
377    `updatedb' runs programs called `bigram' and `code' to produce
378 old-format databases.  The old format differs from the new one in the
379 following ways.  Instead of each entry starting with an
380 offset-differential count byte and ending with a null, byte values from
381 0 through 28 indicate offset-differential counts from -14 through 14.
382 The byte value indicating that a long offset-differential count follows
383 is 0x1e (30), not 0x80.  The long counts are stored in host byte order,
384 which is not necessarily network byte order, and host integer word size,
385 which is usually 4 bytes.  They also represent a count 14 less than
386 their value.  The database lines have no termination byte; the start of
387 the next line is indicated by its first byte having a value <= 30.
389    In addition, instead of starting with a dummy entry, the old database
390 format starts with a 256 byte table containing the 128 most common
391 bigrams in the file list.  A bigram is a pair of adjacent bytes.  Bytes
392 in the database that have the high bit set are indexes (with the high
393 bit cleared) into the bigram table.  The bigram and offset-differential
394 count coding makes these databases 20-25% smaller than the new format,
395 but makes them not 8-bit clean.  Any byte in a file name that is in the
396 ranges used for the special codes is replaced in the database by a
397 question mark, which not coincidentally is the shell wildcard to match a
398 single character.
400 \x1f
401 File: find.info,  Node: File Permissions,  Next: Reference,  Prev: Databases,  Up: Top
403 File Permissions
404 ****************
406    Each file has a set of "permissions" that control the kinds of
407 access that users have to that file.  The permissions for a file are
408 also called its "access mode".  They can be represented either in
409 symbolic form or as an octal number.
411 * Menu:
413 * Mode Structure::              Structure of file permissions.
414 * Symbolic Modes::              Mnemonic permissions representation.
415 * Numeric Modes::               Permissions as octal numbers.
417 \x1f
418 File: find.info,  Node: Mode Structure,  Next: Symbolic Modes,  Up: File Permissions
420 Structure of File Permissions
421 =============================
423    There are three kinds of permissions that a user can have for a file:
425   1. permission to read the file.  For directories, this means
426      permission to list the contents of the directory.
428   2. permission to write to (change) the file.  For directories, this
429      means permission to create and remove files in the directory.
431   3. permission to execute the file (run it as a program).  For
432      directories, this means permission to access files in the
433      directory.
435    There are three categories of users who may have different
436 permissions to perform any of the above operations on a file:
438   1. the file's owner;
440   2. other users who are in the file's group;
442   3. everyone else.
444    Files are given an owner and group when they are created.  Usually
445 the owner is the current user and the group is the group of the
446 directory the file is in, but this varies with the operating system, the
447 filesystem the file is created on, and the way the file is created.  You
448 can change the owner and group of a file by using the `chown' and
449 `chgrp' commands.
451    In addition to the three sets of three permissions listed above, a
452 file's permissions have three special components, which affect only
453 executable files (programs) and, on some systems, directories:
455   1. set the process's effective user ID to that of the file upon
456      execution (called the "setuid bit").  No effect on directories.
458   2. set the process's effective group ID to that of the file upon
459      execution (called the "setgid bit").  For directories on some
460      systems, put files created in the directory into the same group as
461      the directory, no matter what group the user who creates them is
462      in.
464   3. save the program's text image on the swap device so it will load
465      more quickly when run (called the "sticky bit").  For directories
466      on some systems, prevent users from removing files that they do
467      not own in the directory; this is called making the directory
468      "append-only".
470 \x1f
471 File: find.info,  Node: Symbolic Modes,  Next: Numeric Modes,  Prev: Mode Structure,  Up: File Permissions
473 Symbolic Modes
474 ==============
476    "Symbolic modes" represent changes to files' permissions as
477 operations on single-character symbols.  They allow you to modify either
478 all or selected parts of files' permissions, optionally based on their
479 previous values, and perhaps on the current `umask' as well (*note
480 Umask and Protection::.).
482    The format of symbolic modes is:
484      [ugoa...][[+-=][rwxXstugo...]...][,...]
486    The following sections describe the operators and other details of
487 symbolic modes.
489 * Menu:
491 * Setting Permissions::          Basic operations on permissions.
492 * Copying Permissions::          Copying existing permissions.
493 * Changing Special Permissions:: Special permissions.
494 * Conditional Executability::    Conditionally affecting executability.
495 * Multiple Changes::             Making multiple changes.
496 * Umask and Protection::              The effect of the umask.
498 \x1f
499 File: find.info,  Node: Setting Permissions,  Next: Copying Permissions,  Up: Symbolic Modes
501 Setting Permissions
502 -------------------
504    The basic symbolic operations on a file's permissions are adding,
505 removing, and setting the permission that certain users have to read,
506 write, and execute the file.  These operations have the following
507 format:
509      USERS OPERATION PERMISSIONS
511 The spaces between the three parts above are shown for readability only;
512 symbolic modes can not contain spaces.
514    The USERS part tells which users' access to the file is changed.  It
515 consists of one or more of the following letters (or it can be empty;
516 *note Umask and Protection::., for a description of what happens then).
517 When more than one of these letters is given, the order that they are
518 in does not matter.
521      the user who owns the file;
524      other users who are in the file's group;
527      all other users;
530      all users; the same as `ugo'.
532    The OPERATION part tells how to change the affected users' access to
533 the file, and is one of the following symbols:
536      to add the PERMISSIONS to whatever permissions the USERS already
537      have for the file;
540      to remove the PERMISSIONS from whatever permissions the USERS
541      already have for the file;
544      to make the PERMISSIONS the only permissions that the USERS have
545      for the file.
547    The PERMISSIONS part tells what kind of access to the file should be
548 changed; it is zero or more of the following letters.  As with the
549 USERS part, the order does not matter when more than one letter is
550 given.  Omitting the PERMISSIONS part is useful only with the `='
551 operation, where it gives the specified USERS no access at all to the
552 file.
555      the permission the USERS have to read the file;
558      the permission the USERS have to write to the file;
561      the permission the USERS have to execute the file.
563    For example, to give everyone permission to read and write a file,
564 but not to execute it, use:
566      a=rw
568    To remove write permission for from all users other than the file's
569 owner, use:
571      go-w
573 The above command does not affect the access that the owner of the file
574 has to it, nor does it affect whether other users can read or execute
575 the file.
577    To give everyone except a file's owner no permission to do anything
578 with that file, use the mode below.  Other users could still remove the
579 file, if they have write permission on the directory it is in.
581      go=
583 Another way to specify the same thing is:
585      og-rxw
587 \x1f
588 File: find.info,  Node: Copying Permissions,  Next: Changing Special Permissions,  Prev: Setting Permissions,  Up: Symbolic Modes
590 Copying Existing Permissions
591 ----------------------------
593    You can base part of a file's permissions on part of its existing
594 permissions.  To do this, instead of using `r', `w', or `x' after the
595 operator, you use the letter `u', `g', or `o'.  For example, the mode
597      o+g
599 adds the permissions for users who are in a file's group to the
600 permissions that other users have for the file.  Thus, if the file
601 started out as mode 664 (`rw-rw-r--'), the above mode would change it
602 to mode 666 (`rw-rw-rw-').  If the file had started out as mode 741
603 (`rwxr----x'), the above mode would change it to mode 745
604 (`rwxr--r-x').  The `-' and `=' operations work analogously.
606 \x1f
607 File: find.info,  Node: Changing Special Permissions,  Next: Conditional Executability,  Prev: Copying Permissions,  Up: Symbolic Modes
609 Changing Special Permissions
610 ----------------------------
612    In addition to changing a file's read, write, and execute
613 permissions, you can change its special permissions.  *Note Mode
614 Structure::, for a summary of these permissions.
616    To change a file's permission to set the user ID on execution, use
617 `u' in the USERS part of the symbolic mode and `s' in the PERMISSIONS
618 part.
620    To change a file's permission to set the group ID on execution, use
621 `g' in the USERS part of the symbolic mode and `s' in the PERMISSIONS
622 part.
624    To change a file's permission to stay permanently on the swap device,
625 use `o' in the USERS part of the symbolic mode and `t' in the
626 PERMISSIONS part.
628    For example, to add set user ID permission to a program, you can use
629 the mode:
631      u+s
633    To remove both set user ID and set group ID permission from it, you
634 can use the mode:
636      ug-s
638    To cause a program to be saved on the swap device, you can use the
639 mode:
641      o+t
643    Remember that the special permissions only affect files that are
644 executable, plus, on some systems, directories (on which they have
645 different meanings; *note Mode Structure::.).  Using `a' in the USERS
646 part of a symbolic mode does not cause the special permissions to be
647 affected; thus,
649      a+s
651 has *no effect*.  You must use `u', `g', and `o' explicitly to affect
652 the special permissions.  Also, the combinations `u+t', `g+t', and
653 `o+s' have no effect.
655    The `=' operator is not very useful with special permissions; for
656 example, the mode:
658      o=t
660 does cause the file to be saved on the swap device, but it also removes
661 all read, write, and execute permissions that users not in the file's
662 group might have had for it.
664 \x1f
665 File: find.info,  Node: Conditional Executability,  Next: Multiple Changes,  Prev: Changing Special Permissions,  Up: Symbolic Modes
667 Conditional Executability
668 -------------------------
670    There is one more special type of symbolic permission: if you use
671 `X' instead of `x', execute permission is affected only if the file
672 already had execute permission or is a directory.  It affects
673 directories' execute permission even if they did not initially have any
674 execute permissions set.
676    For example, this mode:
678      a+X
680 gives all users permission to execute files (or search directories) if
681 anyone could before.
683 \x1f
684 File: find.info,  Node: Multiple Changes,  Next: Umask and Protection,  Prev: Conditional Executability,  Up: Symbolic Modes
686 Making Multiple Changes
687 -----------------------
689    The format of symbolic modes is actually more complex than described
690 above (*note Setting Permissions::.).  It provides two ways to make
691 multiple changes to files' permissions.
693    The first way is to specify multiple OPERATION and PERMISSIONS parts
694 after a USERS part in the symbolic mode.
696    For example, the mode:
698      og+rX-w
700 gives users other than the owner of the file read permission and, if it
701 is a directory or if someone already had execute permission to it,
702 gives them execute permission; and it also denies them write permission
703 to it file.  It does not affect the permission that the owner of the
704 file has for it.  The above mode is equivalent to the two modes:
706      og+rX
707      og-w
709    The second way to make multiple changes is to specify more than one
710 simple symbolic mode, separated by commas.  For example, the mode:
712      a+r,go-w
714 gives everyone permission to read the file and removes write permission
715 on it for all users except its owner.  Another example:
717      u=rwx,g=rx,o=
719 sets all of the non-special permissions for the file explicitly.  (It
720 gives users who are not in the file's group no permission at all for
721 it.)
723    The two methods can be combined.  The mode:
725      a+r,g+x-w
727 gives all users permission to read the file, and gives users who are in
728 the file's group permission to execute it, as well, but not permission
729 to write to it.  The above mode could be written in several different
730 ways; another is:
732      u+r,g+rx,o+r,g-w
734 \x1f
735 File: find.info,  Node: Umask and Protection,  Prev: Multiple Changes,  Up: Symbolic Modes
737 The Umask and Protection
738 ------------------------
740    If the USERS part of a symbolic mode is omitted, it defaults to `a'
741 (affect all users), except that any permissions that are *set* in the
742 system variable `umask' are *not affected*.  The value of `umask' can
743 be set using the `umask' command.  Its default value varies from system
744 to system.
746    Omitting the USERS part of a symbolic mode is generally not useful
747 with operations other than `+'.  It is useful with `+' because it
748 allows you to use `umask' as an easily customizable protection against
749 giving away more permission to files than you intended to.
751    As an example, if `umask' has the value 2, which removes write
752 permission for users who are not in the file's group, then the mode:
754      +w
756 adds permission to write to the file to its owner and to other users who
757 are in the file's group, but *not* to other users.  In contrast, the
758 mode:
760      a+w
762 ignores `umask', and *does* give write permission for the file to all
763 users.
765 \x1f
766 File: find.info,  Node: Numeric Modes,  Prev: Symbolic Modes,  Up: File Permissions
768 Numeric Modes
769 =============
771    File permissions are stored internally as 16 bit integers.  As an
772 alternative to giving a symbolic mode, you can give an octal (base 8)
773 number that corresponds to the internal representation of the new mode.
774 This number is always interpreted in octal; you do not have to add a
775 leading 0, as you do in C.  Mode 0055 is the same as mode 55.
777    A numeric mode is usually shorter than the corresponding symbolic
778 mode, but it is limited in that it can not take into account a file's
779 previous permissions; it can only set them absolutely.
781    The permissions granted to the user, to other users in the file's
782 group, and to other users not in the file's group are each stored as
783 three bits, which are represented as one octal digit.  The three special
784 permissions are also each stored as one bit, and they are as a group
785 represented as another octal digit.  Here is how the bits are arranged
786 in the 16 bit integer, starting with the lowest valued bit:
788      Value in  Corresponding
789      Mode      Permission
790      
791                Other users not in the file's group:
792         1      Execute
793         2      Write
794         4      Read
795      
796                Other users in the file's group:
797        10      Execute
798        20      Write
799        40      Read
800      
801                The file's owner:
802       100      Execute
803       200      Write
804       400      Read
805      
806                Special permissions:
807      1000      Save text image on swap device
808      2000      Set group ID on execution
809      4000      Set user ID on execution
811    For example, numeric mode 4755 corresponds to symbolic mode
812 `u=rwxs,go=rx', and numeric mode 664 corresponds to symbolic mode
813 `ug=rw,o=r'.  Numeric mode 0 corresponds to symbolic mode `ugo='.
815 \x1f
816 File: find.info,  Node: Reference,  Next: Primary Index,  Prev: File Permissions,  Up: Top
818 Reference
819 *********
821    Below are summaries of the command line syntax for the programs
822 discussed in this manual.
824 * Menu:
826 * Invoking find::
827 * Invoking locate::
828 * Invoking updatedb::
829 * Invoking xargs::
831 \x1f
832 File: find.info,  Node: Invoking find,  Next: Invoking locate,  Up: Reference
834 Invoking `find'
835 ===============
837      find [FILE...] [EXPRESSION]
839    `find' searches the directory tree rooted at each file name FILE by
840 evaluating the EXPRESSION on each file it finds in the tree.
842    `find' considers the first argument that begins with `-', `(', `)',
843 `,', or `!' to be the beginning of the expression; any arguments before
844 it are paths to search, and any arguments after it are the rest of the
845 expression.  If no paths are given, the current directory is used.  If
846 no expression is given, the expression `-print' is used.
848    `find' exits with status 0 if all files are processed successfully,
849 greater than 0 if errors occur.
851    *Note Primary Index::, for a summary of all of the tests, actions,
852 and options that the expression can contain.
854    `find' also recognizes two options for administrative use:
856 `--help'
857      Print a summary of the command-line argument format and exit.
859 `--version'
860      Print the version number of `find' and exit.
862 \x1f
863 File: find.info,  Node: Invoking locate,  Next: Invoking updatedb,  Prev: Invoking find,  Up: Reference
865 Invoking `locate'
866 =================
868      locate [OPTION...] PATTERN...
870 `--database=PATH'
871 `-d PATH'
872      Instead of searching the default file name database, search the
873      file name databases in PATH, which is a colon-separated list of
874      database file names.  You can also use the environment variable
875      `LOCATE_PATH' to set the list of database files to search.  The
876      option overrides the environment variable if both are used.
878 `--help'
879      Print a summary of the options to `locate' and exit.
881 `--version'
882      Print the version number of `locate' and exit.
884 \x1f
885 File: find.info,  Node: Invoking updatedb,  Next: Invoking xargs,  Prev: Invoking locate,  Up: Reference
887 Invoking `updatedb'
888 ===================
890      updatedb [OPTION...]
892 `--localpaths='PATH...''
893      Non-network directories to put in the database.  Default is `/'.
895 `--netpaths='PATH...''
896      Network (NFS, AFS, RFS, etc.) directories to put in the database.
897      Default is none.
899 `--prunepaths='PATH...''
900      Directories to not put in the database, which would otherwise be.
901      Default is `/tmp /usr/tmp /var/tmp /afs'.
903 `--prunefs='PATH...''
904      File systems to not put in the database, which would otherwise be.
905      Note that files are pruned when a file system is reached; Any file
906      system mounted under an undesired file system will be ignored.
907      Default is `nfs NFS proc'.
909 `--output=DBFILE'
910      The database file to build.  Default is system-dependent, but
911      typically `/usr/local/var/locatedb'.
913 `--localuser=USER'
914      The user to search the non-network directories as, using `su'.
915      Default is to search the non-network directories as the current
916      user.  You can also use the environment variable `LOCALUSER' to
917      set this user.
919 `--netuser=USER'
920      The user to search network directories as, using `su'(1).  Default
921      is `daemon'.  You can also use the environment variable `NETUSER'
922      to set this user.
924 \x1f
925 File: find.info,  Node: Invoking xargs,  Prev: Invoking updatedb,  Up: Reference
927 Invoking `xargs'
928 ================
930      xargs [OPTION...] [COMMAND [INITIAL-ARGUMENTS]]
932    `xargs' exits with the following status:
935      if it succeeds
938      if any invocation of the command exited with status 1-125
941      if the command exited with status 255
944      if the command is killed by a signal
947      if the command cannot be run
950      if the command is not found
953      if some other error occurred.
955 `--null'
956 `-0'
957      Input filenames are terminated by a null character instead of by
958      whitespace, and the quotes and backslash are not special (every
959      character is taken literally).  Disables the end of file string,
960      which is treated like any other argument.
962 `--eof[=EOF-STR]'
963 `-e[EOF-STR]'
964      Set the end of file string to EOF-STR.  If the end of file string
965      occurs as a line of input, the rest of the input is ignored.  If
966      EOF-STR is omitted, there is no end of file string.  If this
967      option is not given, the end of file string defaults to `_'.
969 `--help'
970      Print a summary of the options to `xargs' and exit.
972 `--replace[=REPLACE-STR]'
973 `-i[REPLACE-STR]'
974      Replace occurences of REPLACE-STR in the initial arguments with
975      names read from standard input.  Also, unquoted blanks do not
976      terminate arguments.  If REPLACE-STR is omitted, it defaults to
977      `{}' (like for `find -exec').  Implies `-x' and `-l 1'.
979 `--max-lines[=MAX-LINES]'
980 `-l[MAX-LINES]'
981      Use at most MAX-LINES nonblank input lines per command line;
982      MAX-LINES defaults to 1 if omitted.  Trailing blanks cause an
983      input line to be logically continued on the next input line, for
984      the purpose of counting the lines.  Implies `-x'.
986 `--max-args=MAX-ARGS'
987 `-n MAX-ARGS'
988      Use at most MAX-ARGS arguments per command line.  Fewer than
989      MAX-ARGS arguments will be used if the size (see the `-s' option)
990      is exceeded, unless the `-x' option is given, in which case
991      `xargs' will exit.
993 `--interactive'
994 `-p'
995      Prompt the user about whether to run each command line and read a
996      line from the terminal.  Only run the command line if the response
997      starts with `y' or `Y'.  Implies `-t'.
999 `--no-run-if-empty'
1000 `-r'
1001      If the standard input does not contain any nonblanks, do not run
1002      the command.  By default, the command is run once even if there is
1003      no input.
1005 `--max-chars=MAX-CHARS'
1006 `-s MAX-CHARS'
1007      Use at most MAX-CHARS characters per command line, including the
1008      command and initial arguments and the terminating nulls at the
1009      ends of the argument strings.
1011 `--verbose'
1012 `-t'
1013      Print the command line on the standard error output before
1014      executing it.
1016 `--version'
1017      Print the version number of `xargs' and exit.
1019 `--exit'
1020 `-x'
1021      Exit if the size (see the -S option) is exceeded.
1023 `--max-procs=MAX-PROCS'
1024 `-P MAX-PROCS'
1025      Run up to MAX-PROCS processes at a time; the default is 1.  If
1026      MAX-PROCS is 0, `xargs' will run as many processes as possible at
1027      a time.
1029 \x1f
1030 File: find.info,  Node: Primary Index,  Prev: Reference,  Up: Top
1032 `find' Primary Index
1033 ********************
1035    This is a list of all of the primaries (tests, actions, and options)
1036 that make up `find' expressions for selecting files.  *Note find
1037 Expressions::, for more information on expressions.
1039 * Menu:
1041 * -amin:                                 Age Ranges.
1042 * -anewer:                               Comparing Timestamps.
1043 * -atime:                                Age Ranges.
1044 * -cmin:                                 Age Ranges.
1045 * -cnewer:                               Comparing Timestamps.
1046 * -ctime:                                Age Ranges.
1047 * -daystart:                             Age Ranges.
1048 * -depth:                                Directories.
1049 * -empty:                                Size.
1050 * -exec:                                 Single File.
1051 * -false:                                Combining Primaries With Operators.
1052 * -fls:                                  Print File Information.
1053 * -follow:                               Symbolic Links.
1054 * -fprint:                               Print File Name.
1055 * -fprint0:                              Safe File Name Handling.
1056 * -fprintf:                              Print File Information.
1057 * -fstype:                               Filesystems.
1058 * -gid:                                  Owner.
1059 * -group:                                Owner.
1060 * -ilname:                               Symbolic Links.
1061 * -iname:                                Base Name Patterns.
1062 * -inum:                                 Hard Links.
1063 * -ipath:                                Full Name Patterns.
1064 * -iregex:                               Full Name Patterns.
1065 * -links:                                Hard Links.
1066 * -lname:                                Symbolic Links.
1067 * -ls:                                   Print File Information.
1068 * -maxdepth:                             Directories.
1069 * -mindepth:                             Directories.
1070 * -mmin:                                 Age Ranges.
1071 * -mount:                                Filesystems.
1072 * -mtime:                                Age Ranges.
1073 * -name:                                 Base Name Patterns.
1074 * -newer:                                Comparing Timestamps.
1075 * -nogroup:                              Owner.
1076 * -noleaf:                               Directories.
1077 * -nouser:                               Owner.
1078 * -ok:                                   Querying.
1079 * -path:                                 Full Name Patterns.
1080 * -perm:                                 Permissions.
1081 * -print:                                Print File Name.
1082 * -print0:                               Safe File Name Handling.
1083 * -printf:                               Print File Information.
1084 * -prune:                                Directories.
1085 * -regex:                                Full Name Patterns.
1086 * -size:                                 Size.
1087 * -true:                                 Combining Primaries With Operators.
1088 * -type:                                 Type.
1089 * -uid:                                  Owner.
1090 * -used:                                 Comparing Timestamps.
1091 * -user:                                 Owner.
1092 * -xdev:                                 Filesystems.
1093 * -xtype:                                Type.