RESUME
think[-H] [-L] [-P] [-D debug options] [-Olevel] [startpoint...] [expression]
DESIGNATION
This manual page documents the GNU version ofthink.FIELDthinksearches the directory tree rooted at each start point and evaluates the given expression from left to right according to the precedence rules (see the OPERATORS section) until the result is known (the left side is false formioperations, true foro), at which pointthinkgoes to the next file name. If no starting point is specified, '.' is assumed.
and usethinkIn an environment where security is important (for example, if you are using it to find directories that other users can write to), you should read the "Security Considerations" chapter of the documentation for findutils that is invoked.find filesand comes with findutils. This document also contains much more detail and discussion than this manual page, so you may find it a more useful source of information.
OPTIONS
o-H,-UEmi-PAGEOptions control how symbolic links are handled. Subsequent command line arguments are treated as the names of the files or directories to be examined, up to the first argument beginning with "-" or the "(" or "!" argument. This argument and all The following arguments are considered the expression that describes what to search for. If no path is specified, the current directory is used. If no expression is specified, the expression-pressis used (but you should probably consider using this-print0instead anyway).
This man page talks about `options' within the expression list. These options control the behavior ofthinkbut it is specified immediately after the last pathname. The five "real" options-H,-UE,-PAGE,-Dmi-Ömust precede the first route name, if any. a double bar--it can also be used to signal that all remaining arguments are not options (although it is generally safer to ensure that all leading points start with './' or '/' when using wildcards in the list of leading points).
- -PAGE
- Never follow symbolic links. This is the default behavior. WhenthinkWhen browsing or printing information from a file, and the file is a symbolic link, the information used must be obtained from the properties of the symbolic link itself.
- -UE
- Follow symbolic links. WhenthinkBrowse or print information about files, the information used should be taken from the properties of the file the link points to, and not from the link itself (unless it is a broken symlink orthinkcannot browse the file the link points to). The use of this option implies-no blade.If you then use the-PAGEPossibility,-no bladewill continue to apply. Yeah-UEapplies andthinkfinds a symbolic link to a subdirectory during its search, the subdirectory that the symbolic link points to is searched.
- If he-UEthe option is in effect, the- ArtThe predicate always matches the type of file a symlink points to, rather than the link itself (unless the symlink is broken). Actions that can cause symbolic links to breakthinkrunning (eg.-Clear) can lead to confusing behavior.-UEcause the-Namemi-ilnamePredicates always return false.
- -H
- Do not follow symbolic links except when processing command line arguments. Whenthinkbrowses or prints information about files, the information used must be obtained from the properties of the symbolic link itself. The only exception to this behavior is when a file specified on the command line is a symbolic link and the link can be resolved. For this situation, the information used is taken from the point the link points to (ie, the link is followed). The information about the link itself is used as a fallback if the file that the symlink points to cannot be browsed. Yeah-His active and one of the paths specified on the command line is a symbolic link to a directory, the contents of that directory are examined (although the maximum depth of 0 obviously prevents this).
If more than one of-H,-UEmi-PAGEis specified, each overwrites the others; The last one that appears on the command line takes effect. As is the default, the-PAGEThe option is considered ineffective unless-Ho-UEspecified.
FIELDthinkoften file statistics during processing from the command line itself, before starting a search. These options also affect how these arguments are processed. In particular, there are several tests that compare the files listed on the command line with a file we are currently considering. In each case, the file specified on the command line was examined and some of its properties were saved. If the named file is actually a symbolic link and the-PAGEoption is active (or if none-Hno-UEspecified), the information used for the comparison is taken from the properties of the symbolic link. Otherwise, it is removed from the properties of the file the link points to. Yeahthinkcannot follow the link (for example, because you do not have sufficient permissions or the link points to a file that does not exist), the properties of the link itself are used.
If he-Ho-L options are in effect, all symbolic links are listedas an argument from-lastthe reference is removed and the timestamp is removed from the file to which the symbolic link points. The same reasoning applies to-nuevoXY,- a young manmi-cneuer.
o-CrossThe option has a similar effect to-UE, although it takes effect the moment it appears (that is, when-UEalthough it is not used-Crossi.e. any symlinks that appear after it-Crossin the command line they are dereferenced and the previous ones are not).
- -D debugging options
- print diagnostic information; This can be helpful in diagnosing why the problemsthinkit doesn't do what you want. The list of debugging options must be separated by commas. Compatibility of debugging options between versions of findutils is not guaranteed. See the output of for a complete list of valid debugging options.find -DHelpValid debugging options include
- executive
- Show diagnostic information about -exec, -execdir, -ok and -okdir
- Help
- Explain debugging options.
- select
- Print diagnostic information for expression tree optimization; see -O option.
- quotes
- Prints a summary of the number of times each predicate succeeded or failed.
- Seek
- Navigate in detail through the directory tree.
- Condition
- Print messages when files are scanned withConditionmilstatsystem calls. thethinkThe program tries to minimize such calls.
- Baum
- See the expression tree in its original and optimized form.
- - They are
- Enable query optimization. thethinkthe program rearranges the tests to speed up execution while preserving the overall effect; That is, predicates with side effects do not reorder each other. The optimizations performed at each optimization level are as follows.
- 0
- Corresponds to optimization level 1.
- 1
- This is the default optimization level and corresponds to traditional behavior. The expressions are reordered so that the tests are based solely on the filenames (eg.-Namemi- Regex) are executed first.
- 2
- neither- Arto- xtipoThe tests run after any tests that rely only on filenames, but before any tests that require inode information. In many modern versions of Unix, file types are returnedlearndir()Therefore, these predicates are faster to evaluate than predicates that have to initialize the file first. If you use the- kind ofFOOPredicate and specify a file system typeFOOwhich is currently unknown (ie, exists in `/etc/mtab').thinkbegins, this predicate is equivalent to-INCORRECT.
- 3
- At this optimization level, the full cost based query optimizer is enabled. The order of the tests is changed so that the cheap (ie fast) tests are run first and the more expensive tests are run later, if necessary. Within each cost range, predicates will sooner or later be evaluated based on whether or not they are likely to succeed. To-Ö, predicates with probability of success are evaluated first and, for example,-a, the predicates that are likely to fail are evaluated first.
- The cost-based optimizer has a fixed idea of the probability of success of any test. In some cases, probability takes into account the specific nature of the test (eg.-Type fshould have a better chance of success than-Type c). The cost-based optimizer is evaluated. If it doesn't really improve the performance of thethink, it will be deleted again. On the other hand, settings that prove to be reliable, robust, and effective may be activated at lower setting levels over time. However, the default behavior (ie optimization level 1) will not change in the 4.3.x release series. The findutils test suite runs all teststhinkat each optimization level and ensures that the result is the same.
EXPRESSION
The part of the command line after the list of start points is theExpressionThis is a type of query specification that describes how we match files and what we do with the matching files. An expression is a sequence of things:
- testicles
- The tests return a true or false value, usually based on some property of a file we are considering. the-office hourFor example, the test is true only if the current file is empty.
- Behaviour
- Actions have side effects (such as printing something to stdout) and return true or false, usually based on success or failure. the-pressFor example, the action writes the name of the current file to standard output.
- global options
- Global options affect the operation of tests and actions specified anywhere on the command line. Global options always return true. the-Depthoption to do for examplethinktraverse the file system in order of depth.
- positional options
- Position options affect only the tests or actions that follow them. Position options always return true. the-regextypeFor example, the option is positional and specifies the regular expression dialect for regulatory expressions that appear later on the command line.
- operator
- Operators connect the other elements within the expression. These include, for example-Ö(means logical OR) and-a(means logical AND). If an operator is missing,-ais assumed.
If the entire expression contains no action other than-Plumo-press,-pressruns on all files for which the entire expression is true.
o-ClearThe action also works as an option (since it implies-Depth).
POSITION OPTIONS
Position options always return true. They only affect tests that are performed later on the command line.
- - Start of the day
- measurement times (eg.-amin,-one moment,-cmin,-ctime,-mm, z-mtime) from the beginning of today instead of 24 hours ago. This option only affects tests that then appear on the command line.
- -Cross
- Disrupted; use the-UEoption instead. Dereference symbolic links.-no blade.Ö-CrossThe option only affects tests that appear later on the command line. unless he-Ho-UEoption was specified, the position of the-Crossoption changes the behavior of the-lastPredicate; all files listed as argument f-lastthey are dereferenced if they are symbolic links. The same reasoning applies to-nuevoXY,- a young manmi-cneuer.. In the same way that- ArtThe predicate always matches the type of file a symbolic link points to, not the link itself.-Crosscause the-name and-ilnamePredicates always return false.
- -regextypeuntil
- Changes the regular expression syntax understood by- Regexmi-iregexTests that are run later on the command line. To see what types of regular expressions are known, use-regextypeHelp.The Texinfo documentation (seeI GET ITtuberculosis) explains the meaning and differences between the different types of regular expressions.
- -advertir, -nowarn
- Enable or disable alerts. These warnings apply only to command line usage, not to conditions thatthinkit can be found by searching directories. The default behavior is the same-to warnwhen standard input is a tty, and for-saberbesides. If there is a warning about using the command line, the exit status will bethinkIt is not affected. If the environment variable POSIXLY_CORRECT is set and-warn is used, it does not specify which warnings, if any, are active.
GLOBAL OPTIONS
Global options always return true. Global options also take effect for tests previously run on the command line. To avoid confusion, global options should be specified on the command line after the start point list, just before the first test, position option, or action. If you specify a global option elsewhere,thinkprints a warning message explaining that this can be confusing.
Global options come after the starting point list and are therefore not the same option type as-UE,for example.
- -d
- Synonymous with depth, with compatibility with FreeBSD, NetBSD, MacOS X and OpenBSD.
- -Depth
- Process the content of each directory before the directory itself. The delete action also implies-Depth.
- -Help help
- Print a summary of command line usage fromthinky ve.
- -ignore_readdir_race
- Principally,thinkprints an error message if a file cannot be started. If you specify this option, a file will be deleted in the meantimethinkreads the file name from the directory and tries not to print an error message when trying to find the file. This also applies to files or directories whose names are specified on the command line. This option takes effect as soon as the command line is read, which means that you will not be able to scan part of the file system when this option is on, and part of it when this option is off (if necessary, you must enter twothinkcommands, one with option and one without).
- - Max deeplevels
- go to the maxlevels(a non-negative integer) Directory levels below thresholds.- max depth 0
it simply means applying the tests and actions to the starting points themselves. - -min depthlevels
- Do not apply patches or actions at levels belowlevels(a non-negative integer).-min depth 1means to process all files except starting points.
- -Mount
- Do not remove directories on other file systems. An alternate name for-xdev, for compatibility with some other versions ofthink.
- -noignore_readdir_race
- Turn off the effect-ignore_readdir_race.
- -no blade
- Don't optimize directories assuming they contain 2 fewer subdirectories than the number of your hard links. This option is required when searching for file systems that do not follow the Unix directory binding convention, such as . B. CD-ROM or MS-DOS file systems or AFS volume mount points. Every directory in a normal Unix file system has at least 2 hard links: its name and its '.' Forbidden. Also, its subdirectories (if any) have a '..' entry associated with that directory. Whenthinklooked at a directory and declared 2 subdirectories less than the directory's link count, it knows that the remaining entries in the directory are not directories ("leaf" files in the directory tree). If you only need to parse the filenames, you don't need to declare them; this leads to a significant increase in search speed.
- -Version, -Version
- press thethinkversion number and exit.
- -xdev
- Do not remove directories on other file systems.
TESTICLES
Some tests for example-nuevoXYmi- same file, allows comparison between the currently browsed file and a reference file specified on the command line. When these tests are used, the interpretation of the reference file is determined by the options-H,-UEmi-PAGEand all of the above-Cross, but the reference file is only examined once when parsing the command line. If the referenced file cannot be examined (for example, theCondition(2) for this the system call fails), an error message is issued andthinkexits with a non-zero status.
Numeric arguments can be specified as
- +n
- For more thannorte,
- -norte
- for less thannorte,
- norte
- for exactlynorte.
- -aminnorte
- The file was last accessednorteA few minutes ago.
- - a young manarchive
- The file was last accessed asarchiveIt has been modified. Yeaharchiveis a symbolic link and the-Hoption or the-UEis enabled, the access time of the file it points to is always used.
- -one momentnorte
- The file was last accessednorte*24 hours ago. When finding how many 24-hour periods ago the file was last accessed, any fractions are ignored for a match-one moment+1, at least one file must have been accessedFromDays ago.
- -cminnorte
- The file status was last modified.norteA few minutes ago.
- -cneuerarchive
- File status was last changed asarchiveIt has been modified. Yeaharchiveis a symbolic link and the-Hoption or the-UEis enabled, the state change time of the file it points to is always used.
- -ctimenorte
- The file status was last modified.norte*24 hours ago See comments for-one momentunderstand how rounding affects the interpretation of file state modification times.
- -office hour
- The file is empty and is a normal file or directory.
- -executable
- Matches files that are executables and directories that are searchable (in the sense of file name resolution). This takes into account ACLs and other permission artifacts that the-Permanenteignore test. They are tests of use oraccess(2) System call and thus can be fooled by NFS servers doing UID mapping (or root squashing) as many systems implementaccess(2) In the client's kernel and therefore cannot use the UID mapping information stored on the server. Because this test is only based on the result of theaccess(2) System call, there is no guarantee that a file that passes this test can actually be executed.
- -INCORRECT
- Always wrong
- - kind ofuntil
- The file resides on a file system of typeuntil. The valid file system types vary between different versions of Unix; A partial list of file system types supported by one version of Unix or another is: ufs, 4.2, 4.3, nfs, tmp, mfs, S51K, S52K. You can use-printfwith the %F directive to display the types of your file systems.
- -gidnorte
- The numeric group ID of the file isnorte.
- -GroupName
- The file belongs to the group.Name(Allowed Numeric Group ID).
- -ilnamestandardize
- In focus-Name, but the match is not case sensitive. If he-UEoption or the-Crossis active, this test returns false unless the symlink is broken.
- - Foamstandardize
- In focus-Name, but the match is not case sensitive. For example, the patterns `fo*' and `F??' matches filenames `Foo', `FOO', `foo', `fOo', etc. The pattern "*foo*" also matches a file called ".foobar".
- they have been drinkingnorte
- The file has an inode numbernorte. It's usually easier to use those- same filetry instead.
- -iPfadstandardize
- In focus-Outside.but the comparison is not case sensitive.
- -iregexstandardize
- In focus- Regex, but the match is not case sensitive.
- -iFull namestandardize
- See -ipath. This alternative is less portable than-iPfad.
- -Linksnorte
- the file hasnorteconnections.
- -Namestandardize
- The file is a symbolic link whose content matches the shell patternstandardize. Metacharacters do not handle `/' or `. particularly. If he-UEoption or the-Crossis active, this test returns false unless the symlink is broken.
- -mmnorte
- File dates were last modifiednorteA few minutes ago.
- -mtimenorte
- File dates were last modifiednorte*24 hours ago See comments for-one momentUnderstand how rounding affects the interpretation of file modification times.
- -Namestandardize
- The file name base (the path with the root directories removed) conforms to the shell patternstandardize. Since the root directories have been removed, the file names are taken into account for a match-Namewill never contain a slash, so `-name a/b' will never match anything (you'll probably need to use-Outsideinstead of). Attempting to do this will result in a warning unless the POSIXLY_CORRECT environment variable is set. Metacharacters (`*', `?' and `[]') match a `.' at the beginning of the base name (this is a change in findutils-4.2.2; see the STANDARDS COMPLIANCE section below). To ignore a directory and the underlying files, use-Plum; see an example in the description of-OutsideParentheses are not recognized as special, although some shells, including bash, give special meaning to parentheses in shell standards. File name comparison is done with thefn party(3) library function. Don't forget to enclose the pattern in quotes to protect it from shell expansion.
- -lastarchive
- The file was recently modified asarchive. Searchiveis a symbolic link and the-Hoption or the-UEis enabled, the modification time of the file it points to is always used.
- -nuevoXYrealize
- Success if timestampXof the file viewed is newer than the timestampYthe filerealize. LettersXmiYcan be one of the following letters:
a file access timerealize B The birth time of the file.realize C The inode state change time fromrealize metro The file modification time.realize t realizeis interpreted directly as time Some combinations are not valid; For example, it is not valid forXbe yourst.Some combinations are not implemented on all systems; for exampleBit is not compatible with all systems. If an invalid or unsupported combination ofXYspecified, a fatal error occurs. Times are interpreted in the same way as for the argument.-dGNU optionmeeting.If you try to use the birth time from a reference file and the birth time cannot be determined, a fatal error message is displayed. If you specify a test that references the creation time of the examined files, this test will fail for all files for which the creation time is unknown.
- -no group
- No groups match the file's numeric group ID.
- -nouser
- No user matches the file's numeric user ID.
- -Outsidestandardize
- Filename matches shell patternstandardize. Metacharacters do not handle `/' or `. particularly; for example
distance -Route "./sr*sc"
prints an entry for a directory named `./src/misc' (if it exists). To skip an entire directory tree, use-Pluminstead of checking each file in the tree. For example, to skip the `src/emacs' directory and all files and directories under it and print the names of other files found, do the following:
find -ruta ./src/emacs -prune -o -print
Note that the pattern matching test applies to the entire file name, starting at one of the named start points on the command line. It would only make sense to use an absolute pathname here if the relevant starting point is also an absolute path. That means this command will never match anything:
find bar -ruta /foo/bar/myfile -print
compare those-OutsideAn argument that concatenates a directory name and the base name of the file you are examining. Since concatenation never ends with a slash,-OutsideArguments ending in a slash do not match anything (except perhaps a starting point specified on the command line). the predicate-Outsidealso supports HP-UXthinkand will be included in a future version of the POSIX standard. - -PermanenteOutside
- File permission bits are accurateOutside(octal or symbolic). Because an exact match is required, you may need to supply a rather complex mode string if you want to use this form for symbolic modes. For example, '-perm g=w' will only search for files that have mode 0020 (ie those for which group write permission is the only permission). You will most likely want to use the '/' or '-' forms, eg '-perm -g=w', which matches any file with group write permissions. Watch theEXAMPLESsection for some illustrative examples.
- -permanente-Outside
- All permission bitsOutsideare defined for the file. Symbolic modes are supported in this format, and this is generally how you want to use them. You must specify 'u', 'g', or 'o' when using symbolic mode. Watch theEXAMPLESsection for some illustrative examples.
- -permanente /Outside
- All permission bitsOutsideare defined for the file. Symbolic modes are accepted in this form. You must specify 'u', 'g', or 'o' when using symbolic mode. Watch theEXAMPLESsection for some illustrative examples. If there are no authorization bits in itOutsideare defined, this test will match any file (the idea here is to be consistent with the behavior of-Permanente-000).
- -duration +Outside
- This is no longer supported (and has been deprecated since 2005). Use-permanente /Outsideinstead of.
- -legible
- Matches files that are readable. This accounts for ACLs and other permission artifacts that the-Permanenteignore test. They are tests of use oraccess(2) System call and thus can be fooled by NFS servers doing UID mapping (or root squashing) as many systems implementaccess(2) In the client's kernel and therefore cannot use the UID mapping information stored on the server.
- - Regexstandardize
- Filename matches regular expressionstandardize. This is a complete match, not a search. For example, to match a file named "./fubar3", you can use the regular expression ".*bar". or `.*b.*3', but not `f.*r3'. Regular expressions are understood bythinkare Emacs regular expressions by default, but this can be changed with-regextypePossibility.
- - same fileName
- The file points to the same inode asName. When-UEis effective, this can include symlinks.
- -Sizenorte[cwbkMG]
- file usednorteSpatial units, rounded up. The following suffixes can be used:
- "b"
- for 512-byte blocks (this is the default if no suffix is used)
- "C"
- professional bytes
- "w"
- for two-byte words
- "k"
- in kilobytes (units of 1024 bytes)
- 'METRO'
- in megabytes (units of 1048576 bytes)
- "GRAMS"
- in gigabytes (units of 1073741824 bytes)
- The size does not count indirect blocks, but it does count blocks in sparse files that are not actually allocated. Remember that the '%k' and '%b' format specifiers are used by-printfHandle sparse files differently. The `b' suffix always denotes 512-byte blocks and never 1-kilobyte blocks, which differs from the behavior of-ls.
- The prefixes + and - mean greater than and less than, as usual. Remember that the size is rounded to the nearest unit. Therefore-Size -1Mis not synonymous with-Size -1048576c.The former only matches empty files, the latter matches files from 1 to 1,048,575 bytes.
- -TRUE
- Always true.
- - ArtC
- The file is of typeC:
- b
- special block (buffered)
- C
- Special characters (unbuffered).
- d
- directory
- pag
- named pipe (FIFO)
- F
- normal dates
- UE
- symbolic link; that is never true when the-UEoption or the-CrossThe option is effective unless the symbolic link is broken. If you want to search symbolic links when-UEis in effect, use- xtipo.
- s
- Plug
- D
- Portal (Solaris)
- To search for more than one type at a time, you can provide the combined list of type letters separated by a comma `,' (GNU extension).
- -uidnorte
- The numeric user ID of the file isnorte.
- -dressednorte
- The file was last accessednorteDays since the last time your status was changed.
- -of the userNameless
- The file is owned by the user.Nameless(Allowed Numeric User ID).
- -Full namestandardize
- See route. This alternative is less portable than-Outside.
- -writable
- Matches the writable files. This accounts for ACLs and other permission artifacts that the-Permanenteignore test. They are tests of use oraccess(2) System call and thus can be fooled by NFS servers doing UID mapping (or root squashing) as many systems implementaccess(2) In the client's kernel and therefore cannot use the UID mapping information stored on the server.
- - xtipoC
- The same as- Artunless the file is a symbolic link. For symbolic links: if the-Ho-PAGEThe option is true if the file is a link to a file of typeC; yes or-UEOption specified, true ifCand me'. In other words, for symbolic links,- xtipoCheck file type- Artdoes not check.
- -Contextstandardize
- (SELinux only) File security context matches globstandardize.
BEHAVIOUR
- -Clear
- Delete files; true if the removal is successful. If the removal fails, an error message is issued. Yeah-ClearError,think'The exit status will be different from zero (in case of eventual exit).-Clearturn on automatically-Depth'Possibility.
SuggestionsNote: Don't forget that the search command line evaluates to an expression, so put-ClearI will do it firstthinkTry to remove everything below the specified thresholds. When trying athinkCommand line you want to use later-Clear, you must specify it explicitly-Depthto avoid surprises later. why-Clearthat means-Depth, cannot be used sensibly-Plummi-Cleartogether.
- -executivedomain;
- Rundomain; true if status 0 is returned. All of the following arguments in favor ofthinkare considered command arguments until one argument consists of ';' it's found. The string "{}" is replaced with the name of the file currently being processed wherever it appears in command arguments, not just arguments where it stands alone, as in some versions ofthink.Both constructs may need to be escaped (with a `\') or quoted to protect them from shell expansion. Watch theEXAMPLESUsage Examples Section-executivePossibility. The specified command is executed once for each matching file. The command is executed in the home directory. There are unavoidable security issues when using-executiveAction; you have to use those-ejectoroption instead.
- -executivedomain{} +
- This variant of-executivethe action runs the specified command on the selected files, but the command line is created by appending each selected filename to the end; The total number of command calls is much less than the number of corresponding files. The command line is structured the same asxargscreate your command lines. Only one instance of `{}' is allowed within the command. The command is executed in the home directory. If any call returns a non-zero exit status, thenthinkreturns a non-zero exit status. Yeahthinkfinding an error can sometimes result in an immediate exit, so some pending commands may not be executed. This variant of-executivealways returns true.
- -ejectordomain;
- -ejectordomain{} +
- In focus-executive, but the specified command is executed from the subdirectory containing the appropriate file, which is usually not the directory it started fromthink.This is a much safer method of invoking commands, as it avoids race conditions when resolving paths to matching files.-executiveAction, the '+' form of-ejectorcreates a command line to process more than one matching file, but each call todomainit just lists the files that exist in the same subdirectory. If you use this option, you must ensure that your$RUTAThe environment variable does not refer to `.'; Otherwise, an attacker could execute any command and leave an appropriately named file in a directory where he will execute it.-ejector.The same applies to entries in$RUTAwhich are empty or are not absolute directory names. If any call returns a non-zero exit status, thenthinkreturns a non-zero exit status. Yeahthinkfinding an error can sometimes result in an immediate exit, so some pending commands may not be executed. The result of the action depends on whether the+or the;the variant is used;-ejectordomain{} +always returns true while-ejectordomain{} ;returns true only ifdomainreturns 0.
- -flsarchive
- TRUE; What-lsbut write toarchiveIn focus-fprint.The output file is always created even if the predicate never matches. Watch theUNUSUAL FILE NAMESSection for information on handling unusual characters in file names.
- -fprintarchive
- TRUE; Print the full file name in the filearchive. Searchivedoes not exist whenthinkit is running, it is being created; If it is present, it will be truncated. The filenames `/dev/stdout' and `/dev/stderr' are treated special; refer to the standard output and standard error, respectively. The output file is always created even if the predicate never matches. Watch theUNUSUAL FILE NAMESSection for information on handling unusual characters in file names.
- -fprint0archive
- TRUE; What-print0but write toarchiveIn focus-fprint.The output file is always created even if the predicate never matches.UNUSUAL FILE NAMESSection for information on handling unusual characters in file names.
- -fprintfarchive Format
- TRUE; What-printfbut write toarchiveIn focus-fprint.The output file is always created even if the predicate never matches.UNUSUAL FILE NAMESSection for information on handling unusual characters in file names.
- -ls
- TRUE; list the current file inls-dilsformat on stdout. Block counts are 1K blocks unless the POSIXLY_CORRECT environment variable is set, in which case 512-byte blocks are used. Watch theUNUSUAL FILE NAMESSection for information on handling unusual characters in file names.
- -OKdomain;
- In focus-executivebut ask the user first. If the user agrees, run the command. Otherwise, just return false. When the command is executed, its standard input is redirected using/dev/null.
- The response to the prompt is compared to a pair of regular expressions to determine if the response is positive or negative. This regular expression is retrieved from the system if the 'POSIXLY_CORRECT' environment variable is set, or otherwisethink'News translations. If the system does not have a proper configuration,think'The initial definition is used. In both cases, the interpretation of the regular expression itself is affected by the environment variables 'LC_CTYPE' (character classes) and 'LC_COLLATE' (character range and equivalence classes).
- - it's okaydomain;
- In focus-ejectorbut ask the user first in the same way as for-OK.If the user doesn't agree, just return false. When the command is executed, its standard input is redirected using/dev/null.
- -press
- TRUE; prints the full filename to standard output, followed by a new line. If you direct the exit ofthinkin another program, and there's even the slightest chance that the files you're looking for might contain a newline, then you should seriously consider using that-print0option instead-press.Watch theUNUSUAL FILE NAMESSection for information on handling unusual characters in file names.
- -print0
- TRUE; prints the full filename to standard output, followed by a null character (instead of the newline character that-pressUse). This allows programs that process the file to correctly interpret file names that contain newlines or other types of spaces.thinkDeparture. This option corresponds to-0option ofxargs.
- -printfFormat
- TRUE; FastFormaton standard output, interpret the `\'escapes and `%' directives. Field widths and precisions can be specified with the C function `printf'. Note that many of the fields are printed as %s instead of %d and this could mean that the flags are not working as expected. It also means that the `-' flag works (forces fields to be left-aligned). Different-press,-printfIt does not add a new line to the end of the string. The escape characters and directives are:
- \a
- Alarm.
- \b
- recoil
- \C
- Immediately stop printing from this format and discard the output.
- \F
- Food form.
- \norte
- new line.
- \r
- Return by carriage.
- \t
- Landscape orientation.
- \v
- From verticals.
- \0
- ASCII-NULO.
- \\
- A literal backslash (`\').
- \NNN
- The character whose ASCII code is NNN (octal).
A `\' character followed by another character is treated as a normal character, so both are printed.
- %%
- A literal percent sign.
- %a
- The time of the last access to the file, in the format returned by the C function `ctime'.
- %Ak
- The last access time of the file in the specified formatk, which is either `@' or a directive to the C function `strftime'. The possible values ofkThey are listed below; some of them may not be available on all systems due to differences in `strftime' between systems.
- @
- Seconds since January 1, 1970 00:00 GMT, with fractions.
time fields:
- H
- Time (00..23)
- UE
- Time (01..12)
- k
- Time (0..23)
- UE
- time (1..12)
- METRO
- minutes (00..59)
- pag
- AM or PM of the location
- r
- Time, 12 hours (hh:mm:ss [AP]M)
- S
- second (00.00 .. 61.00). There is a fraction.
- T
- hour, 24 hours (hh:mm:ss.xxxxxxxxxx)
- +
- Date and time separated by "+", for example "2004-04-28+22:22:05.0". This is a GNU extension. The time is given in the current time zone (which can be affected by setting the TZ environment variable). The seconds field contains a fraction.
- X
- Temporal representation of the locality (H:M:S). The seconds field contains a fraction.
- Z
- Time zone (for example, EDT) or nothing if no time zone can be determined
Date fields:
- a
- abbreviated name of the local day of the week (Sun..Sat)
- A
- Full name of the locale day of the week, variable length (Sunday...Saturday)
- b
- Abbreviated local month name (Jan..Dec.)
- B
- full month place name, variable length (January...December)
- C
- Local date and time (Saturday, November 4, 12:02:33 PM EST 1989). The format is the same as forctime(3) To maintain compatibility with this format, there is no fraction in the seconds field.
- d
- Day of the month (01..31)
- D
- Fecha (dd/mm/aa)
- h
- the same as b
- j
- Day of the year (001..366)
- metro
- Mes (01..12)
- ella
- Week number of the year with Sunday as the first day of the week (00..53)
- W
- Day of the week (0..6)
- C
- Week number of the year with Monday as the first day of the week (00..53)
- X
- Local date representation (MM/DD/YY)
- j
- the last two digits of the year (00..99)
- Y
- again (1970...)
- %b
- The space used for this file in blocks of 512 bytes. Because space is allocated in multiples of the file system block size, it is typically larger than %s/512, but may be smaller if the file is sparse.
- %C
- Time of the last state change of the file in the format returned by the C function `ctime'.
- %Ck
- Time of the last state change of the file in the specified formatk, which is the same as for %A.
- %d
- depth of the file in the directory tree; 0 means the file is a starting point.
- %D
- The device number on which the file exists (the st_dev field of structstat), in decimal.
- %F
- Filename with all root directories removed (only the last item).
- %F
- type of file system on which the file resides; this value can be used for -fstype.
- % grams
- File group name or numeric group ID if the group has no name.
- % GRAMS
- Numeric group ID of the file.
- % h
- File name parent directories (all but the last item). If the filename does not contain slashes (since it is in the current directory), the %h specifier expands to ".".
- %H
- Starting point where the file was found.
- %UE
- File inode number (decimal).
- %k
- The space used for this file in 1K blocks. Since space is allocated in multiples of the file system block size, it is typically greater than %s/1024, but may be less if the file is sparse.
- %UE
- Symbolic link object (empty string if the file is not a symbolic link).
- %metro
- File permission bits (in octal). This option uses the "traditional" numbers used by most Unix implementations, but if your particular implementation uses an unusual octal permission bit order, you will see a difference between the actual value of the file mode and the output of %m . Normally you want this number to have a leading zero, and that's what you would use#Indicator (as in `%#m').
- %METRO
- File permissions (in symbolic form, such asls). This directive is supported in findutils 4.2.5 and later.
- %norte
- Number of hard links to the file.
- %page
- file name.
- %PAGE
- Removed the file name with the name of the starting point where it was found.
- %s
- File size in bytes.
- %S
- sparse file. This is calculated as (BLOCKSIZE*st_blocks /st_size). The exact value you get for a typical file of a given size depends on the system. However, sparse files typically have values less than 1.0, and files that use indirect blocks can have values greater than 1.0. The value used for BLOCKSIZE is system dependent, but is typically 512 bytes. If the file size is zero, the printed value is undefined. On systems that do not support st_blocks, the spread of a file is assumed to be 1.0.
- %t
- The time the file was last modified in the format returned by the C function `ctime'.
- %Tk
- Time the file was last modified in the specified formatk, which is the same as for %A.
- %Ella
- File username or numeric user ID if the user does not have a name.
- %YOU
- Numeric user ID of the file.
- %y
- file type (as inls-l),U=unknown type (must not occur)
- %J
- File type (eg %y) plus the following symlinks: L=loop, N=none
- %Z
- (SELinux only) The security context of the file.
- %{ %[ %(
- Reserved for future use.
A '%' character followed by another character will be discarded, but the other character will be printed (do not rely on this as other formatting characters may be introduced). A '%' at the end of the format argument causes undefined behavior as there are no subsequent characters. In some places it can hide the door keys, while in others it can remove the last page of the novel you are reading.
The %m and %d directives support the#,0mi+flags, but the other directives don't, although they do print numbers. Include numeric directives that do not support these flagsGRAMS,ella,b,D,kminorteThe `-' format flag is supported and changes the alignment of a field from right justified (default) to left justified.
Watch theUNUSUAL FILE NAMESSection for information on handling unusual characters in file names.
- -Plum
- TRUE; If the file is a directory, don't go there. Yeah-Depthit is given, false; without effect. why-Clearthat means-Depth, cannot be used sensibly-Plummi-Cleartogether.
- -leaving
- go immediately No child processes are executed, but other paths specified on the command line are not processed. For example,encuentra /tmp/foo /tmp/bar -print -quitit is only printed/tmp/foo.All command lines built with-ejec ... {} +called beforethinkexits The exit status may or may not be null depending on whether an error has already occurred.
SERVER
Listed in descending order:
- (Expression)
- enforce priority. Since parentheses are special to the shell, you should generally enclose them in quotes. Many of the examples in this manual page use backslashes for this purpose: `\(...\)' instead of `(...)'.
- !Expression
- true yesExpressionis false This character should also generally be escaped from shell interpretation.
- -NoExpression
- same !Expression, but not POSIX compliant.
- expression1 expression2
- Two consecutive terms are joined with an implied "and";expression2will not be evaluated ifexpression1it's false
- expression1-aexpression2
- sameexpression1 expression2.
- expression1-miexpression2
- sameexpression1 expression2, but not POSIX compliant.
- expression1-Öexpression2
- O;expression2will not be evaluated ifexpression1It's true.
- expression1-oexpression2
- sameexpression1-Öexpression2, but not POSIX compliant.
- expression1,expression2
- Ready; Bothexpression1miexpression2are always evaluated. The value ofexpression1discarded; The list value is the value ofexpression2. The comma operator can be useful for looking up many different things, but only for traversing the file system hierarchy once. the-fprintfThe action can be used to list multiple matching items in multiple different output files.
Realise-awhether it is specified implicitly (for example, by two tests appearing without an explicit operator between them) or explicitly has a higher precedence than-Ö.This means thatthink . -filename -o -filename b -printwill never printconvey a message.
UNUSUAL FILE NAMES
Many of the actionsthinkresult in the printing of data controlled by other users. This includes file names, sizes, modification times, etc. Filenames are a potential problem as they can contain any characters except `\0' and `/'. Unusual characters in filenames can do unexpected and often undesirable things to your terminal (for example, change function key settings on some terminals). Unusual characters are treated differently by different actions, as described below.
- -print0, -printprint0
- Always send the exact filename without changes, even when sending to a terminal.
- -ls, -fls
- Unusual characters are always masked. Whitespace, backslash, and double quotes are printed with C-style escape characters (for example, `\f', `\"'). Other unusual characters are printed with octal escape characters. Other printable characters (for example,-lsmi-flsthese are the characters between octal 041 and 0176) are printed without change.
- -printf, -fprintf
- If the output does not go to a terminal, it is printed as-is. Otherwise, the result depends on which directive is used. The %D, %F, %g, %G, %H, %Y, and %y directives are expanded to values that are not under the control of the file's owners and are therefore printed as-is. The %a, %b, %c, %d, %i, %k, %m, %M, %n, %s, %t, %u, and %U directives have values that are controlled by the file owner, but that they cannot be used to send any data to the terminal and are therefore printed unchanged. The directives %f, %h, %l, %p and %P are referenced. This quote works the same as for GNUls.This is not the same citation mechanism used to-lsmi-fls.If you can decide which format to use for the outputthinkTherefore, it is usually better to use `\0' as a terminator than to use new lines, since file names can contain spaces and new line characters. The setting of the 'LC_CTYPE' environment variable is used to determine which characters should be quoted.
- -print, -print
- The quote is treated as if it were-printfmi-fprintf.and usethinkin a script or in a situation where matching files may have arbitrary names, consider using-print0instead of-press.
o-OKmi- it's okayThe actions output the current file name unchanged. This may change in a future version.
COMPLIANCE WITH STANDARDS
For further compliance with the POSIX standard, you should set the POSIXLY_CORRECT environment variable. The following options are specified in the POSIX standard (IEEE Std 1003.1, 2003 Edition):
- -H
- This option is supported.
- -UE
- This option is supported.
- -Name
- This option is supported, but POSIX compliance depends on the POSIX compliance of the systemfn party(3) library function. As of findutils-4.2.2, shell metacharacters (for example, "*", "?", or "[]") match a ".". initially because the interpretation of IEEE PASC 126 requires it. This is a change from previous versions of findutils.
- - Art
- supports. POSIX specifies 'b', 'c', 'd', 'l', 'p', 'f', and 's'. GNU find also supports 'D', which is a port where the operating system provides them. Furthermore, GNU find allows you to specify multiple types at once in a comma-separated list.
- -OK
- supports. The response is interpreted according to the "yes" and "no" patterns selected by setting the `LC_MESSAGES' environment variable. negative answer (no). Consult your system documentation fornl_langinfo(3), in particular YESEXPR and NOEXPR. If `POSIXLY_CORRECT' is not defined, default values are usedthink'Catalogue of Planted News.
- -last
- supports. If the specified file is a symbolic link, the reference is always removed. This is a change from previous behavior where the relevant tense was removed from the symlink; see the HISTORY section below.
- -Permanente
- supports. If the POSIXLY_CORRECT environment variable is not set, some mode arguments (eg, +a+x) that are invalid in POSIX are supported for backwards compatibility.
- other predicates
- the predicates-one moment,-ctime,-Depth,-Group,-Links,-mtime,-no group,-nouser,-press,-Plum,-Size,-of the usermi-xdev'-atime', '-ctime', '-profundidad', '-group', '-links', '-mtime', '-nogroup', '-nouser', '-perm', '-print', Se admiten `-prune', `-size', `-user' y `-xdev'.
The POSIX standard specifies square brackets `(', `)', negation `!' and the 'and' and 'or' operators (-a,-Ö).
All other options, predicates, expressions, etc. they are extensions beyond the POSIX standard. However, many of these extensions are not unique to GNU find.
The POSIX standard requires thisthinkDetecta-Schleifen:
- othinkThe utility must detect infinite loops; that is, enter a previously visited directory that is an ancestor of the last file found. If it encounters an infinite loop, find should write a diagnostic message to standard error and restore or exit its position in the hierarchy.
FIELDthinkMeets these requirements. The link count for directories containing entries that are hard links to an ancestor will generally be lower than it should be. This can mean that GNU find sometimes optimizes visiting a subdirectory that is actually a link to an ancestor. Given thatthinkdoes not actually go into that subdirectory, it is permissible to avoid output of a diagnostic message. Although this behavior can be somewhat confusing, it is unlikely that anyone would actually trust this behavior. If sheet optimization was disabled with-no bladeThe phone book entry is always examined and, if necessary, the diagnostic message is issued. Symbolic links cannot be used to create file system loops as such, but if the-UEoption or the-Crossoption is used, a diagnostic message is issued ifthinkfinds a loop of symbolic links. As with loops containing hard links, leaf optimization usually means thisthinkYou know you don't have to callCondition()ochdir()in the symbolic link, so this diagnosis is often not necessary.
o-dThe option is compatible with many BSD systems, but you must use the POSIX-compatible option-Depthinstead of.
The POSIXLY_CORRECT environment variable does not affect the behavior of the- Regexo-iregexbecause these tests are not specified in the POSIX standard.
ENVIRONMENT VARIABLES
- LANGUAGE
- Provides a default value for internationalization variables that are undefined or null.
- LC_ALL
- If set to a non-empty string value, substitute the values of all other internationalization variables.
- LC_COLLATE
- The POSIX standard states that this variable affects the pattern matching to be used for the-NamePossibility. GNU find uses thefn party(3) The library function and therefore the support for 'LC_COLLATE' depends on the system library. This variable also influences the interpretation of the response.-OK;while the 'LC_MESSAGES' variable selects the actual pattern used to interpret the response-OK, the interpretation of all parentheses in the pattern will be affected by `LC_COLLATE'.
- LC_CTYPE
- This variable affects the handling of character classes used in and also with regular expressions.-NameTest if the systemfn party(3) The library function supports this. This variable also affects the interpretation of all character classes in the regular expressions used to interpret the quick response from-OK.The 'LC_CTYPE' environment variable also affects which characters are considered non-printable when printing filenames; see the UNUSUAL FILE NAMES section.
- LC_MESSAGES
- Determines the locale to be used for internationalized messages. If the environment variable 'POSIXLY_CORRECT' is set, this also determines the interpretation of the response to the request.-OKAction.
- NLSPATH
- Determines the location of the internationalization message catalogs.
- OUTSIDE
- Affects which directories are searched to find executables that have been invoked-executive,-ejector,-OKmi- it's okay.
- POSIXLY_CORRECT
- Determines the block size used from-lsmi-fls.SePOSIXLY_CORRECTis defined, blocks are units of 512 bytes. Otherwise, they are 1024-byte units.
- Setting this variable also disables warning messages (that is, it implies-saber) by default because POSIX requires this in addition to output for-OK, all messages printed to stderr are diagnostic and should generate a non-zero exit status.
- If POSIXLY_CORRECT is not set,-Permanente+zzzis is treated as-Permanente/zzzif+zzz is not a valid symbolic mode. If POSIXLY_CORRECT is set, such constructs are treated as errors.
- If POSIXLY_CORRECT is set, the response to the request is replaced by the-OKThe action is interpreted based on the system message catalog, rather than based onthink'Translations of seeded messages.
- TZ
- It affects the time zone used for some of the time-related format declarations.-printfmi-fprintf.
EXAMPLES
find /tmp -kernel name -type f -print | xargs /bin/rm -f
Find named filessignificantinside or below the directory/tmpand delete them. Note that this will not work correctly if the file names contain new lines, single or double quotes, or spaces.
find /tmp -kernel name -type f -print0 | xargs -0 /bin/rm -f
Find named filessignificantinside or below the directory/tmpand delete, processing filenames in a way that correctly handles filenames or directories that contain single or double quotes, spaces, or newlines. the-Namethe test comes before- Arttry to avoid a callCondition(2)in each file.
think . -type f -exec file '{}' \;
Runs 'file' on all files in or below the current directory. Note that the braces are enclosed in single quotes to prevent them from being interpreted as shell script punctuation. The semicolon is also escaped with a backslash, although single quotes can also be used in this case.
encontrar / \( -perm -4000 -fprintf /root/suid.txt '%#m %u %p\n' \) , \\( -tamaño +100M -fprintf /root/big.txt '%-10s %p\n' \)
Traverse the filesystem only once, listing the setuid files and directories on it/root/suid.txtand large files in/root/grande.txt.
find $HOME -mtime 0
Look in your home directory for files that have been modified in the last 24 hours. This command works like this because the time since each file was last modified is divided by 24 hours and the rest is discarded. This means it fits-mtime0, a file must have been modified less than 24 hours ago.
find /sbin /usr/sbin -executable \! -readable -print
Look for executable but unreadable files.
sugar. - Permanent 664
Look for files that have read and write permissions for their owner and group, but that other users can read but not write. Files that meet these criteria but have other permission bits set (for example, if someone can execute the file) will not be compared.
pensar. -Duration-664
Look for files that have read and write permissions for their owner and group and that other users can read, regardless of whether there are additional permission bits (such as the executable bit). For example, this corresponds to a file with mode 0777.
pensar. -Duration /222
Search for files that can be written to by anyone (their owner, their group, or someone else).
pensar. -Duration /220achar -permanente /u+w,g+wachar -perm /u=w,g=w
These three commands do the same thing, but the first one uses the octal representation of file mode and the other two use the symbolic form. All of these commands look for files that their owner or group can write to. The owner and group do not need to be able to write to the files for them to match; everyone will.
pensar. -duration -220achar -permanente -g+w,u+w
Both commands do the same thing; Look for files that their owner and group can write to.
find -duration -444 -duration /222 ! -Duration /111achar -dauer -a+r -dauer /a+w ! -perm /a+x
These two commands look for files that are human readable (-duration -444o-permanente -a+r), have at least one set of write bits (-Duration /222o-permanente /a+w), but they are not executable for anyone (! -Duration /111mi! -perm /a+xo).
cd /source-directoryachar -name .snapshot -prune -o \( \! -name *~ -print0 \)|cpio -pmd0 /destination-dir
This command copies the content of/source-directoryPro/dir-destination, but omits named files and directories.Snapshot(and everything in them). It also skips files or directories whose name ends with~, but not its content. the construction-prune -o \( ... -print0 \)is quite common. The idea here is that the expression beforehand-Plumcorresponds to things that need pruning. However the-Plumthe action itself returns true, so the following-Öensures that the right hand side is only evaluated for non-remote directories (the content of remote directories is not even visited, so the content is irrelevant). The print on the right side of the-Öit is in parentheses for clarity only. emphasizes that the-print0The action only happens for things that didn't have-Plumapplied to them. By default, 'e' is stronger than between tests-Ö, which is the default anyway, but the parentheses help show what's going on.
gegen repo/\( -exec test -d{}/.svn\;-or\-exec test -d {}/.git \; -ou -exec test -d {}/CVS \; \) \-print -crop
Perform an efficient search for the project roots using the following project directory and associated SCM admin directories:
Repository/Project1/CVSrepository/gnu/project2/.svnrepository/gnu/project3/.svnrepository/gnu/project3/src/.svnrepository/project4/.git
In this example-Plumprevents unnecessary descents to already discovered directories (for example, we don't look for project3/src because we already found project3/.svn), but ensures that sibling directories (project2 and project3) are found.
against /tmp -type f,d,l
Find files, directories, and symbolic links in the directory/tmpPassing these types as a comma-separated list (GNU extension), which corresponds to the longest but most portable:
find /tmp \( -type f -o -type d -o -type l \)
INITIAL STATUS
thinkends with status 0 if all files were processed successfully, greater than 0 if errors occur. This is intentionally too broad a description, but if the return value is non-zero, you should not rely on the accuracy of the results ofthink.
If an error occurs,thinkit can be stopped immediately without taking any specific action. For example, some starting points may not have been examined yet, or some pending program calls to do so-executive... {} +o-ejec ... {} +it may not run.
HISTORY
As of findutils-4.2.2, shell metacharacters (such as "*", "?", or "[]") used in filename patterns match ".". initial because the interpretation of IEEE POSIX 126 requires it.
Ab findutils-4.3.3,-Duration /000now matches all files instead of none.
Nanosecond resolution timestamps have been implemented in findutils-4.3.3.
As of findutils-4.3.11, the-ClearAction setsthink'Set exit status to non-zero on failure.thinkit will not come out immediately. Until now,think'Gender status was not affected by the interruption-Clear.
special feature | Aggregate | it also happens |
-nuevoXY | 4.3.3 | BSD |
-D | 4.3.1 | |
-Ö | 4.3.1 | |
-legible | 4.3.0 | |
-writable | 4.3.0 | |
-executable | 4.3.0 | |
-regextype | 4.2.24 | |
-execute... + | 4.2.12 | Posix |
-ejector | 4.2.12 | BSD |
- it's okay | 4.2.12 | |
- same file | 4.2.11 | |
-H | 4.2.5 | Posix |
-UE | 4.2.5 | Posix |
-PAGE | 4.2.5 | BSD |
-Clear | 4.2.3 | |
-leaving | 4.2.3 | |
-d | 4.2.3 | BSD |
-Full name | 4.2.0 | |
-iFull name | 4.2.0 | |
-ignore_readdir_race | 4.2.0 | |
-fls | 4.0 | |
-ilname | 3.8 | |
- Foam | 3.8 | |
-iPfad | 3.8 | |
-iregex | 3.8 |
The .B -perm +MODE syntax was removed in findutils-4.5.12 in favor of .B -perm/OUTSIDE.Ö+MODEThe syntax is deprecated since findutils-4.2.21 was released in 2005.
WITHOUT ERRORS
Surprised Operator Priority
The commandthink . -filename -o -filename b -printwill never printconvey a messagebecause that really is equivalent toachar -name a file -o \( -filename -a -print \).Remember that the precedence of-aIs superior-Öand if no operator is specified between the tests,-ais assumed.
Error message "Paths must precede expression."
$find. -name *.c -printfind: paths must precede expression Usage: find [-H] [-L] [-P] [-Olevel] [-D ... [path...] [expression]
This happens because*.Cwas spread by the wrapper, leading tothinkactually always a command line like this:
achar -name frcode.c locate.c word_io.c -print
This command obviously doesn't work. Instead of doing things this way, consider enclosing the pattern in quotes or escaping the wildcard:
$find. -name '*.c' -print$find. -name \*.c -print
INSECTS
The behavior for which you specify the POSIX standard is associated with security issuesthink, which therefore cannot be fixed. For example, him-executiveThe action is intrinsically uncertain, and-ejectorshould be used instead. Watchfind filesFor more information.
environment variableLC_COLLATEhas no influence on-OKAction.
The best way to report a bug is to use the form belowhttp://savannah.gnu.org/bugs/?group=findutils.The reason for this is so that you can track the progress of the troubleshooting. Other comments aboutthink(1) and through the findutils package, it can generally be sent to thebug-findutilsmailing list. To join the list, send an email to[email protected].
FAQs
What command would I use to search for files in a directory hierarchy? ›
You can use the find command to search for a file or directory on your file system. By using the -exec flag ( find -exec ), matches, which can be files, directories, symbolic links, system devices, etc., can be found and immediately processed within the same command.
How do I get a list of files in a specific directory? ›- To list all files in the current directory, type the following: ls -a This lists all files, including. dot (.) ...
- To display detailed information, type the following: ls -l chap1 .profile. ...
- To display detailed information about a directory, type the following: ls -d -l .
To search for files in File Explorer, open File Explorer and use the search box to the right of the address bar. Tap or click to open File Explorer. Search looks in all folders and subfolders within the library or folder you're viewing. When you tap or click inside the search box, the Search Tools tab appears.
Where are the files of a given user stored in a typical file structure hierarchy of a Linux OS? ›It is maintained by the Linux Foundation. In the FHS, all files and directories appear under the root directory /, even if they are stored on different physical or virtual devices.
What is the hierarchical collection of directories and files? ›A hierarchical file system is how drives, folders, files, and other storage devices are organized and displayed on an operating system. In a hierarchical file system, the drives, folders, and files are displayed in groups, which allows the user to see only the files they're interested in seeing.
Which Linux command shows a list of files in a directory? ›- To list all files in the current directory, type the following: ls -a This lists all files, including. dot (.) ...
- To display detailed information, type the following: ls -l chap1 .profile. ...
- To display detailed information about a directory, type the following: ls -d -l .
- Open File Explorer in Windows. ...
- Click in the address bar and replace the file path by typing cmd then press Enter.
- This should open a black and white command prompt displaying the above file path.
- Type dir /A:D. ...
- There should now be a new text file called FolderList in the above directory.
PHP using scandir() to find folders in a directory
The scandir function is an inbuilt function that returns an array of files and directories of a specific directory. It lists the files and directories present inside the path specified by the user.
- Go to the Data tab.
- In the Get & Transform group, click on New Query.
- Hover the cursor on the 'From File' option and click on 'From Folder'.
- In the Folder dialog box, enter the folder path, or use the browse button to locate it.
- Click OK.
- Open the folder you want to search in File Explorer, select the View menu and click the Options button.
- In the window that opens, click on the Search tab, select "Always search file names and contents" and click "OK"
What is the Unix command to find a file in a directory and subdirectory? ›
The grep command searches through the file, looking for matches to the pattern specified. To use it type grep , then the pattern we're searching for and finally the name of the file (or files) we're searching in.
Can you search without indexing? ›You'll still be able to search by file name—just not file contents. Choosing not to index the contents of files can reduce the size of the index, but it makes files harder to find in some cases.
How to check file system hierarchy in Linux? ›If you want to find out information about your system's FHS, enter the command man hier. It will display directory structure of your system.
How data is stored in a hierarchy? ›A hierarchical database is a data model in which data is stored in the form of records and organized into a tree-like structure, or parent-child structure, in which one parent node can have many child nodes connected through links.
Which of the following command display the hierarchy of files and folders? ›The pwd command (print working directory) displays where you are in the file system hierarchy.
How do I export a directory hierarchy? ›To export the folder's structure, run this command: tree /a /f > output. doc. TIP: If you don't want the directory tree to include files (in other words, make the tree include only folders), skip the /f parameter from the command (tree /a > output.
What is hierarchical structure of a file system? ›In the hierarchical file structure, records are arranged in a scheme resembling a family tree, with records related to one another from top to bottom. In the network file structure, records are arranged in groupings known as sets; these can be connected in any number of ways,…
How to find a file in Linux in all directories recursively? ›- ls -R : Use the ls command to get recursive directory listing on Linux.
- find /dir/ -print : Run the find command to see recursive directory listing in Linux.
- du -a . : Execute the du command to view recursive directory listing on Unix.
Listing files by name
The easiest way to list files by name is simply to list them using the ls command. Listing files by name (alphanumeric order) is, after all, the default. You can choose the ls (no details) or ls -l (lots of details) to determine your view.
Listing the full path
The command DIR /b will return just a list of filenames, when displaying subfolders with DIR /b /s the command will return a full pathname. To list the full path without including subfolders, use the WHERE command.
How do I view files in subfolders? ›
- Click on a folder if it's listed in the Navigation pane.
- Click on a folder in the Address bar to display its subfolders.
- Double-click on a folder in the file and folder listing to display any subfolders.
You can make grep search in all the files and all the subdirectories of the current directory using the -r recursive search option: grep -r search_term .
How do I list all files in subdirectories? ›By default, ls lists just one directory. If you name one or more directories on the command line, ls will list each one. The -R (uppercase R) option lists all subdirectories, recursively.
How do you get a list of the names of all files present in a directory in node JS? ›Method 1: Using fs.
readdirSync() is a method that is available in the file system module of Node. js. It is used for reading the contents of a directory. It returns an array of file paths, buffers, or fs.
js fs core module to get all files in the directory, we can use following fsmethods. fs. readdir (path, callbackFunction) — This method will read all files in the directory.
How to get a list of all files in a folder and subfolders in cmd? ›...
Follow these baby steps:
- Press Windows + R.
- Press Enter.
- Type cmd.
- Press Enter.
- Type dir -s.
- Press Enter.
The answer is to use the DIR command. This command can be used to show all files and subfolders in the current directory. In addition, it displays the file name, size, and last modification date of each file like File Explorer.
How do I select multiple files in a folder from a list of file names? ›Click on one of the files or folders you want to select. Hold down the control key (Ctrl). Click on the other files or folders that you want to select while holding the control key. Continue to hold down the control key until you select all the files you want.
How do I use grep to search multiple files? ›- Grep multiple files. Simply provide a list of files to search. ...
- Grep files in a directory. Specify the -r (recursive) flag and a directory to Grep within every file found within that directory. ...
- Grep within the current directory. Specify . ...
- Grep files with a specific file extension.
Search All Files in Directory
To search all files in the current directory, use an asterisk instead of a filename at the end of a grep command. The output shows the name of the file with nix and returns the entire line.
How to search specific text in multiple files in a directory Linux? ›
- Make the search case-insensitive with the "-i" option: ...
- Search recursively in all files in a given directory with the "-r" option: ...
- Search whole words only with the "-w" option: ...
- Print the line numbers in which the searched word was found with the "-n" option: ...
- Search for multiple words syntax:
Finding Files Recursively in Linux
The find command does not need flags to search the files recursively in the current directory. You only need to define the main directory and the file name using the –name option. This command will search the file within the main directory and all subdirectories.
- /path is the path where file is expected to be found. This is the starting point to search files. The path can also be / or . which represent root and current directory, respectively.
- -type represents the file descriptors. They can be any of the below:
Search for a particular string files: find -grep
This command will search in the current directory and all sub directories. All files contaning the string passed as an argument to the grep command will have their path printed to standard output.
Indexing is the process by which search engines organize information before a search to enable super-fast responses to queries. Searching through individual pages for keywords and topics would be a very slow process for search engines to identify relevant information.
Why does indexing make search faster? ›Indexing makes columns faster to query by creating pointers to where data is stored within a database. Imagine you want to find a piece of information that is within a large database. To get this information out of the database the computer will look through every row until it finds it.
How do I know if I am indexed or not? ›- To see if search engines like Google and Bing have indexed your site, enter "site:" followed by the URL of your domain. ...
- The results show all of your site's pages that have been indexed, and the current Meta Tags saved in the search engine's index.
- Open a terminal.
- Use the du command to search all files and then use two pipes to format the returned data. du -aBM will search all files and directories, returning their sizes in megabytes. ...
- Press Enter to run the command.
In the Windows command prompt you can use "tree /F" to view a tree of the current folder and all descending files & folders.
Which Linux commands will show the process hierarchy? ›To list processes in Linux, use one of the three commands: ps, top or htop. Ps command provides static snapshot of all processes, while top and htop sorts by CPU usage.
How do you display hierarchy data? ›
Representing hierarchical information is quite straightforward; in the majority of cases the information designer will either use a tree diagram (or a variant of a tree diagram) or a treemap to display the data in an efficient format for the user.
What are the 5 hierarchy of data? ›Computer Data Hierarchy: Bits, Characters, fields, records, files, database bigdata.
What command can be used to view a directory hierarchy? ›You need to use command called tree. It will list contents of directories in a tree-like format. It is a recursive directory listing program that produces a depth indented listing of files. When directory arguments are given, tree lists all the files and/or directories found in the given directories each in turn.
Which command is used to show hierarchy? ›Pstree command in Linux that shows the running processes as a tree which is a more convenient way to display the processes hierarchy and makes the output more visually appealing. The root of the tree is either init or the process with the given pid. Pstree can also be installed in other Unix systems.
What is the hierarchy of folders? ›A folder hierarchy is an organizational structure of one or more folders in Oracle iFS. Folder hierarchies organize the repository so that users can browse through it easily. You can create multiple folder hierarchies to organize information in different ways to make browsing convenient for different types of users.
How to check file hierarchy in Linux? ›You need to use command called tree. It will list contents of directories in a tree-like format. It is a recursive directory listing program that produces a depth indented listing of files. When directory arguments are given, tree lists all the files and/or directories found in the given directories each in turn.
What command allows the user to search for files in a directory hierarchy with versatile options? ›Grep recursive search in all subdirectories of a directory
Grep provides a -r option for the recursive search. With this option, grep will look into all the files in the current (or specified) directory and it will also look into all the files of all the subdirectories.
...
Basic Examples
- find . - name thisfile.txt. ...
- find /home -name *.jpg. Look for all .jpg files in the /home and directories below it.
- find . - type f -empty. ...
- find /home -user randomperson-mtime 6 -iname ".db"
Navigate directories. Open a window, double-click on a folder, and then double-click on a sub-folder. Use the Back button to backtrack. The cd (change directory) command moves you into a different directory.
How do you view a hierarchy? ›- Connect your device to your computer. ...
- Open your project in Android Studio, build and run it on your device.
- Start Android Device Monitor. ...
- In the menu bar, select Window > Open Perspective, and then click Hierarchy View. ...
- Double-click your app's package name in the Windows tab on the left.
How do you display hierarchy? ›
- Right-click the hierarchy that you want to change, and then click Change Layout.
- Click Hierarchy, and then do one of the following: To show hierarchical relationships progressing from top to bottom and grouped hierarchically, click Labeled Hierarchy.
To recursively search for a pattern, invoke grep with the -r option (or --recursive ). When this option is used grep will search through all files in the specified directory, skipping the symlinks that are encountered recursively.
What is grep command used for? ›The grep command can search for a string in groups of files. When it finds a pattern that matches in more than one file, it prints the name of the file, followed by a colon, then the line matching the pattern.
How to find a file in Linux in all directories and subdirectories? ›...
Syntax
- -name file-name – Search for given file-name. ...
- -iname file-name – Like -name, but the match is case insensitive. ...
- -user userName – The file's owner is userName.