Unix find tricks

I will complete a proper, reasoned, motivated blog entry on the find command one day, but for now this just records the essential commands for some (seemingly simple) commands.


Find all files in the current directory but ignore any directories (and their children) called .git:

find . -name .git -prune -o -type f -print

And how I originally used this, show me the word count for each such file:

find . -name .git -prune -o -type f -exec wc {} \;


Count lines, but only for text files:

find . -type f -exec grep -Iq . {} \; -and -exec wc {} \;