Useful Find Examples

Find all HTML files that contain the text “Loading”

# find . -name *.html -exec grep -il "Loading" {} \;

Find all files modified in last 7 days

# find . -mtime -7

Find all .PHP files modified in last 7 days

# find . -name *.php -mtime -7

Find and Remove all PHP files modified in last 7 days

# find . -name *.php -mtime -7 | xargs rm

Find all  files modified in last 10 days that contain text “Loading” and move to /trash

# find . -type f -mtime -10 -exec egrep -l "Loading" {} \; -exec mv -f {} /trash \;
Was this helpful?
Useful Find Examples written by UKC average rating 5/5 - 1 user ratings