Finding stuff – find, grep, silver searcher

Here’s how to find stuff in a directory:

grep -r <keyword> .

or

find . -type f -exec grep <keyword> {} \; -print

or, to exclude a directory:

grep -r --exclude-dir=<directory> <keyword> .

 

And silver searcher is pretty neat. https://github.com/ggreer/the_silver_searcher

e.g. ag <keyword> .

Respects your .gitignore!

 

Leave a Reply

Your email address will not be published. Required fields are marked *