Terminal

Lightning Fast Code Search

Using The Silver Searcher to hunt through files

If you’re like me, you can never remember how to use grep properly to search for text inside files.

I can get by with a:

$ grep -rnw . -e 'todo'

… but it’s not enough and I always have to look it up to use it properly. I’m about to make some alias shortcuts.

On my searches I found a tool called ack which is dedicated to source code searching but before I had the chance to install it, I came across The Silver Searcher ($ ag) which claims to be a faster version of ack.

It was easy to install with Homebrew and I retried my previous search $ ag 'todo' . (slightly different but more intuitive syntax) and it came up with all the results, case insensitive, in less than a second, highlighted and everything.

I have yet to integrate it into my daily workflow but it looks really promising. I love time-saving tools.

Find it on GitHub: the_silver_searcher