Cheat Sheet
The commands you keep forgetting, with a one-line description and a real example you can copy - 629 across 38 tools. Pick a tool in the sidebar, or search across all of them.
grep & find
Search inside files with grep, locate files with find - the daily pair.| Command | What it does | Example |
|---|---|---|
grep -r | Search all files under a folder, recursively. | grep -r "TODO" src/ |
grep -ri | Recursive and case-insensitive. | grep -ri "timeout" . |
grep -rn | Show file and line number for each match. | grep -rn "api_key" config/ |
grep -rl | List only the file names that match. | grep -rl "deprecated" src/ |
grep -v | Invert: show lines that do NOT match. | grep -v "DEBUG" app.log |
grep -c | Count matching lines per file. | grep -c "ERROR" app.log |
grep -E | Extended regex: +, ?, | without backslashes. | grep -E "error|warn" app.log |
grep -w | Match whole words only. | grep -rw "cat" notes/ |
grep -A / -B / -C | Show lines After, Before, or around a match. | grep -C 3 "panic" app.log |
grep --include | Restrict the recursive search by filename pattern. | grep -rn "useState" --include="*.tsx" src/ |
grep in a pipe | Filter the output of any command. | ps aux | grep node |
rg (ripgrep) | Faster modern grep - recursive by default, respects .gitignore. | rg "TODO" -t js |
find by name | Locate files by glob (quote the pattern). | find . -name "*.test.js" |
find -iname | Same, case-insensitive. | find . -iname "readme*" |
find -type | Only files (f) or only directories (d). | find . -type d -name "node_modules" |
find -mtime | By modification age in days (-1 = last 24h). | find /var/log -mtime -1 |
find -size | By file size (+100M = larger than 100 MB). | find . -size +100M |
find -exec | Run a command on every result ({} is the file). | find . -name "*.log" -exec gzip {} \; |
find -delete | Delete what matches - run WITHOUT -delete first to preview. | find . -name "*.tmp" -delete |
find + xargs | Feed results to another command in batches. | find . -name "*.py" | xargs grep -l "import requests" |
find -maxdepth | Limit how deep the search goes. | find . -maxdepth 2 -name "package.json" |