Hacker Read top | best | new | newcomments | leaders | about | bookmarklet login

Even if the answer is "none", zsh will need to additionally defend "what is the advantage of zsh for someone who already knows how to use bash", as any form of switch is going to come with a cost. I would therefore be really interested in your reasons (I use bash, as currently do all of the people I know and work with; [edit: apparently except one]).

It seems like most of the features listed as better than bash are either a) covered by bash 4.0, b) bad ideas (shared history among sessions), or c) only controversially better (searching around, people seem to argue back/forth about which programmable completion implementation is faster/better).



sort by: page size:

For the uninitiated: why is zsh better than bash?

zsh has better completion, command line editing capabilities, and language features. It's not even close. I can port my bash configuration to zsh in mere minutes, but it's impossible to port my zsh configuration to bash. The reason is simple. Bash just lacks so many features.

> For example, it is common to see command line tool come with bash completion files, less so with zsh.

It's rare for bash to complete anything but filenames. zsh gives me subcommands and flags with descriptions.

> Also, while bash got better support where it matters, zsh mostly got bloat in the form of oh-my-zsh and the likes.

zsh is a well-maintained project. It makes no sense to ignore that and instead fault them for oh-my-zsh's shortcomings, as if it has anything to do with upstream zsh. zsh doesn't rely on oh-my-zsh for any of its features.


Why zsh over bash? Just curious.

I preferred Zsh for a long time because it was much nicer to program in than Bash. But Bash has since then picked up all of the Zsh features I cared about and is installed by default most of the time so I switched.

What is the advantage of using zsh versus the omnipresent bash ? I mean there is something that can be done only in zsh and not in bash; or something that is straightforward to do in zsh and cumbersome in bash ?

Of course I can learn zsh to increase my knowledge, but it will be nice to see some clear advantage of using zsh.


I have been using bash for decades, not only on Linux, but also on other UNIX-derived operating systems.

Less than a year ago, I have tried zsh, without a definite intention to switch to it, but eventually I ended always using zsh for interactive use, while continuing to use bash for scripts.

I have benchmarked some scripts with both zsh and bash, but I have not seen any significant difference in speed.

While there are a few scripting features originally introduced by zsh (most of the brace expansion variants), bash has also incorporated them many years ago. Besides those, both bash and zsh implement the ksh93 features, so there is little reason to prefer one or the other. Therefore I have stuck to bash for scripts.

It is hard to say exactly why now I prefer zsh for interactive use, because there is no killer feature, but mostly various small details.

For some reason, zsh seems more responsive, when interactive. I rely a lot on autocompletion and the default autocompletion rules in zsh are more powerful and also the zsh autocompletion seems faster.

While in most cases I prefer the way zsh handles autocompletion, there are times when zsh annoys me by trying to be too smart, e.g. it will never autocomplete "mkdir" with the name of an existing file. I need that frequently, when I want to create a subdirectory in which to move a bunch of related files, with very long names that I do not want to type, but I want to edit slightly to make a name for the new subdirectory, so I have to use a workaround like autocompleting a "ls", then editing it into a "mkdir", while that was not needed in bash.

In zsh I use a much more complex shell prompt that I had used in bash, which displays a lot of useful information in a format that avoids confusion with the command lines or with the text output of the executed commands.

After switching to it in zsh, I have discovered that such a complex shell prompt is also possible in bash. Nevertheless, after using it in bash I have discovered some bash bugs. The too complex shell prompt confused bash and the text cursor became desynchronized with the correct position in certain contexts, so I had to revert in bash to a simple shell prompt.

I think that you should give zsh a try for interactive use. After using it for some days you will see if you prefer it to bash or not.

Now I prefer the interactive zsh, but there are no large differences, bash and zsh are similar and mostly equivalent, because whenever one was improved somehow, the other also copied that feature soon.

I had completely forgotten, but when I have tried for the first time to use zsh as a bash user, I have spent some ten minutes of great confusion, until discovering that I have to add to my ".zshrc" the lines:

bindkey '^[[H' beginning-of-line

bindkey '^[[F' end-of-line

bindkey '^[[3~' delete-char-or-list

in order to have the line editing keys with which I was accustomed.


I like bash completion much more than zsh. I tend to write all my scripts to be POSIX compliant anyhow, so zsh vs bash isn't really a thing for me. However, I can see how easy it would be as a Mac user to bash bash, because often people just feel the need for validation.

> It is worth, as a long time Bash user, to change to ZSH?

It doesn't make a lot of a difference. For me the major selling point of zsh is that it has two forms of process subsitution: regular <(...) as in bash, based on sockets, and =(...), which creates temporary files. This allows you to do some neat things that are not possible or comfortable in bash.


I tried to give zsh a shot as a bash replacement but ultimately returned to bash.

My main pain point was that zsh was really difficult to configure out of the box and a lot of the completions were much slower (cpu/wall time) than the equivalent completion in bash.

I'm sure some of that was simply ignorance on my part.


I tend to agree with this perspective, but I've found zsh is still superior, even if you use it just like bash. You could symlink .bashrc to .zshrc, and still enjoy zsh.

(For me, the thing that finally drove me to zsh was bash's unruly handling of prompt wrapping)


Sort of as others said, the nice thing about switching to zsh is that you get a lot of benefit _just_ by switching, and it is very similar in basic functioning to bash. It isn't like vim or emacs where you can't do basic tasks until you learn a bunch of specific keys.

I'm really glad I switched from bash to zsh a few years ago. zsh is, IMHO, a tiny bit better than bash in many areas. Because I use it all day every day, these little bits better add up to a lot of benefit.

One thing I love about zsh that I think bash doesn't have is shared history between terminals. Nothing groundbreaking but it's great if you have multiple terminals enabled.

Also, autocompletion in zsh is vastly superior, especially with options to commands.


Personally I found zsh worth switching to even without spending any meaningful amount of time learning to use it. The better tab completion alone is enough to make up for the setup time and the occasional bashisms I try that don't work.

Just using zsh as a drop-in replacement for bash is pointless. You'd need to discover its features and customize it to get added value.

As a simple example, in bash if you use tab completion and there are multiple options, pressing tab again just reminds you that there are multiple options accompanied by a passive aggressive beep (it used to be this way at least). zsh lets you cycle through the possible completions.


Seconded. I stuck to bash for a long time, and I regret not changing to zsh much earlier. It's like bash in all the ways bash is good, but with extra excellence thrown in to the bargain.

I love zsh’s variable & filename expansion features! But I switched to bash after using zsh for a long time because zsh is less standard, not installed by default, can be a bit of a pain when doing lots of ssh work or on machines I don’t control. Bash is always there.

Zsh is also really heavy, or it was last time I checked. Larger binary & slower startup time than bash, and lots of features I don’t use. Modules, calendar, tcp, ftp client ... that’s a lot of stuff in the shell that is arguably better put into separate executables.


Zsh has had more features than bash for decades. If anything, bash has caught up recently.

It's just Apple using zsh as a default shell. People tend to use defaults and a lot more people are exposed to zsh now.


Any advantages over someone who's used to zsh?
next

Legal | privacy