Finding stuff – find, grep, silver searcher, ripgrep

Here’s how to find stuff in a directory:

grep -r <keyword> .


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

or, to exclude a directory:

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


And silver searcher is pretty neat.

e.g. ag <keyword> .

Respects your .gitignore!


Having said that, it doesn’t recognise ** patterns in your .gitignore.

If that’s an issue you might want to try ripgrep.

Incredibly, ripgrep posts timings that are 5x faster than Silver Searcher.