commands.sh

ag

all

The Silver Searcher. Like `ack`, but aims to be faster.

More info →

Options (5)

-l, --files-with-matchesboolean

Find files containing `string`, but only list the filenames

Example: ag {{[-l|--files-with-matches]}} string
-i, --ignore-caseboolean

Find files containing `STRING` case-insensitively, and print only the match, rather than the whole line

Example: ag {{[-i|--ignore-case]}} {{[-o|--only-matching]}} STRING
-o, --only-matchingboolean

Find files containing `STRING` case-insensitively, and print only the match, rather than the whole line

Example: ag {{[-i|--ignore-case]}} {{[-o|--only-matching]}} STRING
-G, --file-search-regexboolean

Find `string` in files with a name matching `file_name`

Example: ag string {{[-G|--file-search-regex]}} file_name
-g, --filename-patternboolean

Find files with a name matching `string`

Example: ag {{[-g|--filename-pattern]}} string

Examples (7)

Find files containing `string`, and print the line matches in context

ag string

Find files containing `string` in a specific directory

ag string path/to/directory

Find files containing `string`, but only list the filenames

ag [-l|--files-with-matches] string

Find files containing `STRING` case-insensitively, and print only the match, rather than the whole line

ag [-i|--ignore-case] [-o|--only-matching] STRING

Find `string` in files with a name matching `file_name`

ag string [-G|--file-search-regex] file_name

Find files whose contents match a `regex`

ag '^ca(t|r)$'

Find files with a name matching `string`

ag [-g|--filename-pattern] string
made by @shridhargupta | data from tldr-pages