Difference between revisions 507886 and 507887 on knwiki

{{otheruses}}
{{lowercase|title=find}} 
The <code>'''find'''</code> program is a [[directory (file systems)|directory]] [[Search engine (computing)|search utility]] on [[Unix-like]] platforms. It searches through one or more directory [[tree (computing)|trees]] of a [[filesystem]], locating [[Computer file|file]]s based on some user-specified criteria. By default, <code>find</code> returns all files below the current [[working directory]]. Further, <c(contracted; show full)
The double quotes (" ") surrounding the search string and single quotes (<nowiki>' '</nowiki>) surrounding the braces are optional in this example, but needed to allow spaces and other special characters in the string.

===Search for all files owned by a user===
 find . -user <userid>

===Search in case insensitive mode===
 find . -iname 
<filename> -type f -print"MyFile*"

If the <code>-iname</code> switch is not supported on your system then workaround techniques may be possible such as:

 find . -name "[mM][yY][fF][iI][lL][eE]*"

This uses [[Perl]] to build the above command for you:

 echo "'MyFile*'" |perl -pe 's/([a-zA-Z])/[\L\1\U\1]/g;s/(.*)/find . -name \1/'|sh

===Search files by size===
Example of searching files with size between 100 kilobytes and 500 kilobytes.
 find . -size +100k -a -size -500k

The units should be one of [bckw], 'b' means 512-byte blocks, 'c' means byte, 'k' means kilobytes and 'w' means 2-byte words. The size does not count indirect blocks, but it does count blocks in sparse files that are not actually allocated. 

(contracted; show full)[[fr:Find]]
[[it:Find (Unix)]]
[[hu:Find]]
[[ja:Find]]
[[pl:Find]]
[[pt:Find]]
[[ru:Find]]
[[fi:Find (Unix)]]