Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

264 lines (235 sloc) 10.85 kb
<meta NAME="Author" Content="Andy Lester">
<title>ack 1.96 -- better than grep, a source code search tool for programmers</title>
<style type="text/css">
div.bill pre {
font-weight : bold;
font-size : 25pt;
body {
margin-left: 100px;
margin-right: 100px;
<body bgcolor="white">
<div class="bill" align="center">
<table border="0" cellpadding="10" cellspacing="10">
_ /|
U ack!
<?php include "ack-lists.php" ?>
<b>ack</b> is a tool like <i>grep</i>, designed for programmers with large trees of
heterogeneous source code.
ack is written purely in Perl, and takes advantage of the power of Perl's
regular expressions.
<h2>Latest version of ack: 1.96, September 18, 2011</h2>
Read the <a href="Changes">Changelog</a>
<h2>How to install ack</h2>
It can be installed any number of ways:
<b>Install the CPAN module <a href="">App::Ack</a></b>.
If you are a Perl user already, this is the way to go.
<b>Download the
<a href="">standalone version</a></b> of ack
that requires no modules beyond what's in core Perl, and putting it in your path.
If you don't want to mess with setting up Perl's CPAN shell, this is easiest.
curl &gt; ~/bin/ack &amp;&amp; chmod 0755 !#:3
<li>Install the <b>Macport</b>: <a href=""></a></li>
<li>Install the <b>Debian package</b>: <a href="">ack-grep</a>
<li>To install ack-grep as "ack" instead of "ack-grep", use this command:<br>
<tt> sudo dpkg-divert --local --divert /usr/bin/ack --rename --add /usr/bin/ack-grep</tt></li>
<li>Install the <b>Ubuntu package</b>: ack-grep</li>
<li>Install the <b>Fedora package</b>: ack</li>
<li>Install the <b>Gentoo package</b>: sys-apps/ack</li>
<li>Install the <b>Arch package</b>: community/ack</li>
<h2>AckMate for Textmate users</h2>
Users of TextMate, the programmer's editor for the Mac, can use the AckMate plugin by Trevor Squires:
TextMate users know just how slow its "Find in Project"
can be with large source trees. That's why you need
"ack-in-project" &mdash; a TextMate bundle that uses
the super-speedy "ack" tool to search your code
FAST. It gives you beautiful, clickable results just
as fast as "ack" can find them. Check it out at:
<a href=""></a>
<h2>Testimonials about ack</h2>
"Whoa, this is *so* much better than grep it's not even funny."
-- <a href="">Jacob Kaplan-Moss</a>, creator of <a href="">Django</a>.
"Thanks for creating ack and sharing it with the world. It
makes my days just a little more pleasant. I'm glad to have it
in my toolbox. That installation is as simple as downloading the
standalone version and chmodding is a nice touch."
-- <a href="">Alan De Smet</a>
"I came across ack today, and now grep is sleeping outside. It's very
much like grep, except it assumes all the little things that you always
wanted grep to remember, but that it never did. It actually left the
light on for you, and put the toilet seat down."
-- <a href="">Samuel Huckins</a>
"ack is the best tool I have added to my toolbox in the past year, hands down."
-- <a href="">Bill Mill</a> on <a href="">reddit</a>
"I use it all the time and I can't imagine how I managed with only
-- <a href="">Thomas Thurman</a>
"This has been replacing a Rube Goldberg mess of <tt>find/grep/xargs</tt>
that I've been using to search source files in a fairly large codebase."
-- <a href="">G. Wade Johnson</a>
"You had me at <tt>--thpppt</tt>."
-- John Gruber, <a href="">Daring Fireball</a>
"Grepping of SVN repositories was driving me crazy until I found ack. It
fixes all of my grep annoyances and adds features I didn't even know I
wanted." -- <a href="">Paul Prescod</a>
"I added ack standalone to our internal devtools project at work. People
are all over it." -- <a href="">Jason Gessner</a>
"I just wanted to send you my praise for this wonderful little
application. It's in my toolbox now and after one day of use has proven
itself invaluable." -- <a href="">Benjamin W. Smith</a>
"ack has replaced grep for me for 90% of what I used it for.
Obsoleted most of my 'grep is crippled' wrapper scripts, too."
-- Randall Hansen
"ack's powerful search facilities are an invaluable tool for searching
large repositories like <a href="">Parrot</a>. The
ability to control the search domain by filetype--and to do so
independent of platform--has made one-liners out of many complex
queries previously done with custom scripts. Parrot developers
are hooked on ack."
-- <a href="">Jerry Gay</a>
"That thing is awesome. People see me using it and ask what the heck it is."
-- Andrew Moore
<h2>Top 10 reasons to use ack instead of grep.</h2>
<li>It's <b>blazingly fast</b> because it only searches the stuff you want searched.</li>
<li>ack is pure Perl, so it <b>runs on Windows</b> just fine. It has <b>no dependencies</b> other than Perl 5.</li>
<li>The <a href="">standalone
version</a> uses no non-standard modules, so you can put it in your
<tt>~/bin</tt> without fear.</li>
Searches recursively through directories by default, while ignoring
<tt>.svn</tt>, <tt>CVS</tt> and other VCS directories.
Which would you rather type?<br>
<tt>$ grep pattern $(find . -type f | grep -v '\.svn')</tt><br>
<tt>$ ack pattern</tt>
<li>ack <b>ignores most of the crap you don't want to search</b>
<li>VCS directories
<li><i>blib</i>, the Perl build directory
<li>backup files like <i>foo~</i> and <i>#foo#</i>
<li>binary files, core dumps, etc
<li>Ignoring .svn directories means that <b>ack is faster than grep</b> for searching through trees.</li>
<li><b>Lets you specify file types to search</b>, as in <tt>--perl</tt> or <tt>--nohtml</tt>.
<li>Which would you rather type?<br>
<tt>$ grep pattern $(find . -name '*.pl' -or -name '*.pm' -or -name '*.pod' | grep -v .svn)</tt><br>
<tt>$ ack --perl pattern</tt>
Note that ack's <tt>--perl</tt> also checks the shebang lines of
files without suffixes, which the find command will not.
<li>File-filtering capabilities usable without searching with <tt>ack -f</tt>. This lets you <b>create lists of files of a given type</b>.<br>
<tt>$ ack -f --perl &gt; all-perl-files</tt>
<li><b>Color highlighting</b> of search results.
<li>Uses <b>real Perl regular expressions</b>, not a GNU subset.
<li>Allows you to specify output using Perl's special variables. To find all <tt>#include</tt> files in C programs:
<li><tt>ack --cc '#include\s+&lt;(.*)&gt;' --output '$1' -h</tt>
Many command-line switches are the same as in GNU grep:<br>
<tt>-w</tt> does word-only searching<br>
<tt>-c</tt> shows counts per file of matches<br>
<tt>-l</tt> gives the filename instead of matching lines<br>
<li><b>Command name is 25% fewer characters to type!</b> Save days of free-time! Heck, it's 50% shorter compared to <tt>grep -r</tt>.</li>
<h2>ack's command flags</h2>
$ ack --help
<?php include "ack-help.txt" ?>
<h2>File types that ack understands</h2>
$ ack --help-types
<?php include "ack-help-types.txt" ?>
<!-- Google tracking, must be just before close of body tag -->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-631706-7']);
(function() {
var ga = document.createElement('script');
ga.src = ('https:' == document.location.protocol ? 'https://ssl' :
'http://www') + '';
ga.setAttribute('async', 'true');
Jump to Line
Something went wrong with that request. Please try again.