This shell script and shell programming site aims to provide book reviews and free ebook on bash shell, korn shell, shell commands, linux shell, awk shell, unix commands, ftp shell and all other shells.

A User's Guide to the Z-Shell

By Peter Stephenson
The Z-Shell, `zsh' for short, is a command interpreter for UNIX systems, or in UNIX jargon, a `shell', because it wraps around the commands you use. More than that, however, zsh is a particularly powerful shell --- and it's free, and under regular maintenance --- with lots of interactive features allowing you to do the maximum work with the minimum fuss. Of course, for that you need to know what the shell can do and how, and that's what this guide is for.
The most basic basics: I shall assume you have access to a UNIX system, otherwise the rest of this is not going to be much use. You can also use zsh under Windows by installing Cygwin, which provides a UNIX-like environment for programmes --- given the weakness of the standard Windows command interpreter, this is a good thing to do. There are ports of older versions of zsh to Windows which run natively, i.e. without a UNIX environment, although these have a slightly different behaviour in some respects and I won't talk about them further.
I'll also assume some basic knowledge of UNIX; you should know how the filesystem works, i.e. what /home/users/pws/.zshrc and ../file mean, and some basic commands, for example ls, and you should have experience with using rm to delete completely the wrong file by accident, and that sort of thing. In something like `rm file', I will often refer to the `command' (rm, of course) and the `argument(s)' (anything else coming after the command which is used by it), and to the complete thing you typed in one go as the `command line'.
You're also going to need zsh itself; if you're reading this, you may well already have it, but if you don't, you or your system administrator should read Appendix A. For now, we'll suppose you're sitting in front of a terminal with zsh already running.
Now to the shell. After you log in, you probably see some prompt (a series of symbols on the screen indicating that you can input a command), such as `$' or `%', possibly with some other text in front --- later, we'll see how you can change that text in interesting ways. That prompt comes from the shell. Type `print hello', then backspace over `hello' and type `goodbye'. Now hit the `Return' key (or `Enter' key, I'll just say from now on, likewise for the tab key, for the space key); unless you have a serious practical-joker problem on your system, you will see `goodbye', and the shell will come back with another prompt. All of the time up to when you hit , you were interacting with the shell and its editor, called `Z-Shell Line Editor' or `zle' for short; only then did the shell go away and tell the print command to print out a message. So you can see that the shell is important.

Followers