5 examples for ag

{{ score }}
  # Recursively search for text 'foo'
ag foo

# Recursively search for filename 'file'
ag -g file
        
{{ score }}
  # search for app.txt
Ag app.txt

# search for special characters and only list filenames
Ag 'foo\(' -l

# search and ignore a directory
Ag foo --ignore dir

# search case insensitive
Ag foo -i
        
{{ score }}
  # search for GREP_OPTIONS= in all dirs except usual suspects (sys, tmp, var, etc.)
ag -Q "GREP_OPTIONS=" --ignore-dir=run --ignore-dir=tmp --ignore-dir=sys --ignore-dir=lost+found --ignore-dir=var
        
{{ score }}
  # Print only matching parts of each line for a regex (and no filenames)
ag --nofilename -o 'some\.thing'
        
{{ score }}
  # search for 'foo' in all csv files
ag foo -G \.csv