silver searcher, it's like grep but faster and easier - 01-11-20

$ ag -G .php 'the meaning of the universe'

Life on the command line means grepping for things on a daily basis. After doing this for a while I memorized so may flag like grep -n for line numbers -i for case-insensitive and even the . to specify file directory. Then I discovered silver searcher, not only was the name a call back to one of my favorite comic book heroes but, it basically did work just as well as grep without all the flags and seemingly faster. It is now my go-to command for searching files whether it be inside vim via :r !ag -G .php ‘something’ or from the cli. It even has different outputs depending on the situation, in the cli it opens a temp window to browse results like less when piping or in vim it outputs a more machine-readable chunk of text with file paths, line numbers, and a single line of code.

source:

silver searcher

\- [ ag, search ]