ripgrep: search TypeScript files excluding common dirs
Search recursively for <Button in TS/TSX files while excluding node_modules, src/components/contact, and src/components/ui.
rg "<Button" -g "*.ts*" -g '!*./node_modules/**' -g '!src/components/contact/**' -g '!src/components/ui/**'
Categories
Operating Systems
cross-platformmacoslinuxwindows
Prerequisites
ripgrep (rg) installedzsh or bash shellrun from project root
Last Tested
10/17/2025
Tags
greprgzshglobtypescriptreact
Details
What it does
Finds all occurrences of <Button in .ts / .tsx files, while excluding folders that create noise or slowdowns.
Why the quoting matters
zsh treats ! as history expansion. Wrapping the negated globs in single quotes prevents zsh: event not found errors.
rg "<Button" -g "*.ts*" -g '!*./node_modules/**' -g '!src/components/contact/**' -g '!src/components/ui/**'
Flags breakdown
-g "*.ts*": include.tsand.tsx-g '!*./node_modules/**': excludenode_modules(quoted forzsh)-g '!src/components/contact/**': exclude that directory-g '!src/components/ui/**': exclude that directory
Variations
- Show only filenames: add
-l - Show line numbers: add
-n - Keep colored output when piping: add
--color=always
Safety Notes
- Non-destructive: read-only search.
- zsh users: keep the single quotes around patterns starting with
!. - You can simplify the
node_modulespattern to-g '!node_modules/**'—the version above matches the exact command that was verified in your shell.
Related Commands
Other useful commands you might find helpful
Codex: add Chrome DevTools MCP via config.toml
Register the Chrome DevTools MCP server in Codex by adding the TOML block to ~/.codex/config.toml and restarting Codex.
[mcp_servers."chrome-devtools"]Homebrew: fix codex stuck on old version (formula overrides cask)
Removes the outdated codex Homebrew formula (0.46.x) so the newly installed cask (0.47.x) becomes the active binary.
brew uninstall codex --formulaTemporarily Override DNS for a Domain (macOS)
Force your Mac to resolve a domain to a specific IP by modifying the /etc/hosts file
sudo nano /etc/hostsRelated Articles
Blog posts that might provide additional context