How to use the Linux find command

04/01/2009

I always have trouble remembering how to use the find command in Linux, so here are a few examples.

Finding all hidden files:

find . -regex '.*/\..*'

Deleting all Java files:

rm -rf `find . -name *.java`

Deleting all directories named .svn:

rm -rf `find . -type d -name .svn`

Recursively set permissions for a web server:

chmod -R a+r ~/www
find ~/www -type d -exec chmod a+x {} \;

Finding all exectuable files:

find . -executable -type f
Be Sociable, Share!