A code-searching tool similar to ack, but faster. Ignores file patterns from .gitignore.
The Silver Searcher (ag) is a blazing-fast code searching tool designed as a superior alternative to ack and grep. It searches through codebases with exceptional speed, being up to 34 times faster than ack in benchmarks, while maintaining all the functionality developers need for code exploration. The tool achieves its impressive performance through multi-threading with pthreads, memory-mapped files, Boyer-Moore string searching for literals, and PCRE's JIT compiler for regex patterns.
What sets ag apart is its intelligent handling of version control and project files. It automatically respects .gitignore and .hgignore patterns, and supports custom .ignore files for excluding unwanted files like minified JavaScript. The tool is particularly valuable for developers working with large codebases, offering a compact command name that's 33% shorter than ack with all keys on the home row for efficient typing.
The Silver Searcher integrates seamlessly with popular editors including Vim, Emacs, and TextMate, making it an essential tool for developers who frequently search through code. Whether you're debugging, refactoring, or exploring unfamiliar codebases, ag provides the speed and functionality needed to navigate large projects efficiently.
# via Homebrew
brew install the_silver_searcher
# via APT
apt-get install silversearcher-ag
# via DNF
dnf install the_silver_searcher