Difference between revisions of "Find"
(Created page with "Find searches the directory tree rooted at each given file name by evaluating the given expression from left to right, according to the rules of precedence, until the outcome...") |
(→Find) |
||
(One intermediate revision by the same user not shown) | |||
Line 2: | Line 2: | ||
=Find= | =Find= | ||
− | Find a file based on filename: | + | Find a file based on the filename: |
find /dir/ -name "filename.php" | find /dir/ -name "filename.php" | ||
Line 8: | Line 8: | ||
This lists all files which have been modified per unit of time (showing 30 days here): | This lists all files which have been modified per unit of time (showing 30 days here): | ||
find /dir/ -mtime +30 | find /dir/ -mtime +30 | ||
+ | |||
+ | Find can be piped into other commands in case the other commands can't measure or see files: | ||
+ | find . -type f -exec du -a {} + | sort -n -r |
Latest revision as of 11:05, 14 November 2024
Find searches the directory tree rooted at each given file name by evaluating the given expression from left to right, according to the rules of precedence, 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.
Find
Find a file based on the filename:
find /dir/ -name "filename.php"
This lists all files which have been modified per unit of time (showing 30 days here):
find /dir/ -mtime +30
Find can be piped into other commands in case the other commands can't measure or see files:
find . -type f -exec du -a {} + | sort -n -r