Quantcast
RSS Entries RSS
RSS Subscribe by Email

How to use the Linux find command

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!

2 Comments »

  1. Sir Bode Rafael said,

    May 13, 2009 at 10:21 pm

    Wouldn’t be better suppling the simplistic chmod way, like this?

    chmod -R 777 /path/to/directory

    Which is equal to:

    chmos -R a=rwx /path/to/directory

    Regards!

  2. Ben said,

    May 16, 2009 at 3:46 pm

    That would make everything readable, writable, and executable by everyone. A preferable approach would be to add read permissions only for the web server.

RSS feed for comments on this post · TrackBack URL

Leave a Comment