4 ms·
As others mentioned, zsh is compatible enough with bash to make switching relatively painless. There are many areas of zsh that are dramatically better, but the
by dima55 14y ago
As others mentioned, zsh is compatible enough with bash to make switching relatively painless. There are many areas of zsh that are dramatically better, but the one that can make you fly is the fancy globbing that zsh has. More or less, you never need the 'find' tool when using zsh. For example, if I want to find all the Makefiles in this or child directories that have the string 'abc' and have been modified less than 1 hour ago, I can do
$ grep -l abc **/Makefile(mh-1)
If I want to look at the most-recently-modified file, I can
$ less *(om[1])
If I have a symlink 'dir' that points to a directory and I want to cd to the pointed-to directory, I can
$ cd dir(:A)
Clearly, there are lots of codes, but you don't need to remember them, since the tab-completion gives you online help. I can type the '(' then press 'tab', and it'll give me a list of the various codes that can follow and what they mean.
There are tons of others. If I want all
*
EXCEPT
*.h
I can use
'*~*.h'
Or for instance, say I have a directory of photos. I want to pick DSC00095.jpg through DSC00107.jpg. In bash, you cry; in zsh I say
DSC<95-107>.jpg.
After I've typed in the glob, I can press 'tab', and it'll expand the glob in-place, letting me know if the code worked without executing. I can then undo to get the code back and have it live in my history.
There are plenty of other non-globbing-related features of zsh that make it worth looking at, but this is one that doesn't get as much press as it deserves.