Submit fixes on github
Follow me on twitter

(ack, don’t display full file contents, minified files)

Use the -o flag to avoid dumping a huge amount of text when a minified or bundled file is matched.
Another option is ripgrep with the -M flag. See this thread:

(ack shortcut for ignoring js files)

Handy for working in typescript:

ack --no-js pattern  


ack --ts pattern  

(ack ignore file, ignore directory, ignore extension)

Ignore specific file ack --ignore-file=is:code.js pattern
Ignore specific dir ack --ignore-dir=is:build pattern
Ignore specific extension ack --ignore-file=ext:ipynb pattern
Ignore file matching pattern ack --ignore-file=match:/example/ pattern

I also use create a default ~/.ackrc with (warning, destructive!):

ack --create-ackrc > ~/.ackrc  

And then add the following additions:


Make sure export ACKRC=".ackrc" is in my shell profile (~/.bash_profile)

The ~/.ackrc file can be supplemented with project-specific .ackrc files in the project root.

(ack in vim)

Add Plug 'mileszs/ack.vim' to ~/.vimrc, then:

:source ~/.vimrc  

Then use :Ack pattern
Follow symlinks with :Ack --follow pattern

(ack search files with specific extension)

If file type is built in, use:

ack --type=python searchthis  

If the file type is not built in (e.g. markdown), use:

ack --type-add=md:ext:md --type=md searchthis  

(ack, regex group, backreference)

Use the --output flag. For example, myfile.txt looks like this:



ack 'a(\w+)' --output "\$1" myfile.txt  



(ack, syntax reminder)

Use ack --dump for a concise reading of everything in ~/.ackrc
There are examples of all ways to ignore files / directories

(ack, find files instead of text)

To find all module.map files in the subtree:

ack -g module.map  

See ‘man ack’ for some caveats on ack -g.
It is not intended to be a general purpose file finder

Works with wildcard too, for example all yml files that are in a Modules dir
(or have Modules have somewhere in the path):

ack -g Modules.*yml  

(ack filetype, ack pipe, ack ignore)

To pipe found files back to ack:

ack -g module.map | ack -x -w -i darwin