Ack

Usage

Usage:

 ack [OPTIONS]... PATTERN [FILES OR DIRECTORIES]

Search for PATTERN in each source file in the tree from the current directory on down. If any files or directories are specified, then only those files and directories are checked. ack may also search STDIN, but only if no file or directory arguments are specified, or if one of them is -.

Default switches may be specified in the ACK_OPTIONS environment variable or an .ackrc file. If you want no dependency on the environment, turn it off with --noenv.

Example:

 ack -i select

Searching

-i, --ignore-case

Ignore case distinctions in pattern

--[no]smart-case

Ignore case distinctions in pattern, but only if pattern contains no upper case

Ignored if -i is specified.

-v, --invert-match

Invert match: select non-matching lines

-w, --word-regexp

Force pattern to match only whole words

-Q, --literal

Quote all metacharacters: pattern is literal

Search Output

File Presentation

--pager=COMMAND

Pipe all ack output through COMMAND

For example, --pager="less -R". Ignored if output is redirected.

--nopager

Do not send output through a pager

Cancels any setting in ~/.ackrc, ACK_PAGER or ACK_PAGER_COLOR.

--[no]heading

Print a filename heading above each file's results

The default is on, when used interactively.

--[no]break

Print a break between results from different files

The default is on, when used interactively.

--group

Same as --heading --break

--nogroup

Same as --noheading --nobreak

--[no]color

Highlight the matching text

The default is on unless output is redirected, or on Windows.

--color-filename=COLOR

Set color for filenames

--color-match=COLOR

Set color for matches

--color-lineno=COLOR

Set color for line numbers

--[no]colour

Same as --[no]color

--flush

Flush output immediately, even when ack is used non-interactively (when output goes to a pipe or file)

File Finding

-f

Only print the files selected, without searching

The PATTERN must not be specified.

-g

Same as -f, but only select files matching PATTERN

--sort-files

Sort the found files lexically

--show-types

Show which types each file has

File Inclusion and Exclusion

--[no]ignore-dir=name

Add or remove directory from the list of ignored directories

--[no]ignore-directory=name

Synonym for --ignore-dir

--ignore-file=filter

Add filter for ignoring files

-r, -R, --recurse

Recurse into subdirectories

This is ack's default behavior.

-n, --no-recurse

No descending into subdirectories

--[no]follow

Follow symlinks

Default is off.

-k, --known-types

Include only files with types that ack recognizes

--type=X

Include only files with the filetype X

--type=noX

Exclude files with the filetype X

See ack --help-types for supported filetypes.

Miscellaneous

--[no]env

Ignore environment variables and global ackrc files

--ackrc=filename

Specify an ackrc file to use

--ignore-ack-defaults

Ignore the default definitions that ack includes

--create-ackrc

Outputs a default ackrc for your customization to standard output

--help, -?

Display help

--help-types

Display all known types

--dump

Dump information on which options are loaded from which RC files

--[no]filter

Force ack to treat standard input as a pipe (--filter) or tty (--nofilter)

--man

Man page

--version

Display version and copyright

--thpppt

Bill the Cat

--bar

The warning admiral

File Type Specification

--type-set TYPE:FILTER:FILTERARGS

Files with the given FILTERARGS applied to the given FILTER are recognized as being of type TYPE. This replaces an existing definition for type TYPE

--type-add TYPE:FILTER:FILTERARGS

Files with the given FILTERARGS applied to the given FILTER are recognized as being of type TYPE

--type-del TYPE

Remove all filters associated with TYPE

File Types

--[no]actionscript

.as, .mxml

--[no]ada

.ada, .adb, .ads

--[no]asm

.asm, .s

--[no]asp

.asp

--[no]aspx

.master, .ascx, .asmx, .aspx, .svc

--[no]batch

.bat, .cmd

--[no]cc

.c, .h, .xs

--[no]cfmx

.cfc, .cfm, .cfml

--[no]clojure

.clj

--[no]cmake

CMakeLists.txt, .cmake

--[no]coffeescript

.coffee

--[no]cpp

.cpp, .cc, .cxx, .m, .hpp, .hh, .h, .hxx

--[no]csharp

.cs

--[no]css

.css

--[no]dart

.dart

--[no]delphi

.pas, .int, .dfm, .nfm, .dof, .dpk, .dproj, .groupproj, .bdsgroup, .bdsproj

--[no]elisp

.el

--[no]elixir

.ex, .exs

--[no]erlang

.erl, .hrl

--[no]fortran

.f, .f77, .f90, .f95, .f03, .for, .ftn, .fpp

--[no]go

.go

--[no]groovy

.groovy, .gtmpl, .gpp, .grunit, .gradle

--[no]haskell

.hs, .lhs

--[no]hh

.h

--[no]html

.htm, .html

--[no]java

.java, .properties

--[no]js

.js

--[no]json

.json

--[no]jsp

.jsp, .jspx, .jhtm, .jhtml

--[no]less

.less

--[no]lisp

.lisp, .lsp

--[no]lua

.lua, first line matches /^#!.*\blua(jit)?/

--[no]make

.mk, .mak, makefile, Makefile, GNUmakefile

--[no]matlab

.m

--[no]md

.mkd, .md

--[no]objc

.m, .h

--[no]objcpp

.mm, .h

--[no]ocaml

.ml, .mli

--[no]parrot

.pir, .pasm, .pmc, .ops, .pod, .pg, .tg

--[no]perl

.pl, .pm, .pod, .t, .psgi, first line matches /^#!.*\bperl/

--[no]perltest

.t

--[no]php

.php, .phpt, .php3, .php4, .php5, .phtml, first line matches /^#!.*\bphp/

--[no]plone

.pt, .cpt, .metadata, .cpy, .py

--[no]pmc

.pmc

--[no]python

.py, first line matches /^#!.*\bpython/

--[no]rake

Rakefile

--[no]rr

.R

--[no]ruby

.rb, .rhtml, .rjs, .rxml, .erb, .rake, .spec, Rakefile, first line matches /^#!.*\bruby/

--[no]rust

.rs

--[no]sass

.sass, .scss

--[no]scala

.scala

--[no]scheme

.scm, .ss

--[no]shell

.sh, .bash, .csh, .tcsh, .ksh, .zsh, .fish, first line matches /^#!.*\b(?:ba|t?c|k|z|fi)?sh\b/

--[no]smalltalk

.st

--[no]sql

.sql, .ctl

--[no]tcl

.tcl, .itcl, .itk

--[no]tex

.tex, .cls, .sty

--[no]textile

.textile

--[no]tt

.tt, .tt2, .ttml

--[no]vb

.bas, .cls, .frm, .ctl, .vb, .resx

--[no]verilog

.v, .vh, .sv

--[no]vhdl

.vhd, .vhdl

--[no]vim

.vim

--[no]xml

.xml, .dtd, .xsl, .xslt, .ent, first line matches /<[?]xml/

--[no]yaml

.yaml, .yml