Engineering Craft › Developer Tooling
Shell
The program interpreting your commands: bash, zsh, fish.
Also known as: bash, zsh, fish, command interpreter
The shell is the program that reads the commands you type, runs them and shows the results. The terminal is the window; the shell is what’s inside it (terminal).
Common shells:
| Shell | Notes |
|---|---|
| bash | the long-time default on Linux, and widely used in scripts |
| zsh | the default on macOS, with nice completion and customization |
| fish | friendly out of the box, with a different syntax |
| PowerShell | Windows-focused, passes objects rather than text |
| sh | the minimal, portable POSIX shell |
echo $SHELL # your login shell
What a shell does
- Runs programs, finding them through the PATH.
- Expands things before running:
*.txtbecomes a list of files,$HOMEbecomes your home directory,~becomes the path. - Connects commands with pipes and redirection.
- Holds variables and settings (environment variables).
- Offers history and completion: the up arrow,
Ctrl+R, and Tab. - Runs scripts: files of commands, with variables, conditions and loops (shell scripting).
- Provides built-in commands like
cdandexport, which can’t be separate programs.
Gotchas
- Spaces and quoting:
rm -rf $DIR/*with an empty or space-containing$DIRdoes something unexpected. Quote variables:"$DIR". - Syntax differs between shells. A bash script may not run in
shor fish. - Startup files (
.bashrc,.zshrc) set your environment, and differ for login and non-login shells. - Wildcards are expanded by the shell, not by the program.
Learning a few shell basics pays off for years: it’s how you drive servers, containers, CI and most developer tools (basic shell commands).