top | item 5465793

Zsh-lovers – tips, tricks and examples for the Z shell

120 points| q_revert | 13 years ago |grml.org | reply

23 comments

order
[+] phreeza|13 years ago|reply
This list is great (and old), but what I would really like is a more concise list of stuff zsh can do that bash can't, and that has been vetted by people who know bash well. (like one thing that comes to mind is recursive globbing with two astersisks, but to be honest I have no clue if maybe bash can do that too by now).

The reason why I want such a list is I usually point people to zsh-lovers list who ask me why I use zsh, but something more to the point would be great, and probably more convincing.

[+] tmhedberg|13 years ago|reply
> (like one thing that comes to mind is recursive globbing with two astersisks, but to be honest I have no clue if maybe bash can do that too by now)

It can, if you set the `globstar` option:

    $ shopt -s globstar
    $ echo **/*.txt
    a/a2/baz.txt a/bar.txt a/foo.txt b/bar.txt b/foo.txt
[+] gnosis|13 years ago|reply
This[1] talk is kind of old, and I'm sure bash now has some of the features only zsh had at the time, but it should give you a feel for how zsh differs from and improves on bash.

Another thing I suggest doing is joining #zsh on freenode, and asking your questions there.

Yet another thing you could do is skim through the zsh user's guide[2], which is also kind of old, but is pretty comprehensive (for the time), and will give you more of a feel for what zsh can do. zsh's man pages are also very comprehensive (and huge), and might be worth a peek.

[1] - http://ft.bewatermyfriend.org/comp/zshtalk.html

[2] - http://zsh.sourceforge.net/Guide/zshguide.html

[+] recuter|13 years ago|reply
Also it is worth nothing that Bash does get updates and newer versions get some features that zsh has. So if it made sense to switch in the past perhaps it no longer does. 'etc.

Sometimes I wish there wasn't so much duplication of effort in this world..

[+] pyre|13 years ago|reply
On Ubuntu at least, when you install virtualenvwrapper from apt, it drops the file you need to source into the bash completion directory[1], presumably so that it will be automatically loaded when bash launches. As a zsh user, this annoys the hell out of me. If they dropped it in $PATH, then you could just do:

  source virtualenvwrapper
and be done with it. I guess that's a (small) hit against zsh though. :P

[1] /etc/bash_completion.d/virtualenvwrapper

[+] mrud|13 years ago|reply
I created some screenshots [1] showing some things, menu based tab completion, global aliases, included vcs prompt support for git, svn, hg, bzr, cvs etc.

There are plenty more features like for example hashed directories, e.g. shortcuts to a directory:

    hash -d log=/var/log
    cd ~log  # PWD is /var/log
and plenty more.

[1] http://imgur.com/a/gqpsF

[+] mikagrml|13 years ago|reply
Maintainer of zsh-lovers here.

The project is quite old already and could need some love. If someone wants to contribute, it's available on GitHub: https://github.com/grml/zsh-lovers

A more recent project similar to zsh-lovers is http://grml.org/zsh-pony/ - this are the notes from a talk I gave at DebConf 2011 and also covers some nice features of Zsh. Should be easier to go through that than through zsh-lovers if you're interested in an introduction of nifty features.

I guess the reason why no up2date list of "what Zsh can do but Bash can't" exists is that most people who explore Zsh never really look back to Bash once they went the Zsh route. Bash v4 got some features from Zsh but there are so many small things that Zsh still provides that once you get used to them you never want to go back. :)

[+] kbouw|13 years ago|reply
Same, i'm rather new to using zsh but it would help greatly if there was a comparative list between bash and zsh defining the differences. It was suggested to me by a couple of friends but at this stage, i'm not clear on why I would benefit from using zsh over bash.
[+] dbbolton|13 years ago|reply
I've been using zsh as my primary shell for roughly 5 years. I made an earnest effort in the beginning to read the 400+ page User Guide[1]. Though I learned a lot, it's simply to much information to retain-- especially the things you don't exactly use often. For me, "quick reference" materials like this list have become essential. I've resigned to remembering only the important stuff that I need daily, and for the other things (say, how to write your own completion file for a command that takes a bunch of different types of parameters) I simply remember where I can look it up (the links section of zsh-lovers is probably the most useful simply for this reason). And when I can't do that, #zsh on freenode has been a genuinely helpful community.

1. http://zsh.sourceforge.net/Guide/

[+] hnriot|13 years ago|reply
It's funny to see alias PIPE='|'

That's not much of an alias. Usually I use them to shorten the typing, not make it longer.

Here's my suggestion:

alias "list all files, but don't show much info"= ls

Premature 4/1

[+] tomprince|13 years ago|reply
I could imagine that that is for keyboard layouts where | is prohibitively difficult to type.