AG Commands Cheat Sheet

Here is a cli commands cheat sheet for AG command, you can use this as a quick reminder for basic commands with a brief description for each of the commands.

What is AG command?

The Silver Searcher. Like ack, but aims to be faster.
        # To exclude a directory from a search:
# Find files containing "foo", and print the line matches in context:
ag foo

# Find files containing "foo" in a specific directory:
ag foo path/to/directory

# Find files containing "foo", but only list the filenames:
ag -l foo

# Find files containing "FOO" case-insensitively, and print only the match, rather than the whole line:
ag -i -o FOO

# Find "foo" in files with a name matching "bar":
ag foo -G bar

# Find files whose contents match a regular expression:
ag '^ba(r|z)$'

# Find files with a name matching "foo":
ag -g foo

Check out the AG command documentation .

You can also check our MegaSh cheatsheet tool, that has 150+ searchable linux cheat sheets in one page, so you never forget a command as you work again

Check Also

Best AI tools list