I have ack-grep installed on my local machine, and find it indispensable for quickly 'acking' through a codebase when debugging.

However, on my cheap shared hosting, there is no ack-grep. One of the testimonials on betterthangrep.com mentions a

Rube Goldberg mess of find/grep/xargs

which sounds like what I need, but coming from the opposite direction.

Does anyone know what it might be?


The actual command is named ack. (Some distributors may have renamed it to ack-grep due to name collisions.) The official website is indeed http://betterthangrep.com, and it has a long list of installation methods, even in case your distribution does not have ack.

For example, you can download App::Ack from Perl's CPAN (using cpanminus):

cpanm --sudo App::Ack

Or get the "standalone" version:

curl http://betterthangrep.com/ack-standalone > ~/bin/ack
chmod +x ~/bin/ack

Yes, you can do it manually, and in fact you should know how to do it manually. For example, if you've been doing

ack function_name --php

you can do that (pretty much) as

find . -name '*.php' | xargs grep function_name

It's longer to type, and you can make an alias or shell script out of it, but it's good to know how to do it, just for the sake of knowing how to do it.

Your question makes me smile because usually what I hear is old guard Unix greybeards saying "You don't need ack, just use find, xargs and grep." It's cool to see someone coming at it from the other direction.

  • 1
    Awfully close to "You don't need that newfangled wheel, just reinvent your own." – user1686 Aug 25 '11 at 15:50
  • 1
    It certainly is, but it's a battle I've stopped getting into. If people want to do it the old way because That's How Ken And Dennis Say It Should Be, then that's up to them. – Andy Lester Aug 25 '11 at 22:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.