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>
yields
% 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 ...
setopt noautomenu
setopt nomenucomplete
You need both of them. If you hit tab enough times, you'll get the list of completions but it will never add any characters to what you've typed so far.
Best Answer
~/.zprofile
is only sourced whenzsh
is run as login shell, e.g. when logging in on the console or via SSH.It will not be sourced by
zsh
when opening a new terminal or starting a newzsh
session from within a running session. Anything you need in all interactive sessions, should be set in~/.zshrc
. Anything you need in allzsh
sessions, including scripts, should be set in~/.zshenv
.You can find additional information in the
zshall
manpage and on this site.~/.zshprofile
will (usually) also not be parsed by any other tools. So any environment variables set in~/.zprofile
will usually not be available in an X11 session. If you need some environment variable to be available globally in your session, you might want to have a look atman pam_env
.