|$ curl https://forge-ai.dev/api/markdown?path=docs/os/shells
$cat docs/shells.md
updated Recently·18 min read·published
Shells
Introduction
A shell is a command interpreter. A terminal is the application that displays the shell. You type commands in a way humans understand; the shell translates those commands into instructions for the computer.
Shell vs Terminal
| Component | Role | Examples |
|---|---|---|
| Terminal | GUI/TTY that renders text | Windows Terminal, iTerm2, GNOME Terminal |
| Shell | Command interpreter | Bash, Zsh, Fish, PowerShell |
| Kernel | Executes system calls | Linux, Windows NT, Darwin |
Common Shells
Bash is the default on most Linux systems and is the safest choice for scripts. Zsh is the default on macOS and offers better completion and plugin ecosystems like Oh My Zsh. Fish has excellent defaults and syntax highlighting but is not POSIX-compatible.
shells.sh
Bash
| 1 | # Check your shell |
| 2 | echo $SHELL |
| 3 | |
| 4 | # List available shells |
| 5 | cat /etc/shells |
| 6 | |
| 7 | # Change default shell |
| 8 | chsh -s /bin/zsh |
Customization
prompt.sh
Bash
| 1 | # ~/.bashrc or ~/.zshrc |
| 2 | export PS1="\u@\h:\W\$ " |
| 3 | |
| 4 | # Add aliases |
| 5 | alias ll="ls -la" |
| 6 | alias gs="git status" |
| 7 | |
| 8 | # Add to PATH |
| 9 | export PATH="$HOME/.local/bin:$PATH" |
ℹ
info
Use a plugin manager like Oh My Zsh or Starship to get a polished prompt with git status, timings, and language versions with minimal configuration.
Scripts
For portable scripts, target Bash and use #!/usr/bin/env bash. For cross-platform tools, consider Python or Node.js instead.