ack
is a famous code search tool to replace grep
(in a lot of use cases): https://beyondgrep.com/why-ack/
Now there is something even better. There is ag
aka The Silver Searcher: ggreer/the_silver_searcher
It is like ack, but faster.
Why not just grep?
- Hella fast. Like really really fast. It is beautifully optimized C.
- It ignores files from
.gitignore
Instead of doing this with grep:
grep -R --exclude-dir=node_modules 'foobar' /path/to/your/code
You can just do (if you have node_modules in your .gitignore):
ag foobar /path/to/your/code
You can also ignore folders with this option:
ag --ignore file_or_folder_name_to_ignore /path/to/your/code