Something I've noticed is that osx users believe bash to be less capable than it is because of the poor out of the box configuration of bash on that platform (in addition to the ancient version installed). Particularly the tab completion stuff. It doesn't pop up menus and all that, but the ubuntu install of bash has a ton of context-sensitive tab completion stuff in it, and the git package properly installs __git_ps1 and very good tab completion (which even the homebrew git recipe on osx doesn't manage to do).<p>This is not to say that zsh doesn't have a lot more features, just that the comparison from the perspective of an osx user tends to be a lot more stark.
While we're on the topic of non-bash shells, I recommend taking a look at Fish: <a href="http://fishshell.com/" rel="nofollow">http://fishshell.com/</a><p>I wrote a tutorial on how to install it on Mac OS X and Ubuntu: <a href="http://hackercodex.com/guide/install-fish-shell-mac-ubuntu/" rel="nofollow">http://hackercodex.com/guide/install-fish-shell-mac-ubuntu/</a> For me, the chief advantage to Fish is that you get more functionality out-of-the-box than with most other shells, including zsh.<p>I also published two related projects for easily sharing Fish shell enhancements — Tacklebox <a href="https://github.com/justinmayer/tacklebox" rel="nofollow">https://github.com/justinmayer/tacklebox</a> and Tackle <a href="https://github.com/justinmayer/tackle" rel="nofollow">https://github.com/justinmayer/tackle</a>) — because I wanted a way for folks to be able to have access to multiple plugin repositories and easily share their favorite shell snippets.
A killer feature not listed here is global aliases. These are aliases that can be anywhere in a line. The most use I get out of this is from having<p><pre><code> alias -g L=' | less '
</code></pre>
which allows me to simply append "L" to a line to pipe the output to less.<p><pre><code> ls L
</code></pre>
The pattern of short all-caps global aliases for ' | command 's make building/editing pipelines really easy/fast.<p><pre><code> alias -g C=' | wc -l '
alias -g A=' | ack-grep '
alias -g S=' | sort '
alias -g JQL=' | jq -C | less'
ls **/*png L
ls **/*png A -v regex C
curl $site JQL
</code></pre>
putting<p>bindkey '^g' _expand_alias<p>in your zshrc allows you to expand aliases with <C-g><p>You can find more global aliases and tips at:
<a href="http://grml.org/zsh/zsh-lovers.html" rel="nofollow">http://grml.org/zsh/zsh-lovers.html</a>
One of my favorites instead of aliasing ".."'s is this function:<p><pre><code> rationalise-dot() {
if [[ $LBUFFER = *.. ]]; then
LBUFFER+=/..
else
LBUFFER+=.
fi
}
zle -N rationalise-dot
bindkey . rationalise-dot
</code></pre>
When you hit ... it will produce a slash and a ../ for each . you type after that.
The tab completion isn't limited to the beginning of file names either. Useful when many of your file names start with the same pattern but then diverge.<p><pre><code> ls something<TAB>
</code></pre>
will complete to<p><pre><code> ls prefixSomething.sh
</code></pre>
if it's unique enough. This is probably my single favorite zsh feature.
One feature not listed there that use a lot is "setopt autocd". Just type in a directory name and hit Enter and it will automatically "cd" to it. No need to alias ".." to "cd ..".
I love that if you have vi key bindings active you can update the prompt when you change modes. I never used vi bindings in bash because I would become confused when I entered normal mode without realizing it. In zsh it was easy to configure my prompt to change colors and symbols when outside insert mode.<p><a href="https://github.com/everett1992/dotfiles/blob/master/home/.zshrc#L91-L112" rel="nofollow">https://github.com/everett1992/dotfiles/blob/master/home/.zs...</a><p>I have noticed that zsh's globbing is greedy.<p><pre><code> `grep ^foo *` tries to expand ^foo when bash would pass it as a string to grep.</code></pre>
It seems to me that the only two features I can't get in my modern bash is completion of the kind cd /firstletters/firstletters/<tab> ==> /fullname/fullname and the keyboard navigable menus.
bash only needs better history manipulation. absolutely nothing else.<p>all those z shell features the only useful one (i.e. the only one that's impossible on bash) is the <i></i>recursion (i typed star star, but hn hides it) hack.<p>and it's awful. because now you just learned something that you can't use anywhere else! and to search that same way in a shell script? though luck.<p>also it has less parameter then find. and find is available everywhere so you can use it in scripts.
Any favorite command I reference is likely to be listed here: <a href="http://www.zzapper.co.uk/zshtips.html" rel="nofollow">http://www.zzapper.co.uk/zshtips.html</a>
(Shameless self-promotion) I'd like to recommend a small and unobtrusive config for ZSH: <a href="https://github.com/changs/slimzsh" rel="nofollow">https://github.com/changs/slimzsh</a>
It is almost a default ZSH, but with small tweaks here and there to make it even nicer. I hope that you find it useful :)
Clever history doesn't really work for me when I use `sudo`<p>say I type<p><pre><code> $ sudo pacman -Syu
$ sudo chown blah blah
$ sudo pa <UP>
</code></pre>
I just get `sudo chown blah blah` instead of `sudo pacman -Syu`<p>Does anybody know how to fix this? :)
The up arrow to go back in history matching the partial command I typed is has become essential to me.<p>I feel lost without it, more than the tab completion.