HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
ggreer
the_silver_searcher
C2012–2025
ggreer / the_silver_searcher

the_silver_searcher

A code-searching tool similar to ack, but faster.

103Distinct people
128Mentions
3Explicit recommenders
27.1KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

A code-searching tool similar to ack, but faster.

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

One of my favorite idioms for searching for a string: find /path -type f |xargs grep blah Has been replaced by `ag` https://github.com/ggreer/the_silver_searcher , ag is…

lazyant used a recommendation phrase. 3 indexed comments match. This is a phrase match, not a verdict.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

Mentioned in the same Hacker News threads. That is not proof they are substitutes.

This week on Hacker News

Nov 9–Nov 16 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/16/2026, 11:20:21 AM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year128 dated mentions

Observed mentions: 2012-04-02 00:04:29 UTC to 2025-03-11 17:00:25 UTC.

05101520252012-01-01 00:00:00 UTC to 2013-01-01 00:00:00 UTC (exclusive): 10 mentions; 3 submissions, 7 comments20122013-01-01 00:00:00 UTC to 2014-01-01 00:00:00 UTC (exclusive): 18 mentions; 3 submissions, 15 comments2014-01-01 00:00:00 UTC to 2015-01-01 00:00:00 UTC (exclusive): 20 mentions; 0 submissions, 20 comments2015-01-01 00:00:00 UTC to 2016-01-01 00:00:00 UTC (exclusive): 10 mentions; 0 submissions, 10 comments2016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 25 mentions; 1 submissions, 24 comments2017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 5 mentions; 0 submissions, 5 comments2018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 8 mentions; 0 submissions, 8 comments20182019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 10 mentions; 0 submissions, 10 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 9 mentions; 1 submissions, 8 comments2021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 4 mentions; 0 submissions, 4 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 5 mentions; 0 submissions, 5 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 2 mentions; 1 submissions, 1 comments2024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 1 mentions; 1 submissions, 0 comments2025-01-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2025

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20122012-01-01 00:00:00 UTC2013-01-01 00:00:00 UTC1037
20132013-01-01 00:00:00 UTC2014-01-01 00:00:00 UTC18315
20142014-01-01 00:00:00 UTC2015-01-01 00:00:00 UTC20020
20152015-01-01 00:00:00 UTC2016-01-01 00:00:00 UTC10010
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC25124
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC505
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC808
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC10010
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC918
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC404
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC505
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC211
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC110
20252025-01-01 00:00:00 UTC2026-01-01 00:00:00 UTC101

From the project README

An excerpt from the repository, fetched Nov 12, 2026.

Read the project’s introduction
The Silver Searcher A code searching tool similar to ack, with a focus on speed. Do you know C? Want to improve ag? I invite you to pair with me. What's so great about Ag? It is an order of magnitude faster than ack. It ignores file patterns from your .gitignore and .hgignore. If there are files in your source repo you don't want to search, just add their patterns to a .ignore file. (*cough* *.min.js *cough*) The command name is 33% shorter than ack, and all keys are on the home row! Ag is quite stable now. Most changes are new features, minor bug fixes, or performance improvements. It's much faster than Ack in my benchmarks: ack test_blah ~/code/ 104.66s user 4.82s system 99% cpu 1:50.03 total ag test_blah ~/code/ 4.67s user 4.58s system 286% cpu 3.227 total Ack and Ag found the same results, but Ag was 34x faster (3.2 seconds vs 110 seconds). My ~/code directory is about 8GB. Thanks to git/hg/ignore, Ag only searched 700MB of that. There are also graphs of performance across releases. How is it so fast? Ag uses Pthreads to take advantage of multiple CPU cores and search files in parallel. Files are mmap()ed instead of read into a buffer. Literal string searching uses Boyer-Moore strstr. Regex searching uses PCRE's JIT compiler (if Ag is built with PCRE >=8.21). Ag calls pcre_study() before executing the same regex on every file. Instead of calling fnmatch() on every pattern in your ignore files, non-regex patterns are loaded into arrays and binary searched. I've written several blog posts showing how I've improved performance. These include how I added pthreads, wrote my own scandir(), benchmarked every revision to find performance regressions, and profiled with gprof and Valgrind. Installing macOS brew install the_silver_searcher or port install the_silver_searcher Linux Ubuntu >= 13.10 (Saucy) or Debian >= 8 (Jessie) apt-get install silversearcher-ag Fedora 21 and lower yum install the_silver_searcher Fedora 22+ dnf install the_silver_searcher RHEL7+ yum install epel-release.noarch the_silver_searcher Gentoo emerge -a sys-apps/the_silver_searcher Arch pacman -S the_silver_searcher Slackware sbopkg -i the_silver_searcher openSUSE zypper install the_silver_searcher CentOS yum install the_silver_searcher NixOS/Nix/Nixpkgs nix-env -iA silver-searcher SUSE Linux Enterprise: Follow these simple instructions. BSD FreeBSD pkg install the_silver_searcher OpenBSD/NetBSD pkg_add the_silver_searcher Windows Win32/64 Unofficial daily builds are available. winget winget install "The Silver Searcher" Notes: This installs a release of ag.exe optimized for Windows. winget is intended to become the default package manager client for Windows. As of June 2020, it's still in beta, and can be installed using instructions there. The setup script in the Ag's winget package installs ag.exe in the first directory that matches one of these criteria: Over a previous instance of ag.exe from the same origin found in the PATH In the directory defined in environment variable bindir_%PROCESSOR_ARCHITECTURE% In the directory defined in environment variable bindir In the directory defined in environment variable windir Chocolatey choco install ag MSYS2 pacman -S mingw-w64-{i686,x86_64}-ag Cygwin Run the relevant setup-*.exe, and select "the_silver_searcher" in the "Utils" category. Building from source Building master Install dependencies (Automake, pkg-config, PCRE, LZMA): macOS: brew install automake pkg-config pcre xz or port install automake pkgconfig pcre xz Ubuntu/Debian: apt-get install -y automake pkg-config libpcre3-dev zlib1g-dev liblzma-dev Fedora: yum -y install pkgconfig automake gcc zlib-devel pcre-devel xz-devel CentOS: yum -y groupinstall "Development Tools" yum -y install pcre-devel xz-devel zlib-devel openSUSE: zypper source-install --build-deps-only the_silver_searcher Windows: It's complicated. See this wiki page. Run the build script (which just runs aclocal, automake, etc): ./build.sh On Windows (inside an msys/MinGW shell): make -f Makefile.w32 Make install: sudo make install Building a release tarball GPG-signed releases are available here. Building release tarballs requires the same dependencies, except for automake and pkg-config. Once you've installed the dependencies, just run: ./configure make make install You may need to use sudo or run as root for the make install. Editor Integration Vim You can use Ag with ack.vim by adding the following line to your .vimrc: let g:ackprg = 'ag --nogroup --nocolor --column' or: let g:ackprg = 'ag --vimgrep' Which has the same effect but will report every match on the line. Emacs You can use ag.el as an Emacs front-end to Ag. See also: helm-ag. TextMate TextMate users can use Ag with my fork of the popular AckMate plugin, which lets you use both Ack and Ag for searching. If you already have AckMate you just want to replace Ack with Ag, move or delete "~/Library/Application Support/TextMate/PlugIns/AckMate.tmplugin/Contents/Resources/ackmate_ack" and run ln -s /usr/local/bin/ag "~/Library/Application Support/TextMate/PlugIns/AckMate.tmplugin/Contents/Resources/ackmate_ack" Other stuff you might like Ack - Better than grep. Without Ack, Ag would not exist. 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. fzf - A command-line fuzzy finder ripgrep Sack - A utility that wraps Ack and Ag. It removes a lot of repetition from searching and opening matching files.
Read the full README on GitHub

