*** empty log message ***
[findutils.git] / doc / find.info-2
blobf72e8d7e444687573fd61d7c1d54159a859ac732
1 This is find.info, produced by makeinfo version 4.0 from find.texi.
3 START-INFO-DIR-ENTRY
4 * Finding Files: (find).        Listing and operating on files
5                                 that match certain criteria.
6 END-INFO-DIR-ENTRY
8    This file documents the GNU utilities for finding files that match
9 certain criteria and performing various operations on them.
11    Copyright (C) 1994 Free Software Foundation, Inc.
13    Permission is granted to make and distribute verbatim copies of this
14 manual provided the copyright notice and this permission notice are
15 preserved on all copies.
17    Permission is granted to copy and distribute modified versions of
18 this manual under the conditions for verbatim copying, provided that
19 the entire resulting derived work is distributed under the terms of a
20 permission notice identical to this one.
22    Permission is granted to copy and distribute translations of this
23 manual into another language, under the above conditions for modified
24 versions, except that this permission notice may be stated in a
25 translation approved by the Foundation.
27 \x1f
28 File: find.info,  Node: Viewing And Editing,  Next: Archiving,  Up: Common Tasks
30 Viewing And Editing
31 ===================
33    To view a list of files that meet certain criteria, simply run your
34 file viewing program with the file names as arguments.  Shells
35 substitute a command enclosed in backquotes with its output, so the
36 whole command looks like this:
38      less `find /usr/include -name '*.h' | xargs grep -l mode_t`
40 You can edit those files by giving an editor name instead of a file
41 viewing program.
43 \x1f
44 File: find.info,  Node: Archiving,  Next: Cleaning Up,  Prev: Viewing And Editing,  Up: Common Tasks
46 Archiving
47 =========
49    You can pass a list of files produced by `find' to a file archiving
50 program.  GNU `tar' and `cpio' can both read lists of file names from
51 the standard input--either delimited by nulls (the safe way) or by
52 blanks (the lazy, risky default way).  To use null-delimited names,
53 give them the `--null' option.  You can store a file archive in a file,
54 write it on a tape, or send it over a network to extract on another
55 machine.
57    One common use of `find' to archive files is to send a list of the
58 files in a directory tree to `cpio'.  Use `-depth' so if a directory
59 does not have write permission for its owner, its contents can still be
60 restored from the archive since the directory's permissions are
61 restored after its contents.  Here is an example of doing this using
62 `cpio'; you could use a more complex `find' expression to archive only
63 certain files.
65      find . -depth -print0 |
66        cpio --create --null --format=crc --file=/dev/nrst0
68    You could restore that archive using this command:
70      cpio --extract --null --make-dir --unconditional \
71        --preserve --file=/dev/nrst0
73    Here are the commands to do the same things using `tar':
75      find . -depth -print0 |
76        tar --create --null --files-from=- --file=/dev/nrst0
77      
78      tar --extract --null --preserve-perm --same-owner \
79        --file=/dev/nrst0
81    Here is an example of copying a directory from one machine to
82 another:
84      find . -depth -print0 | cpio -0o -Hnewc |
85        rsh OTHER-MACHINE "cd `pwd` && cpio -i0dum"
87 \x1f
88 File: find.info,  Node: Cleaning Up,  Next: Strange File Names,  Prev: Archiving,  Up: Common Tasks
90 Cleaning Up
91 ===========
93    This section gives examples of removing unwanted files in various
94 situations.  Here is a command to remove the CVS backup files created
95 when an update requires a merge:
97      find . -name '.#*' -print0 | xargs -0r rm -f
99    You can run this command to clean out your clutter in `/tmp'.  You
100 might place it in the file your shell runs when you log out
101 (`.bash_logout', `.logout', or `.zlogout', depending on which shell you
102 use).
104      find /tmp -user $LOGNAME -type f -print0 | xargs -0 -r rm -f
106    To remove old Emacs backup and auto-save files, you can use a command
107 like the following.  It is especially important in this case to use
108 null-terminated file names because Emacs packages like the VM mailer
109 often create temporary file names with spaces in them, like `#reply to
110 David J. MacKenzie<1>#'.
112      find ~ \( -name '*~' -o -name '#*#' \) -print0 |
113        xargs --no-run-if-empty --null rm -vf
115    Removing old files from `/tmp' is commonly done from `cron':
117      find /tmp /var/tmp -not -type d -mtime +3 -print0 |
118        xargs --null --no-run-if-empty rm -f
119      
120      find /tmp /var/tmp -depth -mindepth 1 -type d -empty -exec rmdir {} \;
122    The second `find' command above uses `-depth' so it cleans out empty
123 directories depth-first, hoping that the parents become empty and can
124 be removed too.  It uses `-mindepth' to avoid removing `/tmp' itself if
125 it becomes totally empty.
127 \x1f
128 File: find.info,  Node: Strange File Names,  Next: Fixing Permissions,  Prev: Cleaning Up,  Up: Common Tasks
130 Strange File Names
131 ==================
133    `find' can help you remove or rename a file with strange characters
134 in its name.  People are sometimes stymied by files whose names contain
135 characters such as spaces, tabs, control characters, or characters with
136 the high bit set.  The simplest way to remove such files is:
138      rm -i SOME*PATTERN*THAT*MATCHES*THE*PROBLEM*FILE
140    `rm' asks you whether to remove each file matching the given
141 pattern.  If you are using an old shell, this approach might not work if
142 the file name contains a character with the high bit set; the shell may
143 strip it off.  A more reliable way is:
145      find . -maxdepth 1 TESTS -ok rm '{}' \;
147 where TESTS uniquely identify the file.  The `-maxdepth 1' option
148 prevents `find' from wasting time searching for the file in any
149 subdirectories; if there are no subdirectories, you may omit it.  A
150 good way to uniquely identify the problem file is to figure out its
151 inode number; use
153      ls -i
155    Suppose you have a file whose name contains control characters, and
156 you have found that its inode number is 12345.  This command prompts
157 you for whether to remove it:
159      find . -maxdepth 1 -inum 12345 -ok rm -f '{}' \;
161    If you don't want to be asked, perhaps because the file name may
162 contain a strange character sequence that will mess up your screen when
163 printed, then use `-exec' instead of `-ok'.
165    If you want to rename the file instead, you can use `mv' instead of
166 `rm':
168      find . -maxdepth 1 -inum 12345 -ok mv '{}' NEW-FILE-NAME \;
170 \x1f
171 File: find.info,  Node: Fixing Permissions,  Next: Classifying Files,  Prev: Strange File Names,  Up: Common Tasks
173 Fixing Permissions
174 ==================
176    Suppose you want to make sure that everyone can write to the
177 directories in a certain directory tree.  Here is a way to find
178 directories lacking either user or group write permission (or both),
179 and fix their permissions:
181      find . -type d -not -perm -ug=w | xargs chmod ug+w
183 You could also reverse the operations, if you want to make sure that
184 directories do _not_ have world write permission.
186 \x1f
187 File: find.info,  Node: Classifying Files,  Prev: Fixing Permissions,  Up: Common Tasks
189 Classifying Files
190 =================
192    If you want to classify a set of files into several groups based on
193 different criteria, you can use the comma operator to perform multiple
194 independent tests on the files.  Here is an example:
196      find / -type d \( -perm -o=w -fprint allwrite , \
197        -perm -o=x -fprint allexec \)
198      
199      echo "Directories that can be written to by everyone:"
200      cat allwrite
201      echo ""
202      echo "Directories with search permissions for everyone:"
203      cat allexec
205    `find' has only to make one scan through the directory tree (which
206 is one of the most time consuming parts of its work).
208 \x1f
209 File: find.info,  Node: Databases,  Next: File Permissions,  Prev: Common Tasks,  Up: Top
211 File Name Databases
212 *******************
214    The file name databases used by `locate' contain lists of files that
215 were in particular directory trees when the databases were last
216 updated.  The file name of the default database is determined when
217 `locate' and `updatedb' are configured and installed.  The frequency
218 with which the databases are updated and the directories for which they
219 contain entries depend on how often `updatedb' is run, and with which
220 arguments.
222 * Menu:
224 * Database Locations::
225 * Database Formats::
227 \x1f
228 File: find.info,  Node: Database Locations,  Next: Database Formats,  Up: Databases
230 Database Locations
231 ==================
233    There can be multiple file name databases.  Users can select which
234 databases `locate' searches using an environment variable or a command
235 line option.  The system administrator can choose the file name of the
236 default database, the frequency with which the databases are updated,
237 and the directories for which they contain entries.  File name
238 databases are updated by running the `updatedb' program, typically
239 nightly.
241    In networked environments, it often makes sense to build a database
242 at the root of each filesystem, containing the entries for that
243 filesystem.  `updatedb' is then run for each filesystem on the
244 fileserver where that filesystem is on a local disk, to prevent
245 thrashing the network.  Here are the options to `updatedb' to select
246 which directories each database contains entries for:
248 `--localpaths='PATH...''
249      Non-network directories to put in the database.  Default is `/'.
251 `--netpaths='PATH...''
252      Network (NFS, AFS, RFS, etc.) directories to put in the database.
253      The environment variable `NETPATHS' also sets this value.  Default
254      is none.
256 `--prunepaths='PATH...''
257      Directories to not put in the database, which would otherwise be.
258      The environment variable `PRUNEPATHS' also sets this value.
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      The environment variable `PRUNEFS' also sets this value.  Default
266      is `nfs NFS proc'.
268 `--output=DBFILE'
269      The database file to build.  Default is system-dependent, but
270      typically `/usr/local/var/locatedb'.
272 `--localuser=USER'
273      The user to search the non-network directories as, using `su'.
274      Default is to search the non-network directories as the current
275      user.  You can also use the environment variable `LOCALUSER' to
276      set this user.
278 `--netuser=USER'
279      The user to search network directories as, using `su'.  Default is
280      `daemon'.  You can also use the environment variable `NETUSER' to
281      set this user.
283 \x1f
284 File: find.info,  Node: Database Formats,  Prev: Database Locations,  Up: Databases
286 Database Formats
287 ================
289    The file name databases contain lists of files that were in
290 particular directory trees when the databases were last updated.  The
291 file name database format changed starting with GNU `locate' version
292 4.0 to allow machines with different byte orderings to share the
293 databases.  The new GNU `locate' can read both the old and new database
294 formats.  However, old versions of `locate' and `find' produce incorrect
295 results if given a new-format database.
297 * Menu:
299 * New Database Format::
300 * Sample Database::
301 * Old Database Format::
303 \x1f
304 File: find.info,  Node: New Database Format,  Next: Sample Database,  Up: Database Formats
306 New Database Format
307 -------------------
309    `updatedb' runs a program called `frcode' to "front-compress" the
310 list of file names, which reduces the database size by a factor of 4 to
311 5.  Front-compression (also known as incremental encoding) works as
312 follows.
314    The database entries are a sorted list (case-insensitively, for
315 users' convenience).  Since the list is sorted, each entry is likely to
316 share a prefix (initial string) with the previous entry.  Each database
317 entry begins with an offset-differential count byte, which is the
318 additional number of characters of prefix of the preceding entry to use
319 beyond the number that the preceding entry is using of its predecessor.
320 (The counts can be negative.)  Following the count is a
321 null-terminated ASCII remainder--the part of the name that follows the
322 shared prefix.
324    If the offset-differential count is larger than can be stored in a
325 byte (+/-127), the byte has the value 0x80 and the count follows in a
326 2-byte word, with the high byte first (network byte order).
328    Every database begins with a dummy entry for a file called
329 `LOCATE02', which `locate' checks for to ensure that the database file
330 has the correct format; it ignores the entry in doing the search.
332    Databases can not be concatenated together, even if the first (dummy)
333 entry is trimmed from all but the first database.  This is because the
334 offset-differential count in the first entry of the second and following
335 databases will be wrong.
337 \x1f
338 File: find.info,  Node: Sample Database,  Next: Old Database Format,  Prev: New Database Format,  Up: Database Formats
340 Sample Database
341 ---------------
343    Sample input to `frcode':
345      /usr/src
346      /usr/src/cmd/aardvark.c
347      /usr/src/cmd/armadillo.c
348      /usr/tmp/zoo
350    Length of the longest prefix of the preceding entry to share:
352      0 /usr/src
353      8 /cmd/aardvark.c
354      14 rmadillo.c
355      5 tmp/zoo
357    Output from `frcode', with trailing nulls changed to newlines and
358 count bytes made printable:
360      0 LOCATE02
361      0 /usr/src
362      8 /cmd/aardvark.c
363      6 rmadillo.c
364      -9 tmp/zoo
366    (6 = 14 - 8, and -9 = 5 - 14)
368 \x1f
369 File: find.info,  Node: Old Database Format,  Prev: Sample Database,  Up: Database Formats
371 Old Database Format
372 -------------------
374    The old database format is used by Unix `locate' and `find' programs
375 and earlier releases of the GNU ones.  `updatedb' produces this format
376 if given the `--old-format' option.
378    `updatedb' runs programs called `bigram' and `code' to produce
379 old-format databases.  The old format differs from the new one in the
380 following ways.  Instead of each entry starting with an
381 offset-differential count byte and ending with a null, byte values from
382 0 through 28 indicate offset-differential counts from -14 through 14.
383 The byte value indicating that a long offset-differential count follows
384 is 0x1e (30), not 0x80.  The long counts are stored in host byte order,
385 which is not necessarily network byte order, and host integer word size,
386 which is usually 4 bytes.  They also represent a count 14 less than
387 their value.  The database lines have no termination byte; the start of
388 the next line is indicated by its first byte having a value <= 30.
390    In addition, instead of starting with a dummy entry, the old database
391 format starts with a 256 byte table containing the 128 most common
392 bigrams in the file list.  A bigram is a pair of adjacent bytes.  Bytes
393 in the database that have the high bit set are indexes (with the high
394 bit cleared) into the bigram table.  The bigram and offset-differential
395 count coding makes these databases 20-25% smaller than the new format,
396 but makes them not 8-bit clean.  Any byte in a file name that is in the
397 ranges used for the special codes is replaced in the database by a
398 question mark, which not coincidentally is the shell wildcard to match a
399 single character.
401 \x1f
402 File: find.info,  Node: File Permissions,  Next: Reference,  Prev: Databases,  Up: Top
404 File Permissions
405 ****************
407    Each file has a set of "permissions" that control the kinds of
408 access that users have to that file.  The permissions for a file are
409 also called its "access mode".  They can be represented either in
410 symbolic form or as an octal number.
412 * Menu:
414 * Mode Structure::              Structure of file permissions.
415 * Symbolic Modes::              Mnemonic permissions representation.
416 * Numeric Modes::               Permissions as octal numbers.
418 \x1f
419 File: find.info,  Node: Mode Structure,  Next: Symbolic Modes,  Up: File Permissions
421 Structure of File Permissions
422 =============================
424    There are three kinds of permissions that a user can have for a file:
426   1. permission to read the file.  For directories, this means
427      permission to list the contents of the directory.
429   2. permission to write to (change) the file.  For directories, this
430      means permission to create and remove files in the directory.
432   3. permission to execute the file (run it as a program).  For
433      directories, this means permission to access files in the
434      directory.
436    There are three categories of users who may have different
437 permissions to perform any of the above operations on a file:
439   1. the file's owner;
441   2. other users who are in the file's group;
443   3. everyone else.
445    Files are given an owner and group when they are created.  Usually
446 the owner is the current user and the group is the group of the
447 directory the file is in, but this varies with the operating system, the
448 filesystem the file is created on, and the way the file is created.  You
449 can change the owner and group of a file by using the `chown' and
450 `chgrp' commands.
452    In addition to the three sets of three permissions listed above, a
453 file's permissions have three special components, which affect only
454 executable files (programs) and, on some systems, directories:
456   1. set the process's effective user ID to that of the file upon
457      execution (called the "setuid bit").  No effect on directories.
459   2. set the process's effective group ID to that of the file upon
460      execution (called the "setgid bit").  For directories on some
461      systems, put files created in the directory into the same group as
462      the directory, no matter what group the user who creates them is
463      in.
465   3. save the program's text image on the swap device so it will load
466      more quickly when run (called the "sticky bit").  For directories
467      on some systems, prevent users from removing files that they do
468      not own in the directory; this is called making the directory
469      "append-only".
471 \x1f
472 File: find.info,  Node: Symbolic Modes,  Next: Numeric Modes,  Prev: Mode Structure,  Up: File Permissions
474 Symbolic Modes
475 ==============
477    "Symbolic modes" represent changes to files' permissions as
478 operations on single-character symbols.  They allow you to modify either
479 all or selected parts of files' permissions, optionally based on their
480 previous values, and perhaps on the current `umask' as well (*note
481 Umask and Protection::).
483    The format of symbolic modes is:
485      [ugoa...][[+-=][rwxXstugo...]...][,...]
487    The following sections describe the operators and other details of
488 symbolic modes.
490 * Menu:
492 * Setting Permissions::          Basic operations on permissions.
493 * Copying Permissions::          Copying existing permissions.
494 * Changing Special Permissions:: Special permissions.
495 * Conditional Executability::    Conditionally affecting executability.
496 * Multiple Changes::             Making multiple changes.
497 * Umask and Protection::              The effect of the umask.
499 \x1f
500 File: find.info,  Node: Setting Permissions,  Next: Copying Permissions,  Up: Symbolic Modes
502 Setting Permissions
503 -------------------
505    The basic symbolic operations on a file's permissions are adding,
506 removing, and setting the permission that certain users have to read,
507 write, and execute the file.  These operations have the following
508 format:
510      USERS OPERATION PERMISSIONS
512 The spaces between the three parts above are shown for readability only;
513 symbolic modes can not contain spaces.
515    The USERS part tells which users' access to the file is changed.  It
516 consists of one or more of the following letters (or it can be empty;
517 *note Umask and Protection::, for a description of what happens then).
518 When more than one of these letters is given, the order that they are
519 in does not matter.
522      the user who owns the file;
525      other users who are in the file's group;
528      all other users;
531      all users; the same as `ugo'.
533    The OPERATION part tells how to change the affected users' access to
534 the file, and is one of the following symbols:
537      to add the PERMISSIONS to whatever permissions the USERS already
538      have for the file;
541      to remove the PERMISSIONS from whatever permissions the USERS
542      already have for the file;
545      to make the PERMISSIONS the only permissions that the USERS have
546      for the file.
548    The PERMISSIONS part tells what kind of access to the file should be
549 changed; it is zero or more of the following letters.  As with the
550 USERS part, the order does not matter when more than one letter is
551 given.  Omitting the PERMISSIONS part is useful only with the `='
552 operation, where it gives the specified USERS no access at all to the
553 file.
556      the permission the USERS have to read the file;
559      the permission the USERS have to write to the file;
562      the permission the USERS have to execute the file.
564    For example, to give everyone permission to read and write a file,
565 but not to execute it, use:
567      a=rw
569    To remove write permission for from all users other than the file's
570 owner, use:
572      go-w
574 The above command does not affect the access that the owner of the file
575 has to it, nor does it affect whether other users can read or execute
576 the file.
578    To give everyone except a file's owner no permission to do anything
579 with that file, use the mode below.  Other users could still remove the
580 file, if they have write permission on the directory it is in.
582      go=
584 Another way to specify the same thing is:
586      og-rxw
588 \x1f
589 File: find.info,  Node: Copying Permissions,  Next: Changing Special Permissions,  Prev: Setting Permissions,  Up: Symbolic Modes
591 Copying Existing Permissions
592 ----------------------------
594    You can base part of a file's permissions on part of its existing
595 permissions.  To do this, instead of using `r', `w', or `x' after the
596 operator, you use the letter `u', `g', or `o'.  For example, the mode
598      o+g
600 adds the permissions for users who are in a file's group to the
601 permissions that other users have for the file.  Thus, if the file
602 started out as mode 664 (`rw-rw-r--'), the above mode would change it
603 to mode 666 (`rw-rw-rw-').  If the file had started out as mode 741
604 (`rwxr----x'), the above mode would change it to mode 745
605 (`rwxr--r-x').  The `-' and `=' operations work analogously.
607 \x1f
608 File: find.info,  Node: Changing Special Permissions,  Next: Conditional Executability,  Prev: Copying Permissions,  Up: Symbolic Modes
610 Changing Special Permissions
611 ----------------------------
613    In addition to changing a file's read, write, and execute
614 permissions, you can change its special permissions.  *Note Mode
615 Structure::, for a summary of these permissions.
617    To change a file's permission to set the user ID on execution, use
618 `u' in the USERS part of the symbolic mode and `s' in the PERMISSIONS
619 part.
621    To change a file's permission to set the group ID on execution, use
622 `g' in the USERS part of the symbolic mode and `s' in the PERMISSIONS
623 part.
625    To change a file's permission to stay permanently on the swap device,
626 use `o' in the USERS part of the symbolic mode and `t' in the
627 PERMISSIONS part.
629    For example, to add set user ID permission to a program, you can use
630 the mode:
632      u+s
634    To remove both set user ID and set group ID permission from it, you
635 can use the mode:
637      ug-s
639    To cause a program to be saved on the swap device, you can use the
640 mode:
642      o+t
644    Remember that the special permissions only affect files that are
645 executable, plus, on some systems, directories (on which they have
646 different meanings; *note Mode Structure::).  Using `a' in the USERS
647 part of a symbolic mode does not cause the special permissions to be
648 affected; thus,
650      a+s
652 has _no effect_.  You must use `u', `g', and `o' explicitly to affect
653 the special permissions.  Also, the combinations `u+t', `g+t', and
654 `o+s' have no effect.
656    The `=' operator is not very useful with special permissions; for
657 example, the mode:
659      o=t
661 does cause the file to be saved on the swap device, but it also removes
662 all read, write, and execute permissions that users not in the file's
663 group might have had for it.
665 \x1f
666 File: find.info,  Node: Conditional Executability,  Next: Multiple Changes,  Prev: Changing Special Permissions,  Up: Symbolic Modes
668 Conditional Executability
669 -------------------------
671    There is one more special type of symbolic permission: if you use
672 `X' instead of `x', execute permission is affected only if the file
673 already had execute permission or is a directory.  It affects
674 directories' execute permission even if they did not initially have any
675 execute permissions set.
677    For example, this mode:
679      a+X
681 gives all users permission to execute files (or search directories) if
682 anyone could before.
684 \x1f
685 File: find.info,  Node: Multiple Changes,  Next: Umask and Protection,  Prev: Conditional Executability,  Up: Symbolic Modes
687 Making Multiple Changes
688 -----------------------
690    The format of symbolic modes is actually more complex than described
691 above (*note Setting Permissions::).  It provides two ways to make
692 multiple changes to files' permissions.
694    The first way is to specify multiple OPERATION and PERMISSIONS parts
695 after a USERS part in the symbolic mode.
697    For example, the mode:
699      og+rX-w
701 gives users other than the owner of the file read permission and, if it
702 is a directory or if someone already had execute permission to it,
703 gives them execute permission; and it also denies them write permission
704 to it file.  It does not affect the permission that the owner of the
705 file has for it.  The above mode is equivalent to the two modes:
707      og+rX
708      og-w
710    The second way to make multiple changes is to specify more than one
711 simple symbolic mode, separated by commas.  For example, the mode:
713      a+r,go-w
715 gives everyone permission to read the file and removes write permission
716 on it for all users except its owner.  Another example:
718      u=rwx,g=rx,o=
720 sets all of the non-special permissions for the file explicitly.  (It
721 gives users who are not in the file's group no permission at all for
722 it.)
724    The two methods can be combined.  The mode:
726      a+r,g+x-w
728 gives all users permission to read the file, and gives users who are in
729 the file's group permission to execute it, as well, but not permission
730 to write to it.  The above mode could be written in several different
731 ways; another is:
733      u+r,g+rx,o+r,g-w
735 \x1f
736 File: find.info,  Node: Umask and Protection,  Prev: Multiple Changes,  Up: Symbolic Modes
738 The Umask and Protection
739 ------------------------
741    If the USERS part of a symbolic mode is omitted, it defaults to `a'
742 (affect all users), except that any permissions that are _set_ in the
743 system variable `umask' are _not affected_.  The value of `umask' can
744 be set using the `umask' command.  Its default value varies from system
745 to system.
747    Omitting the USERS part of a symbolic mode is generally not useful
748 with operations other than `+'.  It is useful with `+' because it
749 allows you to use `umask' as an easily customizable protection against
750 giving away more permission to files than you intended to.
752    As an example, if `umask' has the value 2, which removes write
753 permission for users who are not in the file's group, then the mode:
755      +w
757 adds permission to write to the file to its owner and to other users who
758 are in the file's group, but _not_ to other users.  In contrast, the
759 mode:
761      a+w
763 ignores `umask', and _does_ give write permission for the file to all
764 users.
766 \x1f
767 File: find.info,  Node: Numeric Modes,  Prev: Symbolic Modes,  Up: File Permissions
769 Numeric Modes
770 =============
772    File permissions are stored internally as 16 bit integers.  As an
773 alternative to giving a symbolic mode, you can give an octal (base 8)
774 number that corresponds to the internal representation of the new mode.
775 This number is always interpreted in octal; you do not have to add a
776 leading 0, as you do in C.  Mode 0055 is the same as mode 55.
778    A numeric mode is usually shorter than the corresponding symbolic
779 mode, but it is limited in that it can not take into account a file's
780 previous permissions; it can only set them absolutely.
782    The permissions granted to the user, to other users in the file's
783 group, and to other users not in the file's group are each stored as
784 three bits, which are represented as one octal digit.  The three special
785 permissions are also each stored as one bit, and they are as a group
786 represented as another octal digit.  Here is how the bits are arranged
787 in the 16 bit integer, starting with the lowest valued bit:
789      Value in  Corresponding
790      Mode      Permission
791      
792                Other users not in the file's group:
793         1      Execute
794         2      Write
795         4      Read
796      
797                Other users in the file's group:
798        10      Execute
799        20      Write
800        40      Read
801      
802                The file's owner:
803       100      Execute
804       200      Write
805       400      Read
806      
807                Special permissions:
808      1000      Save text image on swap device
809      2000      Set group ID on execution
810      4000      Set user ID on execution
812    For example, numeric mode 4755 corresponds to symbolic mode
813 `u=rwxs,go=rx', and numeric mode 664 corresponds to symbolic mode
814 `ug=rw,o=r'.  Numeric mode 0 corresponds to symbolic mode `ugo='.
816 \x1f
817 File: find.info,  Node: Reference,  Next: Primary Index,  Prev: File Permissions,  Up: Top
819 Reference
820 *********
822    Below are summaries of the command line syntax for the programs
823 discussed in this manual.
825 * Menu:
827 * Invoking find::
828 * Invoking locate::
829 * Invoking updatedb::
830 * Invoking xargs::
832 \x1f
833 File: find.info,  Node: Invoking find,  Next: Invoking locate,  Up: Reference
835 Invoking `find'
836 ===============
838      find [FILE...] [EXPRESSION]
840    `find' searches the directory tree rooted at each file name FILE by
841 evaluating the EXPRESSION on each file it finds in the tree.
843    `find' considers the first argument that begins with `-', `(', `)',
844 `,', or `!' to be the beginning of the expression; any arguments before
845 it are paths to search, and any arguments after it are the rest of the
846 expression.  If no paths are given, the current directory is used.  If
847 no expression is given, the expression `-print' is used.
849    `find' exits with status 0 if all files are processed successfully,
850 greater than 0 if errors occur.
852    *Note Primary Index::, for a summary of all of the tests, actions,
853 and options that the expression can contain.
855    `find' also recognizes two options for administrative use:
857 `--help'
858      Print a summary of the command-line argument format and exit.
860 `--version'
861      Print the version number of `find' and exit.
863 \x1f
864 File: find.info,  Node: Invoking locate,  Next: Invoking updatedb,  Prev: Invoking find,  Up: Reference
866 Invoking `locate'
867 =================
869      locate [OPTION...] PATTERN...
871 `--database=PATH'
872 `-d PATH'
873      Instead of searching the default file name database, search the
874      file name databases in PATH, which is a colon-separated list of
875      database file names.  You can also use the environment variable
876      `LOCATE_PATH' to set the list of database files to search.  The
877      option overrides the environment variable if both are used.
879 `--existing'
880 `-e'
881      Only print out such names that currently exist (instead of such
882      names that existed when the database was created).  Note that this
883      may slow down the program a lot, if there are many matches in the
884      database.
886 `--help'
887      Print a summary of the options to `locate' and exit.
889 `--version'
890      Print the version number of `locate' and exit.
892 \x1f
893 File: find.info,  Node: Invoking updatedb,  Next: Invoking xargs,  Prev: Invoking locate,  Up: Reference
895 Invoking `updatedb'
896 ===================
898      updatedb [OPTION...]
900 `--localpaths='PATH...''
901      Non-network directories to put in the database.  Default is `/'.
903 `--netpaths='PATH...''
904      Network (NFS, AFS, RFS, etc.) directories to put in the database.
905      The environment variable `NETPATHS' also sets this value.  Default
906      is none.
908 `--prunepaths='PATH...''
909      Directories to not put in the database, which would otherwise be.
910      The environment variable `PRUNEPATHS' also sets this value.
911      Default is `/tmp /usr/tmp /var/tmp /afs'.
913 `--prunefs='PATH...''
914      File systems to not put in the database, which would otherwise be.
915      Note that files are pruned when a file system is reached; Any file
916      system mounted under an undesired file system will be ignored.
917      The environment variable `PRUNEFS' also sets this value.  Default
918      is `nfs NFS proc'.
920 `--output=DBFILE'
921      The database file to build.  Default is system-dependent, but
922      typically `/usr/local/var/locatedb'.
924 `--localuser=USER'
925      The user to search the non-network directories as, using `su'.
926      Default is to search the non-network directories as the current
927      user.  You can also use the environment variable `LOCALUSER' to
928      set this user.
930 `--netuser=USER'
931      The user to search network directories as, using `su'(1).  Default
932      is `daemon'.  You can also use the environment variable `NETUSER'
933      to set this user.
935 \x1f
936 File: find.info,  Node: Invoking xargs,  Prev: Invoking updatedb,  Up: Reference
938 Invoking `xargs'
939 ================
941      xargs [OPTION...] [COMMAND [INITIAL-ARGUMENTS]]
943    `xargs' exits with the following status:
946      if it succeeds
949      if any invocation of the command exited with status 1-125
952      if the command exited with status 255
955      if the command is killed by a signal
958      if the command cannot be run
961      if the command is not found
964      if some other error occurred.
966 `--null'
967 `-0'
968      Input filenames are terminated by a null character instead of by
969      whitespace, and the quotes and backslash are not special (every
970      character is taken literally).  Disables the end of file string,
971      which is treated like any other argument.
973 `--eof[=EOF-STR]'
974 `-e[EOF-STR]'
975      Set the end of file string to EOF-STR.  If the end of file string
976      occurs as a line of input, the rest of the input is ignored.  If
977      EOF-STR is omitted, there is no end of file string.  If this
978      option is not given, the end of file string defaults to `_'.
980 `--help'
981      Print a summary of the options to `xargs' and exit.
983 `--replace[=REPLACE-STR]'
984 `-i[REPLACE-STR]'
985      Replace occurrences of REPLACE-STR in the initial arguments with
986      names read from standard input.  Also, unquoted blanks do not
987      terminate arguments.  If REPLACE-STR is omitted, it defaults to
988      `{}' (like for `find -exec').  Implies `-x' and `-l 1'.
990 `--max-lines[=MAX-LINES]'
991 `-l[MAX-LINES]'
992      Use at most MAX-LINES nonblank input lines per command line;
993      MAX-LINES defaults to 1 if omitted.  Trailing blanks cause an
994      input line to be logically continued on the next input line, for
995      the purpose of counting the lines.  Implies `-x'.
997 `--max-args=MAX-ARGS'
998 `-n MAX-ARGS'
999      Use at most MAX-ARGS arguments per command line.  Fewer than
1000      MAX-ARGS arguments will be used if the size (see the `-s' option)
1001      is exceeded, unless the `-x' option is given, in which case
1002      `xargs' will exit.
1004 `--interactive'
1005 `-p'
1006      Prompt the user about whether to run each command line and read a
1007      line from the terminal.  Only run the command line if the response
1008      starts with `y' or `Y'.  Implies `-t'.
1010 `--no-run-if-empty'
1011 `-r'
1012      If the standard input does not contain any nonblanks, do not run
1013      the command.  By default, the command is run once even if there is
1014      no input.
1016 `--max-chars=MAX-CHARS'
1017 `-s MAX-CHARS'
1018      Use at most MAX-CHARS characters per command line, including the
1019      command and initial arguments and the terminating nulls at the
1020      ends of the argument strings.
1022 `--verbose'
1023 `-t'
1024      Print the command line on the standard error output before
1025      executing it.
1027 `--version'
1028      Print the version number of `xargs' and exit.
1030 `--exit'
1031 `-x'
1032      Exit if the size (see the -S option) is exceeded.
1034 `--max-procs=MAX-PROCS'
1035 `-P MAX-PROCS'
1036      Run up to MAX-PROCS processes at a time; the default is 1.  If
1037      MAX-PROCS is 0, `xargs' will run as many processes as possible at
1038      a time.
1040 \x1f
1041 File: find.info,  Node: Primary Index,  Prev: Reference,  Up: Top
1043 `find' Primary Index
1044 ********************
1046    This is a list of all of the primaries (tests, actions, and options)
1047 that make up `find' expressions for selecting files.  *Note find
1048 Expressions::, for more information on expressions.
1050 * Menu:
1052 * !:                                     Combining Primaries With Operators.
1053 * ():                                    Combining Primaries With Operators.
1054 * ,:                                     Combining Primaries With Operators.
1055 * -a:                                    Combining Primaries With Operators.
1056 * -amin:                                 Age Ranges.
1057 * -and:                                  Combining Primaries With Operators.
1058 * -anewer:                               Comparing Timestamps.
1059 * -atime:                                Age Ranges.
1060 * -cmin:                                 Age Ranges.
1061 * -cnewer:                               Comparing Timestamps.
1062 * -ctime:                                Age Ranges.
1063 * -daystart:                             Age Ranges.
1064 * -depth:                                Directories.
1065 * -empty:                                Size.
1066 * -exec:                                 Single File.
1067 * -false:                                Combining Primaries With Operators.
1068 * -fls:                                  Print File Information.
1069 * -follow:                               Symbolic Links.
1070 * -fprint:                               Print File Name.
1071 * -fprint0:                              Safe File Name Handling.
1072 * -fprintf:                              Print File Information.
1073 * -fstype:                               Filesystems.
1074 * -gid:                                  Owner.
1075 * -group:                                Owner.
1076 * -ilname:                               Symbolic Links.
1077 * -iname:                                Base Name Patterns.
1078 * -inum:                                 Hard Links.
1079 * -ipath:                                Full Name Patterns.
1080 * -iregex:                               Full Name Patterns.
1081 * -links:                                Hard Links.
1082 * -lname:                                Symbolic Links.
1083 * -ls:                                   Print File Information.
1084 * -maxdepth:                             Directories.
1085 * -mindepth:                             Directories.
1086 * -mmin:                                 Age Ranges.
1087 * -mount:                                Filesystems.
1088 * -mtime:                                Age Ranges.
1089 * -name:                                 Base Name Patterns.
1090 * -newer:                                Comparing Timestamps.
1091 * -nogroup:                              Owner.
1092 * -noleaf:                               Directories.
1093 * -not:                                  Combining Primaries With Operators.
1094 * -nouser:                               Owner.
1095 * -o:                                    Combining Primaries With Operators.
1096 * -ok:                                   Querying.
1097 * -or:                                   Combining Primaries With Operators.
1098 * -path:                                 Full Name Patterns.
1099 * -perm:                                 Permissions.
1100 * -print:                                Print File Name.
1101 * -print0:                               Safe File Name Handling.
1102 * -printf:                               Print File Information.
1103 * -prune:                                Directories.
1104 * -regex:                                Full Name Patterns.
1105 * -size:                                 Size.
1106 * -true:                                 Combining Primaries With Operators.
1107 * -type:                                 Type.
1108 * -uid:                                  Owner.
1109 * -used:                                 Comparing Timestamps.
1110 * -user:                                 Owner.
1111 * -xdev:                                 Filesystems.
1112 * -xtype:                                Type.