Ripgrep is a command line tools that searches patterns under your current directory, like the good old grep, but with faster speed. In this post, I list some of the commonly-used flags for ripgrep.

command Description
rg image Search in a single file
rg image src/ Search in dir src/ recursively
rg image Search image in current dir recursively
rg '^We' test.txt Regex searching support (lines starting with We)
rg -i image Search image and ignore case (case-insensitive search)
rg -s image Smart case search
rg -F '(test)' Search literally, i.e., without using regular expression
rg image -g '*.py' File globing (search in certain files)
rg image -g '!*.py' Negative file globing (do not search in certain files)
rg image --type py or rg image -tpy1 Search image in Python file
rg image -Tpy Do not search image in Python file type
rg -l image Only show files containing image (Do not show the lines)
rg --files-without-match image Show files not containing image
rg -v image Inverse search (search files not containing image)
rg -w image Search complete word
rg --count Show the number of matching lines in a file
rg --count-matches Show the number of matchings in a file


  1. To list the supported filetypes, use rg --type-list. ↩︎