Code Yarns ‍👨‍💻
Tech BlogPersonal Blog


📅 2014-Jun-10 ⬩ ✍️ Ashwin Nanjappa ⬩ 📚 Archive

Ack, also known as ack-grep, is a commandline tool to search for text. It is an excellent replacement for grep for programmers.

To install it:

$ sudo apt install ack-grep

To search for foo in all files in current directory and its subdirectories:

$ ack-grep foo

Ack intelligently searches only files and directories which might contain text files or source code files. For example, it skips the hidden directories used by version control systems like Git or Mercurial. It reports the results in color and nicely formatted.

To search ignoring case if search string is lowercase:

$ ack-grep --smart-case foo

To ignore a particular file named dumbofile while searching:

$ ack-grep --ignore-file=is:dumbofile foo

If you use certain options frequently, you might want to place them in a .ackrc file so that they are used by default:

# This file is ~/.ackrc

Tried with: Ack 2.12 and Ubuntu 14.04