search for a specific file type with ack

Use –type for this. To only search python files for example:

ack --type=python searchthis

List all the supported types with

ack --help=types  # ack 2.x
ack --help-types  # ack 3.x.x

If you want to create a custom type, add something like this to ~/.ackrc:

--type-add=custom:ext:rb
--type-set

Then you can use –type=custom with ack to just search file with the .rb extension.

Leave a Comment

error code: 521