Ack – Search All Files with Ack

ack

How can I search all files (including binary) in the current directory with ack v2?

I want to do the same as doing ack 'foo' **, but just with a flag, so it works if I want to search all files in a specific directory without appending **.


Difference between ack 'foo' and ack 'foo' **:

$ mkdir test && cd test
$ printf '\x00\x01foo1\x00' > test1
$ printf 'foo2' > test2
$ ack 'foo'
test2
1:foo2
$ ack 'foo' **
test1
1:foo1

test2
1:foo2

Best Answer

By default, Ack searches for a pattern in all non-binary files below the current directory.

I believe older Ack versions would search through binary files when you passed them the --binary flag. This flag has been removed though. You may be able to use grep instead.

grep -ar 'foo' .
Related Question