Table of Contents
Why There Are Different Shells
Linux offers multiple interactive shells. In this chapter you’ll compare three popular ones:
bash— the default on most distributionszsh— a powerful, highly customizable shellfish— user‑friendly with many features built in
You’ll focus on how they differ in daily use, and how to choose one.
Quick Overview
| Feature / Aspect | Bash | Zsh | Fish |
|---|---|---|---|
| Typical status | Default on many distros | Often chosen by power users | Focused on ease of use |
| Config file | ~/.bashrc, ~/.bash_profile | ~/.zshrc | ~/.config/fish/config.fish |
| Scripting standard | De‑facto standard | Very compatible with Bash scripts | Not POSIX/Bash compatible by default |
| Completion | Good, extendable | Very powerful, with plugins | Excellent, smart and colorful out‑of‑the‑box |
| Suggestions | Optional via add‑ons | Optional via add‑ons | Built‑in autosuggestions |
| Plugins/themes | Many, via frameworks (e.g. bash-it) | Huge, via Oh My Zsh, zinit, etc. | Some via plugins; not as extensive as Zsh |
| Learning curve | Moderate | Slightly steeper than Bash | Easiest interactive use, but non‑standard |
Bash
Bash (/bin/bash) is the “baseline” interactive shell you’ll encounter most often.
Strengths
- Default almost everywhere
Most beginner tutorials and examples assume Bash. - Scripting compatibility
- Most shell scripts you’ll find online are written for Bash or POSIX
sh. - If you plan to automate tasks on servers, Bash is the safest bet.
- Mature ecosystem
- Autocompletion, history search, and prompts are all customizable.
- Many guides, Stack Overflow answers, and books use Bash.
Typical Features You’ll Notice
- History search (reverse‑i‑search)
PressCtrl+R, then type part of a previous command to recall it. - Basic completion
PressTabto complete commands, paths, and sometimes options. - Prompt customization
Controlled by thePS1variable in config files, e.g.:
PS1="\u@\h:\w\$ "(Details of editing these belong in shell configuration chapters.)
When Bash Makes Sense
- You are new to the terminal and just want to follow tutorials.
- You work on servers where you cannot install extra software.
- You plan to write scripts that must run on any Linux system.
Zsh
Zsh (/bin/zsh) is a powerful shell that expands on Bash-style behavior, especially when combined with frameworks like Oh My Zsh, zinit, or Prezto.
Strengths
- Great for interactive use and customization
- Advanced completion for many commands (git, docker, etc.).
- Easy prompt theming with frameworks (e.g. powerlevel10k theme).
- Bash‑like, but more powerful
- Most Bash commands work as you expect.
- Additional features like improved globbing, spelling correction, etc.
- Large plugin ecosystem
- Simple plugin configuration gives features like:
- Git status indicators in the prompt
- Fast directory jumping
- Extra completions
Features You May Notice in Daily Use
- Spelling correction
Mistyped directory names (e.g.cd /usre/locla) can be automatically corrected or prompt you to correct them. - Advanced globbing
Powerful pattern matching (beyond basic*and?), for example: **/*.txtcan search subdirectories recursively (with the right options enabled).- Good completion with plugins
Once configured, Zsh can: - Show rich completion menus
- Complete git branch names, docker subcommands, etc.
Typical Setup Pattern
Many users:
- Install
zsh. - Install Oh My Zsh or another framework.
- Enable a theme and some plugins (e.g.
git,z,fzfintegration).
(Exact installation steps belong in other chapters, so they’re not detailed here.)
When Zsh Makes Sense
- You mainly use the shell interactively and want better comfort.
- You enjoy customizing your prompt and adding plugins.
- You want Bash‑like behavior but with more convenience.
Fish
Fish (“Friendly Interactive SHell”) focuses on being easy and pleasant to use out‑of‑the‑box.
Key Difference: Not a Bash/Posix Clone
Fish is intentionally not fully compatible with traditional shell syntax. That means:
- Bash scripts generally do not run in Fish without changes.
- You still typically use Bash (or
sh) as the scripting shell on systems, even if you use Fish as your interactive shell.
Strengths
- Great default experience (no heavy config needed)
- Syntax highlighting built in.
- Smart tab completion.
- Colorful, readable prompts.
- Autosuggestions based on history and files.
- User‑friendly configuration
- Web‑based configuration interface (
fish_config). - Human‑readable, consistent syntax (different from Bash, but often easier to read).
- Autosuggestions
- As you type, Fish shows a faint suggestion based on history; press
Right ArroworEndto accept it.
Features You’ll Notice Immediately
- Syntax highlighting
Commands, variables, and errors are shown in different colors automatically. - Autosuggestions and rich completion
- Start typing a previously used command and Fish suggests the rest.
- Tab completion shows descriptions and options in a menu.
- Simpler function and variable syntax
- No
$when setting variables, for example:
set name "Alice"
echo $name(Note: this is a major difference from Bash/Zsh.)
When Fish Makes Sense
- You are primarily a desktop user and want the shell to “just be nice” without many tweaks.
- You don’t plan to write many portable shell scripts.
- You are okay using Fish for interactive use and Bash for scripting.
Changing Your Login Shell
You can usually change the shell you get when you open a terminal.
- Check available shells:
cat /etc/shells- Temporarily run another shell (for testing):
zsh
fish
Type exit to return to your previous shell.
- Permanently change your login shell (if allowed):
chsh -s /usr/bin/zsh
chsh -s /usr/bin/fish
You must log out and back in for the change to take effect. Paths vary by distribution; use one of the paths listed in /etc/shells.
How to Choose as a Beginner
A practical approach:
- If you’re following beginner tutorials or learning scripting
- Start with Bash (the default on your system).
- After you’re comfortable:
- Try Zsh if you want more power and lots of customization.
- Try Fish if you want a very friendly, feature‑rich interactive shell and don’t mind using Bash for scripts.
You can switch between them at any time; they can all coexist on the same system.