安装

1) unix
https://github.com/ggreer/the_silver_searcher

2) windows
https://github.com/k-takata/the_silver_searcher-win32
1.下载 release 包
2.安装 git bash
3.把 ag.exe 移动到 git 的 PATH 目录下 (which git && mv ag.exe /mingw64/bin/)

使用示例

1) 在当前所有目录下搜索 keyword 关键字

ag keyword 

2) 在 dir 目录下搜索 keyword 关键字

ag keyword dir/

3) 在当前所有目录下搜索 keyword 关键字,并显示关键字的前后5行

ag -C 5 keyword