Skip to content
Bazza-Carter edited this page Jul 14, 2022 · 11 revisions

Stand With Ukraine

Ag

Build

First, you'll need to install the dependencies. In addition to the normal requirements for compiling code, Ag requires PCRE. On Ubuntu, run apt-get install -y libpcre3-dev to install it. On RHEL/CentOS, run yum install automake pkgconfig pcre-devel zlib-devel xz-devel to get dependencies. OS X has an older version of PCRE which works fine, but is slower. If you want 20% faster searching, install homebrew, then run brew install pcre. You can also build and install PCRE manually. The latest tarballs are here.

Once you have the dependencies, run ./build.sh to build Ag.

Install

sudo make install

Use

Basic usage of Ag is simple: cd to the directory you want to search and run ag blah to find instances of "blah". You can also run ag blah /some/path if you don't want to cd.

If you want to learn more options, run ag --help for usage or man ag for even more help.

For more advanced usage, see Advanced Usage.

Contribute

The best way to improve Ag is to submit a pull request. Code speaks louder than words. That said, if you have ideas for improvements, feel free to suggest them in an issue.

My goal with Ag is to build a program that does one thing well, so I'm a little wary of feature creep. I'm especially averse to anything that introduces more dependencies. It's entirely possible that my needs differ from yours, so don't take it personally if your pull request isn't merged. The entire project is Apache Licensed, so you can take the code and do whatever you want.

Other stuff you might be interested in

  • Ack - Better than grep
  • AckMate - An ack-powered replacement for TextMate's slow built-in search.
  • ack.vim
  • Exuberant Ctags - Faster than Ag, but it builds an index beforehand. Good for really big codebases.
  • Git-grep - As fast as Ag but only works on git repos.
Clone this wiki locally