Ag: A code searching tool similar to ack, with a focus on speed.

1 Install

brew install ag

2 Command

ag DHH # search "DHH"
ag DHH guides/ # search "DHH" at path guides/
ag readme$ # search string is always the regular expression pattern
ag -Q .rb railties/CHANGELOG.md # use -Q to search exactly the string not regular expression
ag DHH -l # only output file path that contains search string
ag readme -i # case insensitive
ag readme -G ec$ # scoping to file name that end with "ec"
ag readme -l --ignore-dir="*.rb" # ignore all directory that end with .rb
ps -e | ag forego # search from ps output

3 .agignore File

The .agignore file specifies ignore paths for Ag, and works independently of any VCS file.

railties/lib
guides/code
Last Updated 2017-03-10 五 10:26.
Render by hexo-renderer-org with Emacs 25.2.1 (Org mode 8.2.10)