[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-6022":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":19,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":24,"hasPages":24,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":32,"readmeContent":33,"aiSummary":34,"trendingCount":16,"starSnapshotCount":16,"syncStatus":19,"lastSyncTime":35,"discoverSource":36},6022,"the_silver_searcher","ggreer\u002Fthe_silver_searcher","ggreer","A code-searching tool similar to ack, but faster.","http:\u002F\u002Fgeoff.greer.fm\u002Fag\u002F",null,"C",27073,1435,412,445,0,4,19,2,73.37,"Apache License 2.0",false,"master",true,[26,27,28,29,30,31],"ag","c","command-line-tool","pcre","search-in-text","silver-searcher","2026-06-12 04:00:27","# The Silver Searcher\n\nA code searching tool similar to `ack`, with a focus on speed.\n\n[![Build Status](https:\u002F\u002Ftravis-ci.org\u002Fggreer\u002Fthe_silver_searcher.svg?branch=master)](https:\u002F\u002Ftravis-ci.org\u002Fggreer\u002Fthe_silver_searcher)\n\n[![Floobits Status](https:\u002F\u002Ffloobits.com\u002Fggreer\u002Fag.svg)](https:\u002F\u002Ffloobits.com\u002Fggreer\u002Fag\u002Fredirect)\n\n[![#ag on Freenode](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FFreenode-%23ag-brightgreen.svg)](https:\u002F\u002Fwebchat.freenode.net\u002F?channels=ag)\n\nDo you know C? Want to improve ag? [I invite you to pair with me](http:\u002F\u002Fgeoff.greer.fm\u002F2014\u002F10\u002F13\u002Fhelp-me-get-to-ag-10\u002F).\n\n\n## What's so great about Ag?\n\n* It is an order of magnitude faster than `ack`.\n* It ignores file patterns from your `.gitignore` and `.hgignore`.\n* 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\\*)\n* The command name is 33% shorter than `ack`, and all keys are on the home row!\n\nAg is quite stable now. Most changes are new features, minor bug fixes, or performance improvements. It's much faster than Ack in my benchmarks:\n\n    ack test_blah ~\u002Fcode\u002F  104.66s user 4.82s system 99% cpu 1:50.03 total\n\n    ag test_blah ~\u002Fcode\u002F  4.67s user 4.58s system 286% cpu 3.227 total\n\nAck and Ag found the same results, but Ag was 34x faster (3.2 seconds vs 110 seconds). My `~\u002Fcode` directory is about 8GB. Thanks to git\u002Fhg\u002Fignore, Ag only searched 700MB of that.\n\nThere are also [graphs of performance across releases](http:\u002F\u002Fgeoff.greer.fm\u002Fag\u002Fspeed\u002F).\n\n## How is it so fast?\n\n* Ag uses [Pthreads](https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FPOSIX_Threads) to take advantage of multiple CPU cores and search files in parallel.\n* Files are `mmap()`ed instead of read into a buffer.\n* Literal string searching uses [Boyer-Moore strstr](https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FBoyer%E2%80%93Moore_string_search_algorithm).\n* Regex searching uses [PCRE's JIT compiler](http:\u002F\u002Fsljit.sourceforge.net\u002Fpcre.html) (if Ag is built with PCRE >=8.21).\n* Ag calls `pcre_study()` before executing the same regex on every file.\n* Instead of calling `fnmatch()` on every pattern in your ignore files, non-regex patterns are loaded into arrays and binary searched.\n\nI've written several blog posts showing how I've improved performance. These include how I [added pthreads](http:\u002F\u002Fgeoff.greer.fm\u002F2012\u002F09\u002F07\u002Fthe-silver-searcher-adding-pthreads\u002F), [wrote my own `scandir()`](http:\u002F\u002Fgeoff.greer.fm\u002F2012\u002F09\u002F03\u002Fprofiling-ag-writing-my-own-scandir\u002F), [benchmarked every revision to find performance regressions](http:\u002F\u002Fgeoff.greer.fm\u002F2012\u002F08\u002F25\u002Fthe-silver-searcher-benchmarking-revisions\u002F), and profiled with [gprof](http:\u002F\u002Fgeoff.greer.fm\u002F2012\u002F02\u002F08\u002Fprofiling-with-gprof\u002F) and [Valgrind](http:\u002F\u002Fgeoff.greer.fm\u002F2012\u002F01\u002F23\u002Fmaking-programs-faster-profiling\u002F).\n\n\n## Installing\n\n### macOS\n\n    brew install the_silver_searcher\n\nor\n\n    port install the_silver_searcher\n\n\n### Linux\n\n* Ubuntu >= 13.10 (Saucy) or Debian >= 8 (Jessie)\n\n        apt-get install silversearcher-ag\n* Fedora 21 and lower\n\n        yum install the_silver_searcher\n* Fedora 22+\n\n        dnf install the_silver_searcher\n* RHEL7+\n\n        yum install epel-release.noarch the_silver_searcher\n* Gentoo\n\n        emerge -a sys-apps\u002Fthe_silver_searcher\n* Arch\n\n        pacman -S the_silver_searcher\n\n* Slackware\n\n        sbopkg -i the_silver_searcher\n\n* openSUSE\n\n        zypper install the_silver_searcher\n\n* CentOS\n\n        yum install the_silver_searcher\n\n* NixOS\u002FNix\u002FNixpkgs\n\n        nix-env -iA silver-searcher\n\n* SUSE Linux Enterprise: Follow [these simple instructions](https:\u002F\u002Fsoftware.opensuse.org\u002Fdownload.html?project=utilities&package=the_silver_searcher).\n\n\n### BSD\n\n* FreeBSD\n\n        pkg install the_silver_searcher\n* OpenBSD\u002FNetBSD\n\n        pkg_add the_silver_searcher\n\n### Windows\n\n* Win32\u002F64\n\n  Unofficial daily builds are [available](https:\u002F\u002Fgithub.com\u002Fk-takata\u002Fthe_silver_searcher-win32).\n  \n* winget\n\n        winget install \"The Silver Searcher\"\n  \n  Notes:\n  - This installs a [release](https:\u002F\u002Fgithub.com\u002FJFLarvoire\u002Fthe_silver_searcher\u002Freleases) of ag.exe optimized for Windows.\n  - winget is intended to become the default package manager client for Windows.  \n    As of June 2020, it's still in beta, and can be installed using instructions [there](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fwinget-cli).\n  - The setup script in the Ag's winget package installs ag.exe in the first directory that matches one of these criteria:\n     1. Over a previous instance of ag.exe *from the same [origin](https:\u002F\u002Fgithub.com\u002FJFLarvoire\u002Fthe_silver_searcher)* found in the PATH\n     2. In the directory defined in environment variable bindir_%PROCESSOR_ARCHITECTURE%\n     3. In the directory defined in environment variable bindir\n     4. In the directory defined in environment variable windir\n  \n* Chocolatey\n\n        choco install ag\n* MSYS2\n\n        pacman -S mingw-w64-{i686,x86_64}-ag\n* Cygwin\n\n  Run the relevant [`setup-*.exe`](https:\u002F\u002Fcygwin.com\u002Finstall.html), and select \"the\\_silver\\_searcher\" in the \"Utils\" category.\n\n## Building from source\n\n### Building master\n\n1. Install dependencies (Automake, pkg-config, PCRE, LZMA):\n    * macOS:\n\n            brew install automake pkg-config pcre xz\n        or\n\n            port install automake pkgconfig pcre xz\n    * Ubuntu\u002FDebian:\n\n            apt-get install -y automake pkg-config libpcre3-dev zlib1g-dev liblzma-dev\n    * Fedora:\n\n            yum -y install pkgconfig automake gcc zlib-devel pcre-devel xz-devel\n    * CentOS:\n\n            yum -y groupinstall \"Development Tools\"\n            yum -y install pcre-devel xz-devel zlib-devel\n    * openSUSE:\n\n            zypper source-install --build-deps-only the_silver_searcher\n\n    * Windows: It's complicated. See [this wiki page](https:\u002F\u002Fgithub.com\u002Fggreer\u002Fthe_silver_searcher\u002Fwiki\u002FWindows).\n2. Run the build script (which just runs aclocal, automake, etc):\n\n        .\u002Fbuild.sh\n\n   On Windows (inside an msys\u002FMinGW shell):\n\n        make -f Makefile.w32\n3. Make install:\n\n        sudo make install\n\n\n### Building a release tarball\n\nGPG-signed releases are available [here](http:\u002F\u002Fgeoff.greer.fm\u002Fag).\n\nBuilding release tarballs requires the same dependencies, except for automake and pkg-config. Once you've installed the dependencies, just run:\n\n    .\u002Fconfigure\n    make\n    make install\n\nYou may need to use `sudo` or run as root for the make install.\n\n\n## Editor Integration\n\n### Vim\n\nYou can use Ag with [ack.vim](https:\u002F\u002Fgithub.com\u002Fmileszs\u002Fack.vim) by adding the following line to your `.vimrc`:\n\n    let g:ackprg = 'ag --nogroup --nocolor --column'\n\nor:\n\n    let g:ackprg = 'ag --vimgrep'\n\nWhich has the same effect but will report every match on the line.\n\n### Emacs\n\nYou can use [ag.el][] as an Emacs front-end to Ag. See also: [helm-ag].\n\n[ag.el]: https:\u002F\u002Fgithub.com\u002FWilfred\u002Fag.el\n[helm-ag]: https:\u002F\u002Fgithub.com\u002Fsyohex\u002Femacs-helm-ag\n\n### TextMate\n\nTextMate users can use Ag with [my fork](https:\u002F\u002Fgithub.com\u002Fggreer\u002FAckMate) 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 `\"~\u002FLibrary\u002FApplication Support\u002FTextMate\u002FPlugIns\u002FAckMate.tmplugin\u002FContents\u002FResources\u002Fackmate_ack\"` and run `ln -s \u002Fusr\u002Flocal\u002Fbin\u002Fag \"~\u002FLibrary\u002FApplication Support\u002FTextMate\u002FPlugIns\u002FAckMate.tmplugin\u002FContents\u002FResources\u002Fackmate_ack\"`\n\n## Other stuff you might like\n\n* [Ack](https:\u002F\u002Fgithub.com\u002Fpetdance\u002Fack3) - Better than grep. Without Ack, Ag would not exist.\n* [ack.vim](https:\u002F\u002Fgithub.com\u002Fmileszs\u002Fack.vim)\n* [Exuberant Ctags](http:\u002F\u002Fctags.sourceforge.net\u002F) - Faster than Ag, but it builds an index beforehand. Good for *really* big codebases.\n* [Git-grep](http:\u002F\u002Fgit-scm.com\u002Fdocs\u002Fgit-grep) - As fast as Ag but only works on git repos.\n* [fzf](https:\u002F\u002Fgithub.com\u002Fjunegunn\u002Ffzf) - A command-line fuzzy finder \n* [ripgrep](https:\u002F\u002Fgithub.com\u002FBurntSushi\u002Fripgrep)\n* [Sack](https:\u002F\u002Fgithub.com\u002Fsampson-chen\u002Fsack) - A utility that wraps Ack and Ag. It removes a lot of repetition from searching and opening matching files.\n","The Silver Searcher 是一个专注于速度的代码搜索工具，类似于 ack。它利用多线程、mmap 以及高效的字符串和正则表达式搜索算法（如 Boyer-Moore 和 PCRE 的 JIT 编译器）来实现比 ack 快得多的搜索性能。此外，它能够自动忽略 .gitignore 或 .hgignore 中指定的文件模式，并支持通过自定义 .ignore 文件进一步排除不需要搜索的文件类型。此工具非常适合需要快速在大型代码库中查找特定内容的开发者使用，在日常开发、调试或维护项目时可以显著提高工作效率。","2026-06-11 03:05:19","top_language"]