OS Manuals

/usr/bin/ack

A Perl-powered replacement for grep

From ack 3.10.0-r5 (os), captured 2026-11-05 by running ack --help (exit 0). permalink

Usage: ack [OPTION]... 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 an .ackrc file. If you want no dependency
on the environment, turn it off with --noenv.

File select actions:
  -f                            Only print the files selected, without
                                searching.  The PATTERN must not be specified.
  -g                            Same as -f, but only select files matching
                                PATTERN.

File listing actions:
  -l, --files-with-matches      Print filenames with at least one match
  -L, --files-without-matches   Print filenames with no matches
  -c, --count                   Print filenames and count of matching lines

Searching:
  -i, --ignore-case             Ignore case distinctions in PATTERN
  -S, --[no]smart-case          Ignore case distinctions in PATTERN,
                                only if PATTERN contains no upper case.
                                Ignored if -i or -I are specified.
  -I, --no-ignore-case          Turns on case-sensitivity in PATTERN.
                                Negates -i and --smart-case.
  -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
  --range-start PATTERN         Specify PATTERN as the start of a match range.
  --range-end PATTERN           Specify PATTERN as the end of a match range.
  --match PATTERN               Specify PATTERN explicitly. Typically omitted.
  --and PATTERN                 Specifies PATTERN that MUST also be found on
                                the line for a match to occur. Repeatable.
  --or PATTERN                  Specifies PATTERN that MAY also be found on
                                the line for a match to occur. Repeatable.
  --not PATTERN                 Specifies PATTERN that must NOT be found on
                                the line for a match to occur. Repeatable.

Search output:
  --output=expr                 Output the evaluation of expr for each line
                                (turns off text highlighting)
  -o                            Show only the part of a line matching PATTERN
                                Same as --output='$&'
  --passthru                    Print all lines, whether matching or not
  -m, --max-count=NUM           Stop searching in each file after NUM matches
  -1                            Stop searching after one match of any kind
  -H, --with-filename           Print the filename for each match (default:
                                on unless explicitly searching a single file)
  -h, --no-filename             Suppress the prefixing filename on output
  --[no]column                  Show the column number of the first match

  -A NUM, --after-context=NUM   Print NUM lines of trailing context after
                                matching lines.
  -B NUM, --before-context=NUM  Print NUM lines of leading context before
                                matching lines.
  -C [NUM], --context[=NUM]     Print NUM lines (default 2) of output context.

  --print0                      Print null byte as separator between filenames,
                                only works with -f, -g, -l, -L or -c.

  -s                            Suppress error messages about nonexistent or
                                unreadable files.


File presentation:
  --pager=COMMAND               Pipes 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.  (default: on when used interactively)
  --[no]break                   Print a break between results from different
                                files.  (default: on when used interactively)
  --group                       Same as --heading --break
  --nogroup                     Same as --noheading --nobreak
  -p, --proximate=LINES         Separate match output with blank lines unless
                                they are within LINES lines from each other.
  -P, --proximate=0             Negates --proximate.
  --[no]underline               Print a line of carets under the matched text.
  --[no]color, --[no]colour     Highlight the matching text (default: on unless
                                output is redirected, or on Windows)
  --color-filename=COLOR
  --color-match=COLOR
  --color-colno=COLOR
  --color-lineno=COLOR          Set the color for filenames, matches, line and
                                column numbers.
  --help-colors                 Show a list of possible color combinations.
  --help-rgb-colors             Show a list of advanced RGB colors.
  --flush                       Flush output immediately, even when ack is used
                                non-interactively (when output goes to a pipe or
                                file).


File finding:
  --sort-files                  Sort the found files lexically.
  --show-types                  Show which types each file has.
  --files-from=FILE             Read the list of files to search from FILE.
  -x                            Read the list of files to search from STDIN.

File inclusion/exclusion:
  --[no]ignore-dir=name         Add/remove directory from list of ignored dirs
  --[no]ignore-directory=name   Synonym for ignore-dir
  --ignore-file=FILTER:ARGS     Add filter for ignoring files.
  -r, -R, --recurse             Recurse into subdirectories (default: on)
  -n, --no-recurse              No descending into subdirectories
  --[no]follow                  Follow symlinks.  Default is off.

File type inclusion/exclusion:
  -t X, --type=X                Include only X files, where X is a filetype,
                                e.g. python, html, markdown, etc
  -T X, --type=noX              Exclude X files, where X is a filetype.
  -k, --known-types             Include only files of types that ack recognizes.
  --help-types                  Display all known types, and how they're defined.

File type specification:
  --type-set=TYPE:FILTER:ARGS   Files with the given ARGS applied to the given
                                FILTER are recognized as being of type TYPE.
                                This replaces an existing definition for TYPE.
  --type-add=TYPE:FILTER:ARGS   Files with the given ARGS applied to the given
                                FILTER are recognized as being type TYPE.
  --type-del=TYPE               Removes all filters associated with TYPE.

Miscellaneous:
  --version                     Display version & copyright
  --[no]env                     Ignore environment variables and global ackrc
                                files.  --env is legal but redundant.
  --ackrc=filename              Specify an ackrc file to use
  --ignore-ack-defaults         Ignore default definitions included with ack.
  --create-ackrc                Outputs a default ackrc for your customization
                                to standard output.
  --dump                        Dump information on which options are loaded
                                and where they're defined.
  --[no]filter                  Force ack to treat standard input as a pipe
                                (--filter) or tty (--nofilter)
  --help                        This help
  --man                         Print the manual.
  --help-types                  Display all known types, and how they're defined.
  --help-colors                 Show a list of possible color combinations.
  --help-rgb-colors             Show a list of advanced RGB colors.
  --thpppt                      Bill the Cat
  --bar                         The warning admiral
  --cathy                       Chocolate! Chocolate! Chocolate!

