Home Explore Blog CI



man-pages

1st chunk of `find.man`
2471e32a6f2ef502df498d3a0aaa809885979737d899c4f50000000100000fe7
FIND(1)                                                                                              General Commands Manual                                                                                             FIND(1)

NAME
       find - search for files in a directory hierarchy

SYNOPSIS
       find [-H] [-L] [-P] [-D debugopts] [-Olevel] [starting‐point...] [expression]

DESCRIPTION
       This manual page documents the GNU version of find.  GNU find searches the directory tree rooted at each given starting‐point by evaluating the given expression from left to right, according to the rules of precedence
       (see  section  OPERATORS),  until  the outcome is known (the left hand side is false for and operations, true for or), at which point find moves on to the next file name.  If no starting‐point is specified, ‘.’ is as‐
       sumed.

       If you are using find in an environment where security is important (for example if you are using it to search directories that are writable by other users), you should read the ‘Security  Considerations’  chapter  of
       the  findutils documentation, which is called Finding Files and comes with findutils.  That document also includes a lot more detail and discussion than this manual page, so you may find it a more useful source of in‐
       formation.

OPTIONS
       The -H, -L and -P options control the treatment of symbolic links.  Command‐line arguments following these are taken to be names of files or directories to be examined, up to the first argument that begins  with  ‘-’,
       or  the argument ‘(’ or ‘!’.  That argument and any following arguments are taken to be the expression describing what is to be searched for.  If no paths are given, the current directory is used.  If no expression is
       given, the expression -print is used (but you should probably consider using -print0 instead, anyway).

       This manual page talks about ‘options’ within the expression list.  These options control the behaviour of find but are specified immediately after the last path name.  The five ‘real’ options -H, -L, -P,  -D  and  -O
       must appear before the first path name, if at all.  A double dash -- could theoretically be used to signal that any remaining arguments are not options, but this does not really work due to the way find determines the
       end  of  the following path arguments: it does that by reading until an expression argument comes (which also starts with a ‘‐’).  Now, if a path argument would start with a ‘‐’, then find would treat it as expression
       argument instead.  Thus, to ensure that all start points are taken as such, and especially to prevent that wildcard patterns expanded by the calling shell are not mistakenly treated as expression arguments, it is gen‐
       erally safer to prefix wildcards or dubious path names with either ‘./’ or to use absolute path names starting with ’/’.  Alternatively, it is generally safe though non‐portable to use the GNU option  -files0-from  to
       pass arbitrary starting points to find.

       -P     Never  follow  symbolic  links.  This is the default behaviour.  When find examines or prints information about files, and the file is a symbolic link, the information used shall be taken from the properties of
              the symbolic link itself.

       -L     Follow symbolic links.  When find examines or prints information about files, the information used shall be taken from the properties of the file to which the link points, not from the link itself (unless it is
              a broken symbolic link or find is unable to examine the file to which the link points).  Use of this option implies -noleaf.  If you later use the -P option, -noleaf will still be in effect.  If -L is in effect
              and find discovers a symbolic link to a subdirectory during its search, the subdirectory pointed to by the symbolic link will be searched.

              When the -L option is in effect, the -type predicate

Title: find - Search for Files in a Directory Hierarchy
Summary
This document describes the GNU version of the `find` command, a tool for searching files in a directory hierarchy. It explains the command's syntax, options (including symbolic link handling with -H, -L, and -P), and provides guidance on using `find` securely, particularly when searching directories writable by other users. It also covers how find interprets command-line arguments, especially paths, and suggests using prefixes like './' or absolute paths to avoid misinterpretation of wildcards.