Loading...
Loading...
Commands, concepts, and cheat sheets - everything you need for the terminal
When you type a command and press Enter, the shell follows a specific lookup order to find and run it. Understanding this model explains why aliases override builtins and why $PATH order matters:
User types: ls -la
│
▼
┌─ Shell checks ─────────────────────┐
│ 1. Is it an alias? → expand │
│ 2. Is it a function? → execute │
│ 3. Is it a builtin? → execute │
│ (cd, echo, export, source...) │
│ 4. Search $PATH dirs → fork+exec│
│ /usr/local/bin │
│ /usr/bin │
│ /bin │
└────────────────────────────────────┘
│
▼
fork() → child process → exec(ls)
│
parent waits → child exits → prompt returns