Author: Jeff Zartler
Use: searches for files in a directory hierarchy
Syntax: find [path...] [expression]
If no path is specified the current directory is used; prints to standard output by default
The following characters mark the beginning of the expression ) - ( , !
|
A few examples of some options -name pattern searches starting with current directory or [path] for pattern, case sensitive [/home]$ find /test -name 'x*' In this example we specify [path] of /test, use the -name option and pattern of x* which returns the following files from our sample directory structure x.level3, x.level2,x.level1,x.fd0 -iname pattern same as -name except are case insensitive [/home]$ find /test -iname 'x*' In this example all of the above files are returned plus the files with an uppercase 'X': x.level3, x.level2, x.level1, x.fd0 -maxdepth n searches to level not greater than n from the current directory or [path] [/test]$ find -maxdepth 2 -name 'x*' in this example the -maxdepth option will limit find's search to 2 levels; the current '/test' and the next level containing '/floppy' and '/level1' and return the following: x.level1, x.fd0 -mount prevents searching mounted directories [/test]$ find -maxdepth 2 -mount -name 'x*' when we add the -mount option mounted file systems will be eliminated from the search ... in this case the floppy drive mounted as '/floppy' x.level1 -mindepth n searches from level n through the remainder of the directory tree [/test]$ find -mindepth 3 -name 'x*' -mindepth option will begin find's search at the 3rd level, 'level2' and continue to the end, returning: x.level3, x.level2 More: -help displays brief summary of usage
-amin n accessed n minutes ago -mmin n modified contentsn minutes ago -cmin n changed attributes n minutes ago -atime n accessed n*24 hours ago -mtime n modified contentsn*24 hours ago -ctime n changed attributes n*24 hours ago where: +n = >n
n = n>
-n = <n
-group returns files owned by specific group -user returns files owned by specific user -type x
|
|