Script Valley
Reading Other People's Code
Navigating Large CodebasesLesson 3.1

How to use grep and IDE search to find code fast

grep flags, ripgrep advantages, find by symbol vs text, case sensitivity, regex in search, searching inside node_modules, IDE go-to-definition

Search Is Your Navigation System

Code search decision flow diagram

In a large codebase, reading files sequentially is impractical. Search is how professionals navigate. Master three types: text search, symbol search, and definition lookup.

grep and ripgrep for Text Search

# grep: search recursively for a string
grep -r "validateToken" ./src

# grep with line numbers and file names
grep -rn "validateToken" ./src

# ripgrep (rg): faster, respects .gitignore by default
rg "validateToken" src/

# Search for a pattern with context (3 lines before/after)
rg -C 3 "throw new AuthError" src/

# Case-insensitive search
rg -i "userid" src/

# Search only in specific file types
rg -t js "fetchUser" src/

IDE Symbol Search Is More Powerful Than Text Search

Text search finds strings. Symbol search finds declarations, usages, and implementations — and it understands the difference. In VS Code: Ctrl+Shift+F for text search, Ctrl+T for symbol search, F12 for go-to-definition. Go-to-definition is the fastest way to understand what a function does — jump to its source rather than reading callers trying to infer behavior.

Combine both: use text search to find where something is called, then use go-to-definition to jump to what it actually is.

Up next

How to understand module architecture from import statements

Sign in to track progress