- Command categories and types
- How to identify built-in commands
- Performance benefits and benchmarks
- Verifying process creation with
strace - Listing all built-in commands and keywords

The Chef Analogy
Think of your shell as a chef in a kitchen. If the chef delegated every simple task—chopping vegetables, stirring soup, plating food—to sous-chefs, the overhead would be enormous. Instead, the chef handles routine tasks directly and only calls for help on specialized jobs. Built-in commands work the same way: the shell “chef” handles them instantly, while external binaries require spawning a separate “assistant” process.Command Categories and Types
Shell commands fall into two main categories:
Example:
ls is an external binary loaded from disk; echo is handled directly by the shell.
Identifying Built-ins vs. External Binaries
Use thetype built-in to check how a command is implemented:
You can also use
which or command -v, but type gives the most accurate distinction between built-in, keyword, and function.Performance Benefits of Built-ins
Benchmarks: true vs /usr/bin/true
The true command simply returns a zero exit status. Compare its built-in version to the external binary:
Command Execution Times at a Glance
Built-ins not only start faster but also complete quicker, especially when called repeatedly in loops.
Verifying Process Creation with strace
To confirm built-ins don’t fork, trace execve system calls in your current shell:
- Find your shell’s PID
- Attach
straceand filter forexecve - In another terminal, run a built-in vs an external binary
execve only for cat, confirming echo runs inside the shell.
External vs. Built-in Counterparts
Many built-ins have binary counterparts on disk:echo completes instantly compared to the external /usr/bin/echo.
Listing Built-ins and Keywords
- List built-in commands:
- List shell keywords:
- Check if a word is a keyword:
Keywords (like
time, if, for) are parsed by the shell and do not spawn new processes. Confusing them with external binaries can lead to unexpected behavior.