Searching Navigation
Searching & Navigation — Quick Reference
Section titled “Searching & Navigation — Quick Reference”locate — Fast Filename Search
Section titled “locate — Fast Filename Search”Uses a pre-built database — much faster than find for filename lookups.
locate nginx.conf # find files named nginx.conflocate -i readme # case-insensitivelocate "*.log" # by patternlocate -n 10 config # limit to 10 results
# Update the database (needed after new files are created)sudo updatedbCaveat: results can be stale — use find when you need guaranteed freshness.
fd — Modern find Alternative
Section titled “fd — Modern find Alternative”Faster, simpler syntax, ignores .git and node_modules by default.
fd # list all files recursivelyfd .ts # files with .ts extensionfd config # files named "config" (fuzzy)fd -e yaml # by extensionfd -t d src # directories named "src"fd -H .env # include hidden filesfd --exclude node_modules # exclude a directoryfd ".*\.test\.ts" src/ # regex pattern in src/ripgrep (rg) — Modern grep Alternative
Section titled “ripgrep (rg) — Modern grep Alternative”Much faster than grep, respects .gitignore, skips binaries automatically.
rg "TODO" # search current dir recursivelyrg -i "error" # case-insensitiverg "useState" src/ # search in a specific directoryrg -t ts "useEffect" # only TypeScript filesrg -l "import React" # filenames onlyrg -n "port" # with line numbersrg --no-ignore "secret" # don't respect .gitignorerg -C 3 "panic" # 3 lines of contextrg -e "foo" -e "bar" # multiple patterns (OR)rg --hidden "config" # include hidden filesDirectory Navigation
Section titled “Directory Navigation”cd - # go back to previous directorycd ~ # go to home directorypushd /some/dir # push dir onto stack and cd to itpopd # pop and return to previous dirdirs # list directory stackTree — Visual Directory Structure
Section titled “Tree — Visual Directory Structure”tree # show full treetree -L 2 # limit to 2 levels deeptree -a # include hidden filestree -d # directories onlytree --gitignore # respect .gitignoretree -I "node_modules|dist" # exclude patternsfzf — Fuzzy Finder (Interactive)
Section titled “fzf — Fuzzy Finder (Interactive)”Fuzzy search for anything piped into it.
# Interactive file searchfind . -type f | fzf
# Search and open in vimvim $(fzf)
# Search command history interactively (replaces Ctrl+R)history | fzf
# Preview file contents while searchingfzf --preview 'cat {}'
# Search git branchesgit branch | fzf- Use
rginstead ofgrep -r— it’s faster and smarter about what to skip. - Use
fdinstead offindfor simple filename lookups — less syntax to remember. locateis instant for “where is this config file?” but runsudo updatedbif files are missing.fzftransforms any list-based workflow — pipe anything into it for interactive filtering.