Filter specifications:
    If FILTER is "ext", ARGS is a list of extensions checked against the
        file's extension.
    If FILTER is "is", ARGS must match the file's name exactly.
    If FILTER is "match", ARGS is matched as a case-insensitive regex
        against the filename.
    If FILTER is "firstlinematch", ARGS is matched as a regex the first
        line of the file's contents.

Exit status is 0 if match, 1 if no match.

ack's home page is at https://beyondgrep.com/

The full ack manual is available by running "ack --man".

This is version v3.10.0 of ack.  Run "ack --version" for full version info.
Options (66)
OptionDescriptionSource
-fOnly print the files that would be searched, without actually doing any searching.help + man
-g PATTERNPrint searchable files where the relative path + filename matches PATTERN.help + man
-l, --files-with-matchesOnly print the filenames of matching files, instead of the matching text.help + man
-L, --files-without-matchesOnly print the filenames of files that do NOT match.help + man
-c, --countPrint filenames and count of matching lineshelp + man
-i, --ignore-caseIgnore case distinctions in PATTERN.help + man
-S isIgnore case distinctions in PATTERN, only if PATTERN contains no upper case.help + man
-I, --no-ignore-caseTurns on case distinctions in PATTERN.help + man
-v, --invert-matchInvert match: select non-matching lines.help + man
-w, --word-regexpForce PATTERN to match only whole words.help + man
-Q, --literalQuote all metacharacters in PATTERN, it is treated as a literal.help + man
--range-start PATTERNSpecifies patterns that mark the start and end of a range.help + man
--range-end PATTERNSpecify PATTERN as the end of a match range.help
--match PATTERNSpecify the PATTERN explicitly.help + man
--and PATTERNSpecifies a PATTERN that MUST ALSO be found on a given line for a match to occur.help + man
--or PATTERNSpecifies a PATTERN that MAY be found on a given line for a match to occur.help + man
--not PATTERNSpecifies a PATTERN that must NOT be true on a given line for a match to occur.help + man
--output exprOutput the evaluation of expr for each line (turns off text highlighting).help + man
-oShow only the part of each line matching PATTERN (turns off text highlighting).help + man
--passthruPrints all lines, whether or not they match the expression.help + man
-m, --max-count NUMStop searching in each file after NUM matcheshelp + man
-1Stops after reporting first match of any kind.help + man
-H, --with-filenamePrint the filename for each match (default: on unless explicitly searching a single file)help + man
-h, --no-filenameSuppress the prefixing of filenames on output when multiple files are searched.help + man
-A, --after-context NUMPrint NUM lines of trailing context after matching lines.help + man
-B, --before-context NUMPrint NUM lines of leading context before matching lines.help + man
-C, --context NUMPrint NUM lines (default 2) of output context.help
--print0Print null byte as separator between filenames, only works with -f, -g, -l, -L or -c.help + man
-sSuppress error messages about nonexistent or unreadable files.help + man
--pager COMMANDPipes all ack output through COMMAND.help + man
--nopagerDo not send output through a pager.help
--group groupsSame as --heading --breakhelp + man
--nogroup printsSame as --noheading --nobreakhelp + man
-p, --proximate LINESSeparate match output with blank lines unless they are within LINES lines from each other.help
--color-filename COLORSets the color to be used for filenames.help + man
--color-match COLORSets the color to be used for matches.help + man
--color-colno COLORSets the color to be used for column numbers.help + man
--color-lineno COLORSet the color for filenames, matches, line and column numbers.help + man
--help-colorsPrint a chart of various color combinations.help + man
--help-rgb-colorsLike --help-colors but with more precise RGB colors.help + man
--flushFlush output immediately, even when ack is used non-interactively (when output goes to a pipe or file).help + man
--sort-filesSorts the found files lexicographically.help + man
--show-typesOutputs the filetypes that ack associates with each file.help + man
--files-from FILEThe list of files to be searched is specified in FILE.help + man
-xRead the list of files to search from STDIN.help + man
--ignore-file FILTER:ARGSIgnore files matching FILTER:ARGS.help + man
-r, -R, --recurseRecurse into subdirectories (default: on)help + man
-n, --no-recurseNo descending into subdirectories.help + man
-t, --type, --TYPE XInclude only X files, where X is a filetype, e.g. python, html, markdown, etchelp + man
-k, --known-typesLimit selected files to those with types that ack knows about.help + man
--help-typesDisplay all known types, and how they're defined.help + man
--type-set TYPE:FILTER:ARGSFiles with the given ARGS applied to the given FILTER are recognized as being of type TYPE.help + man
--type-add TYPE:FILTER:ARGSFiles with the given ARGS applied to the given FILTER are recognized as being of (the existing) type TYPE.help + man
--type-del TYPEThe filters associated with TYPE are removed from Ack, and are no longer considered for searches.help + man
--versionDisplay version and copyright information.help + man
--ackrc filenameSpecifies an ackrc file to load after all others;help + man
--ignore-ack-defaultsTells ack to completely ignore the default definitions provided with ack.help + man
--create-ackrcOutputs a default ackrc for your customization to standard output.help + man
--dumpWrites the list of options loaded and where they came from to standard output.help + man
--helpPrint a short help statement.help + man
--manPrint this manual page.help + man
--thppptDisplay the all-important Bill The Cat logo.help + man
--barCheck with the admiral for traps.help + man
--cathyChocolate! Chocolate! Chocolate!help + man
--color highlightsOn Windows, this option is off by default unless the Win32::Console::ANSI module is installed or the "ACK_PAGER_COLOR" environment variable is used. (in the manual page but not in --help)man
-PNegates the effect of the --proximate option. (in the manual page but not in --help)man

Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.