Comparison of Unix shells
Of the major Unix shells (bash, ksh, tcsh, zsh, others?), are there any compelling reasons to use one over another?
- Which is the most interactive/command-line friendly?
- Which is the most conducive/intuitive for writing scripts?
- Are there any major built-in features that one shell offers that others don't?
- Are any of these shells really good for one type of function, but not another? Or are they all pretty well-rounded/flexible?
- Is it just a matter of personal preference?
I can make this community wiki if anyone prefers.
Solution 1:
Current:
-
bash
— Bourne again shell, default shell in most Linux distributions. Decent features; -
zsh
— the most feature rich, but still rarely used; -
ksh
— default shell in Solaris, AIX and other few other unices; -
tcsh
— default shell in various *BSD flavor unices;
Historic:
-
sh
— original Bourne shell (released 1977). Obsoleted by bash; -
csh
— original C shell (released 1978). Obsoleted by tcsh and ksh;
Note, that bash, ksh and zsh derive from sh syntax, while tcsh derives from csh syntax. This are two quite different syntaxes.
The feature chart (wiki).
Solution 2:
fish is a new shell that is perhaps more interesting than the others, not because it necessarily has more features, but because they Just Work by default and because fish strives for usability.
A few screenshots (1, 2, 3, 4) are enough to give the general idea.
fish is now the default shell on my Mac at work. Go figure.
Solution 3:
If you're going to learn a shell other than sh
/bash
, you might as well just go with zsh
. I don't think anyone seriously contests that it's the most powerful and feature-packed of the alternative shells; whether it's just bloat is, of course, still up for debate.
I've heard good things about fish
, but never worked up the effort to bother with them.
The admins I know consider csh
and tcsh
to be abominations that should be avoided at all costs, and I agree with them despite never having been forced to put myself through either shell.