find π
Finds files matching given criteria.
Find by name -name/-iname
find /home/babak -name "*bash*"
- Finds all files/directories matching *bash* descended from
/home/babak.- Use
-inamefor case-insensitive search.
Find by matching on path -path/-ipath
find ~ -path "*/config/*"
- Finds all files/directories that their path string include "/config/".
- Use
-ipathfor case-insensitive search.
Find by RE pattern -regex/-iregex
find ~ -regextype egrep -regex '.*/(conf|config)$'
- Finds all files/directories that their path end with "config" or "conf".
- Use
-iregexfor case-insensitive search.- Use
-regextype egrepif you prefergrepextended RE format.
Find files (exclude directories) -type f
find ~ -type f -name "*bash*"
Find directories -type d
find ~ -type d -name "Do*"
Limit recursion depth -maxdepth/-mindepth
find ~ -maxdepth 2 -type f -name "*.txt"
Top comments (0)