Title: Worth switching to zsh for casual use?
Tags: bash;shell;zsh
Question: The default shell in Mac OS X is bash, which I'm generally happy to be using. I just take it for granted. It would be really nice if it auto-completed more stuff, though, and I've heard good things about zsh in this regard. But I don't really have the inclination to spend hours fiddling with settings to improve my command line usage by a tiny amount, since my life on the command line isn't that bad.
(As I understand it, bash can also be configured to auto-complete more cleverly. It's the configuring I'm not all that keen on.)
Will switching to zsh, even in a small number cases, make my life easier? Or is it only a better shell if you put in the time to learn why it's better? (Examples would be nice, too :) )
@Rodney Amato
@Vulcan Eager
give two good reasons to respectively stick to bash and switch to zsh. Looks like I'll have to investigate both! Oh well :)
Is there anyone with an opinion from both sides of the argument?
Comment: If you have a bit of bash customization and you often use the shell inside of emacs, this does not seem trivial. I posted related question: http://stackoverflow.com/questions/13326879/any-tips-on-switching-from-bash-to-zsh-if-often-using-shell-inside-of-emacs

Comment: Since zsh is (almost) a superset of bash, you can start with moving to zsh and using it like bash. Then you can learn the zsh gems a little bit at a time.

Comment: The *only* thing I dislike about zsh is that (at least on Ubuntu) you'll have to configure it yourself the first time you start it (instead of it providing some sane defaults that you can later on tinker with). If you can get over that, zsh is the best!

Here is the accepted answer: For casual use you are probably better off sticking with bash and just installing bash completion.
Installing it is pretty easy, grab the bash-completion-20060301.tar.gz from http://www.caliban.org/bash/index.shtml#completion and extract it with
tar -xzvf bash-completion-20060301.tar.gz
then copy the bash_completion/bash_completion file to /etc with
sudo cp bash_completion/bash_completion /etc
which will prompt you for your password. You probably will want to make a /etc/bash_completion.d directory for any additional completion scripts (for instance I have the git completion script in there).
Once this is done the last step is to make sure the .bash_profile file in your home directory has
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
in it to load the completion file when you login.
To test it just open a new terminal, and try completing on cvs and it should show you the cvs options in the list of completions.
Comment for this answer: Bash-Completion2 is better!  On OS X: `brew tap homebrew/versions; brew install bash-completion2`
Comment for this answer: If you are using homebrew on OSX you can run `brew install bash-completion`.
Comment for this answer: I tried the above, however afterwards whenever I start bash I get 4 "unary operator expected" and 4 "too many arguments" errors.

Here is another answer: Switch to zsh. You will have access to:
zmv: You can do: zmv '(*).mp3' '$1.wma' for thousands of files.
zcalc: Extremely comfortable calculator, better than bc.
zparseopts: One-liner for parsing arbitrary complex options given to your script.
autopushd: You can always do popd after cd to change back to your previous directory.
Floating point support. It is needed from time to time.
Hashes support. Sometimes they are just a key feature.
Comment for this answer: I installed zsh (via apt-get) so I could try out zcalc, but it was not included.
Comment for this answer: @minhaz1 no it's not the same.
with pushd, popd you can navigate to other directories buried in your history, not only the latest one as is the case for "cd -"
Comment for this answer: `zmv` and `zcalc` are not available out of the box. It's not clear that `zmv` is just renaming files; I thought you might have been converting the format. I don't know what "hashes" support even means. This post seems like it's only "useful" to people that already know zsh.
Comment for this answer: @Mark In this case, "hash" is synonymous with "associative array". `bash` 4 was released just a few months prior to this answer.
Comment for this answer: The example for zmv should be zmv '(*).mp3' '$1.wma'. Please correct it, such careless presentation can be confusing and frustrating to the inexperienced.
Comment for this answer: "autopushd: You can always do popd after cd to change back to your previous directory."
Isn't the equivalent of that just cd - ?
Comment for this answer: @TravisBear `autoload zcalc; zcalc` (although I myself just type `python` whenever I need a calculator).

