How to Use ripgrep/rg for Elegant Substring Search in Bash

The aim of this pageđź“ť is to explain searching with rg in bash on MacOS based on the particular examples provided. I began looking into it after watching https://youtu.be/kgII-YWo3Zw?si=SmVBkGIQyy8NRTI0&t=2273.

Pavol Kutaj
1 min readFeb 25, 2024
  • rg was developed as a faster alternative to grep, optimized for searching large codebases.
  • it is amazingly fast, nicely colored and works OOTB — for me with the couple of basic flags for filtering files
  • To search for patterns in specific file types, use --type or -t with rg.
  • Use --glob of -g with rg to search for patterns in files matching a glob pattern.
  • My command for looking for “metalinguistic” in my knowledge base filtered to markdown files is simply
rg metaling -t md
  • combined with the Warp terminal, it’s cool how fast you get a list of clickable files containing the match of a pattern in a complex of subdirectories

LINKS

--

--

No responses yet