This is my command history. Not my Uber Eats orders, thankfully. My grep commands. 🥁
Whatever you work on, grep earns its place, even if you usually search from your editor. If you know Linux like the back of your hand, this post isn't for you.
Forgot a flag? Check man7.org or run man grep.
Recursive search
The basics: search every file in a folder and its subfolders.
grep -r "pattern" .Exclude folders
Exclude one folder, or several at once with braces.
grep -r --exclude-dir=node_modules "pattern" .grep -r --exclude-dir={node_modules,vendor} "pattern" .Include or exclude file types
grep -r --exclude="*.min.css" "pattern" .grep -r --include="*.php" "pattern" .Show file names only
Useful when you only need to know where something is, not every matching line.
grep -rl "pattern" .