Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have been a zsh user for quite some time (before that tcsh and before that csh). I am quite happy with it, but was wondering if there are any compelling features of bash that do not exist in zsh. And conversely, are there zsh features which do not exist in bash. My current feel is that bash is better:

  • If you are familiar with it already and don't want to learn new syntax.
  • It is going to exist on most all *nix machines by default, whereas zsh may be an extra install.

Not trying to start a religious battle here, which is why I'm just looking for features which exist in only one of the shells.

share|improve this question
How are features that are unique to one or the other subjective? I'm honestly not looking for a flamewar and conceed that familiarity of one or the other is likely a good reason to prefer that shell. –  Tim May 5 '09 at 22:12

10 Answers 10

up vote 31 down vote accepted

zsh is for vulcans. ;-)

Seriously: bash 4.0 has some features previously only found in zsh, like ** globbing:

% ls /usr/src/**/Makefile

is equivalent to:

% find /usr/src -name "Makefile"

but obviously more powerful.

In my experience bash's programmable completion performs a bit better than zsh's, at least for some cases (completing debian packages for aptitude for example).

bash has Alt + . to insert !$

zsh has expansion of all variables, so you can use e.g.

% rm !$<Tab>

for this. zsh can also expand a command in backtics, so

% cat `echo blubb | sed 's/u/a/'`<Tab>


% cat blabb

I find it very useful to expand rm *, as you can see what would be removed and can maybe remove one or two files from the commmand to prevent them from being deleted.

Also nice: using the output from commands for other commands that do not read from stdin but expect a filename:

% diff <(sort foo) <(sort bar)

From what I read bash-completion also supports completing remote filenames over ssh if you use ssh-agent, which used to be a good reason to switch to zsh.

Aliases in zsh can be defined to work on the whole line instead of just at the beginning:

% alias -g ...="../.."
% cd ...
share|improve this answer
In bash, C-M-e to "shell-expand-line", which would expand cat `echo blubb | sed 's/u/a/'` to cat blabb and echo $SHELL to echo /bin/bash in my case. Also, C-x * to "glob-expand-word", which would expand rm *. –  Victor Aug 13 '11 at 21:31

I would like to point out that bash is not installed by default on FreeBSD, OpenBSD, or NetBSD, and it is also not installed by default on Solaris 10 (OpenSolaris has it as the default), last time I used an AIX, and or HP-UX servers it was not installed by default either.

Also, on OpenSolaris /bin/sh is NOT bash. It is ksh. The biggest issues I have as a software porter is people that assume /bin/sh is bash and that it will accept bash extended syntax. While this seems to be the case on most Linux distributions it is not the case elsewhere and it is really annoying.

share|improve this answer
Yes you are right. Alas, all these vendors sure make it very very easy to install bash as an extra package. +1 for pointing out the need for /bin/sh purism in scripts. –  kubanczyk Aug 22 '09 at 11:04
@kubanczyk: If you're working on machines you don't have root access to, then it may not be so easy to install, so I think X-Istence's point stands. (I work on a bunch of Solaris boxes, and the sysadmins are all ksh junkies. Last time I tried to compile my own software that I couldn't live without (git in this case) there were deficiencies with the installed compiler, so even that route was cut off to me.) –  iconoclast Jul 14 '11 at 18:08

Although I am a bash user, I find one of zsh's features pretty cool: RPS1.


  • PS1: the left aligned prompt
  • RPS1: the right aligned prompt


When using something like

PS1=’%B(%h) %m%#%b ‘

You get your prompt on the left and the current directory pushed onto the right. It even disappears when the current line is getting too long ! It's because zsh is smart enough to give low priority to RPS1.

You can see a screenshot of this example at http://imgur.com/OAZhC.

share|improve this answer

Zsh has spelling correction. If you're a letter (or more) off, it will figure out what you meant.

It also has more robust tab completion, which I like.

Zsh has an interactive config utility to get it set how you like.

Some speed tests say zsh is faster, but I haven't noticed any difference.

share|improve this answer
A stripped down version of dash which supports only a subset of its features, and designed to be used in scripts which should run fast (startup ones, for example) is dash. –  Michel Nolard Mar 20 '13 at 13:44

I don't know of any bash features that zsh does not support. The design goal of zsh seems to include supporting any features that bash adds.

I still use bash instead of zsh. I rarely come across compelling features that zsh supports that bash does not. Occasional problems with zsh over the years, or it not existing on certain sysetms, have made it not worth making the transition.

I can finally use the same shell on every Unix system, it's not worth breaking this for features I'll never use.

The features present in zsh that are not present in bash seem to mostly be cute but not ones that would matter on a day-to-day basis.

share|improve this answer

bash has many features that used to only be in zsh. You can have 'smart tab completion' with bash aswell now, as any recent ubuntu user has discovered.

share|improve this answer

I'm a fan of zsh because of the vi mode support, but I am discovering that it's not very widely used. I think I read that zsh likes to take popular features from the other shells and combine them (so things specific to bash and thing specific to csh are both available in zsh).

Someone also said that I'm flexing my geek factor by using zsh, but I can't confirm or deny that rumor.

share|improve this answer
and yes, bash also has vi-mode support. –  pjz May 5 '09 at 21:15
@Milner: can you explain what sort of vi mode support is in zsh that is not in bash? If you simply mean the ability to do set -o vi on the command line, then that is clearly in both. If there is some extended support in zsh, could you describe clearly what it is and what it adds? –  iconoclast Jul 14 '11 at 18:28

Process substitution and extended globbing are the two features I would miss the most. The prompt settings are pretty cool too - seeing the level of nesting when you are typing complex statements on the command lines. Autoloading makes including lots of functions in every shell feasable.

share|improve this answer
I assume you mean you would miss those from zsh, since AFAIK everything you mentioned is included in zsh? (But are you sure they're all absent from bash? That would surprise me.) At any rate, adding that would make your answer clearer, since there are people answering on both sides of the bash/zsh fence. Also, it would be helpful if you'd give examples of how each of those features make your shell life easier. –  iconoclast Jul 14 '11 at 18:24

Popularity, #bash 430 users. #zsh 123 users. I believe the zsh website has a good comparison of zsh with other shells. zsh has better vi mode support.

share|improve this answer
How is the vi-mode in zsh better? I'm a bash user and I have vi-mode on, so I'd like to know if there's any benefit in switching. –  ptman May 16 '10 at 12:54
@ptman: zsh's prompt can be made to tell the mode (insert/normal). Readline can't do that. The prompter is more flexible as well: you can have syntax highlighting etc! –  progo Mar 17 '11 at 17:00
@progo: ahh! very nice. Now I just might start using vi mode in zsh. That's been one of my reasons for sticking with emacs mode so far. –  iconoclast Jul 14 '11 at 18:30
@Brandon that little enhancement was the reason for me to switch shells. –  progo Jul 14 '11 at 21:30

Bash is using the same syntax for if and while as that can be used in /bin/sh scripts on the command line.
Within zsh the syntax is different. Effectively using zsh you have to remember both, if you are using an if- or while-statement on your command line

share|improve this answer
I tried this, using if [[ $test = "test" ]]; then echo "success"; else echo "failure"; fi on both the command line and a script, and it worked as expected in both cases. So it would seem that you don't have your facts straight. –  iconoclast Jul 14 '11 at 18:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.