Lightning Fast Code Search

Thu, Aug 10, 2023 One-minute read

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 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 here: (https://github.com/ggreer/the_silver_searcher)