NOTE: This Page Is A Work In Progress
While reading through the rbenv-init
file, we saw that the file’s logic branches via a case statement depending on which shell the user is running (i.e. Bash, zsh
, fish
, and sometimes ksh
). That made me wonder, what is the difference between each of these shells, and why would a user pick one over the others?
To be honest, my biggest take-away from researching the different shells is that, as a non-power user, the best shell for me is the default of zsh
on my Macbook. It’s interesting to get a bit of added context on the alternatives, but for now I think I’ll stick with what I’ve got.
The following are some resources I encountered during my research which (frankly) are more in-depth than what I’ve written below:
- “Which Shell Is Right for You? Shell Comparison”, from Carnegie Mellon University
- “Which Linux Shell Is Best? 5 Common Shells Compared”, from MakeUseOf.com.
With that said, here are my take-aways from the research I did:
Bash
- Bash is a shell but also a lanuage.
- Most users use Bash, since it’s the default for most Linux systems.
- Bash does not have inline wildcard expression, the way
zsh
does.- For example, if you type
cat *.txt
and hit thetab
key,zsh
will expand the*
character to list all thetxt
files, socat *.txt
becomescat foo.txt bar.txt buzz.txt
. - The Bash shell does not offer this ability. -
- For example, if you type
zsh
zsh
is the default shell for macOS (used to be Bash but it switched with Catalina in 2019).- Comes with tab-based auto-completion.
- Much more configurable than Bash. There are plugins, and even entire frameworks such as oh-my-zsh, which a lot of
zsh
users love.
fish
- Does not comply with POSIX standards.
- Includes “search as you type” automatic suggestions.
- Comes with a lot of configurations and features (such as syntax and even error highlighting) already set and always-on by default.
- Basically takes a “convention over configuration” approach, so some people consider it more beginner-friendly. source
ksh
- Better for-loop syntax than Bash.
- “Tough to find help for
ksh
online.”
Additional Reading:
- “Comparison of command shells”, from Wikipedia.