What Hacker News says

10 sources
Long time Python dev here so choice #1 is a no-brainer and #2 looks reasonable too but I'm not so sure about the other two. Regarding #4, `obj.method` has already a different meaning than `obj.method()` in Python, so how does Nim express it? As for #3, I kinda see the motivation in statically typed languages for integrating independent libraries and frameworks with different naming conventions. In a dynamically typed language though refactoring is already bad enough, this would make it even harder. My "refactoring tool" of choice is grep (or rather ag, https://github.com/ggreer/the_silver_searcher), with choice #3 you can't just grep for an identifier anymore.
In Pybind11 – Seamless operability between C++11 and Python
In my experience, and I suppose depending on the data, I've found that grep is often the bottleneck for data pipeline tasks like you describe. The silver searcher (https://github.com/ggreer/the_silver_searcher) is, in my experience, about 10x faster than grep for tasks like pulling out fields from json files. It's changed my life. pv (pipe viewer, http://www.ivarch.com/programs/pv.shtml) and top are pretty handy to measure this kind of thing. You should be able to see exactly which process is using how much CPU, and what your throughput is.
In How to Download a List of All Registered Domain Names
I'm the author of The Silver Searcher (aka ag)[1]. I wrote my first C program almost 20 years ago, and I have some not-very-nice things to say about this guide. I hope the author won't take it personally. First, Zed Shaw's Learn C the Hard Way is not worth reading. I agree with most of Tim Hentenaar's criticisms.[2] It's confusing, incomplete, and overly opinionated. If you want to get started with C, read the K&R book. It's not perfect, but it's better than anything else I know of. As for the guide itself, the quality of its advice varies greatly. Some bits are great. Some are good. Some are controversial. Some are dangerously double-edged. And some are Not Even Wrong. It would take too long to go into detail, so I'll just say: Please don't blindly follow this guide. Explore other codebases (including the ones the author linked to). Talk
Read the rest
to other programmers. Write your own projects, and get feedback from those who are more knowledgable. You might notice that this advice generalizes to every language. That's because C isn't special. If anything, the language itself is simpler than most. C has just had more time to accumulate cruft, both technical and cultural. So don't feel intimidated. Once you learn those bits of historical trivia, you'll be fine. 1. https://github.com/ggreer/the_silver_searcher 2. http://hentenaar.com/dont-learn-c-the-wrong-way
In C Programming Guidelines
I strongly encourage people to avoid Learn C the Hard Way. It's neither a good introduction to C nor a good guide to secure C. Reading through, I couldn't help but wince at the inaccuracies and oversights. I hate to say it, but the guide is irredeemable. Who am I to say such things? Well... I learned C almost 20 years ago. I haven't spent the whole time since then writing it, but I'd like to think I'm pretty good. You may even use some of the stuff I've written, such as ag[1]. 1. https://github.com/ggreer/the_silver_searcher
In Ask HN: Resources on secure coding in C?
GitHub link for those who don't know about it: https://github.com/ggreer/the_silver_searcher/ I built ag for searching code. It can be (ab)used for other stuff, but the defaults are optimized for a developer searching a codebase. Also, when writing ag, I don't go out of my way to make sure behavior is correct on all platforms in all corner cases. Grep, on the other hand, has been around for decades. It probably handles cases I've never even thought of.
In Command-line tools can be faster than your Hadoop cluster

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.