Here is another answer: Staale is talking about a wizard like program (CUI) which autoruns the first time you run zsh. Just answer some questions, view/change the defaults and its configured for you.
IBM developerWorks has great resources on zsh.
I have not used very advanced features and so far I have not come across serious differences which should hamper someone coming from bash.
Some examples:
!?pattern<Tab&gt; will autocomplete to
the last command in history matching
pattern. Very useful.
You can configure a prompt on the
RHS. One use is to keep a fixed
width prompt on the left hand side
so all commands line up nicely while
displaying the pwd (or anything of
variable width) as the right hand
side prompt.
You can redirect input from multiple files (yet to try this): cat < file1 < file2 < file3

Here is another answer: Personally, I love zsh.
Generally, you probably won't notice the difference between it and bash, until you want to quickly do things like recursive globbing:
**/*.c for example.
Or use suffix aliases to associate specific progs with different suffixes, so that you can "execute" them directly. The below alias lets you "run" a C source file at the prompt by simply typing ./my_program.c – which will work exactly as if you typed vim ./my_program.c. (Sort of the equivalent to double clicking on the icon of a file.)
alias -s c=vim
Or print the names of files modified today:
print *(e:age today now:)
You can probably do all of these things in bash, but my experience with zsh is that if there's something I want to do, I can probably find it in zsh-lovers.
I also find the book 'From Bash to Z-Shell' really useful.
Playing with the mind bogglingly large number of options is good fun too!
Comment for this answer: With `glob_star_short` in `zsh`, you can now do `**.c`, which is interpreted as `**/*.c`.
Comment for this answer: The first two examples here don't mean anything to me (a casual bash user considering switching to zsh) - could you elaborate on what "recursive globbing" means, or what you mean by "associate specific progs with different suffixes"?
Comment for this answer: I use `zsh 5.3` and get `command not found: age` with `print *(e:age today now:)`
Comment for this answer: @aaronsnoswell: "Recursive globbing" means searching a subdirectory *and all of its subdirectories* for files whose names match a particular pattern.  Bash doesn't do that by default; you'd `find` or `locate` to search recursively.  But once you're letting another program do the searching, you lose the boundaries between names (unless you're careful) as well as access to the shell's internal globbing abilities, and basically have to either make do with what the other program provides, or pipe its output through a program like `grep`, `awk`, or `sed` (all fairly complex in their own right).
Comment for this answer: These days, you can set the `globstar` option in bash to allow for recursive searching as mentioned above.  Pretty sure that wasn't the case when this answer was written, though.

Here is another answer: zsh has a console gui configuration thing. You can set it up pretty quickly and easily without having to fiddle with configuration files. I don't think you will need much time to set it up, probably 10 seconds with just using defaults, so go ahead and try it out.
Comment for this answer: It's usually the first thing you see when you load `zsh` without any related dotfiles. To get it manually, try `autoload -U +X zsh-newuser-install; zsh-newuser-install -f`
Comment for this answer: How do you access this "console gui"?

Here is another answer: If all you want to use ZSH for is better completion, the configuration is pretty easy. Place this in your ~/.zshrc:
autoload -U zutil      # [1]
autoload -U compinit   # [2]
autoload -U complist   # [3]
compinit
However, it's worth checking out all the other great features of the ZSH. The above example will give you a pretty plain prompt with good completion. If you don't want to fiddle with configurations, but want to see what ZSH can do for you, Google for "zshrc" and you will get some ready to use configurations to get started.
[1]: http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#The-zsh_002fzutil-Module
[2]: http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Initialization
[3]: http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#The-zsh_002fcomplist-Module
Comment for this answer: What kinds of things will this add completion for? I don't like randomly adding stuff without knowing what it's doing.

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 6, 'CommentCount': 3, 'ContentLicense': 'CC BY-SA 2.5', 'CreationDate': '2008:00:09/04/08', 'FavoriteCount': 72.0, 'PostTypeId': 1, 'Tags': '<bash><shell><zsh>', 'Title': 'Worth switching to zsh for casual use?', 'ViewCount': 71571, 'id': 43321, 'user_AboutMe': '<p>Engineering academic. PhD in magnetic levitation. Sometime LaTeX hacker, member of the LaTeX Project Team. Knows a bit about Matlab, Mathematica, Mac OS X, a little shell scripting, and, of course, TeX &amp; LaTeX.</p>\n', 'user_AccountId': 2930.0, 'user_DisplayName': 'Will Robertson', 'user_Reputation': 60160.0, 'user_Views': 4036.0, 'user_id': 4161.0}}