From Bash to Z Shell: Conquering the Command Line
Copyright 2005 by Oliver Kiddle, Jerry Peek, and Peter Stephenson
All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher.
ISBN (pbk): 1-59059-376-6
Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1
Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark.
Lead Editor: Jason Gilmore
Technical Reviewers: Bart Schaefer and Ed Schaefer
Editorial Board: Steve Anglin, Dan Appleman, Ewan Buckingham, Gary Cornell, Tony Davis, John Franklin, Jason Gilmore, Chris Mills, Dominic Shakeshaft, Jim Sumser
Project Manager: Beth Christmas
Copy Edit Manager: Nicole LeClerc
Copy Editor: Liz Welch
Production Manager: Kari Brooks-Copony
Production Editor: Laura Cheu
Compositor: Susan Glinert
Proofreader: Linda Seifert
Indexer: Kevin Broccoli
Artist: Kinetic Publishing Services, LLC
Cover Designer: Kurt Krames
Manufacturing Manager: Tom Debolski
Distributed to the book trade in the United States by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor, New York, NY 10013, and outside the United States by Springer-Verlag GmbH & Co. KG, Tiergartenstr. 17, 69112 Heidelberg, Germany.
In the United States: phone 1-800-SPRINGER, fax 201-348-4505, e-mail .
For information on translations, please contact Apress directly at 2560 Ninth Street, Suite 219, Berkeley, CA 94710. Phone 510-549-5930, fax 510-549-5939, e-mail .
The information in this book is distributed on an "as is" basis, without warranty. Although every precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work.
About the Authors
| OLIVER KIDDLE was first introduced to Unix systems while studying at the University of York. Since graduating in 1998, Oliver has worked as a software developer and system administrator. Over the past five years, Oliver has been actively involved with the development of the Z shell. |
| JERRY PEEK is a freelance writer and instructor. He has used shells extensively and has taught users about them for over 20 years. Peek is the "Power Tools" columnist for Linux Magazine and coauthored the book Unix Power Tools (O'Reilly Media). |
| PETER STEPHENSON grew up in northeast England and studied physics at Oxford. After nine years as a researcher in computational physics, he became a software engineer with Cambridge Silicon Radio, where he now works on short-range digital radio. He has been involved with zsh since the early 1990s and currently coordinates its development. |
About the Technical Reviewers
BART SCHAEFER has served as a key architect and senior developer of e-mail systems for more than 15 years, creating flexible and scalable solutions with an emphasis on open standards. Before cofounding iPost he was a founder of Z-Code Software, whose groundbreaking multiplatform e-mail application, Z-Mail, won numerous awards. Dr. Schaefer contributes regularly to open software projects, including SpamAssassin and zsh
. He holds a PhD in computer science from the Oregon Graduate Institute, focusing on automated process distribution and scheduling for massively parallel computer systems, and a BSS in computer science from Cornell College.
ED SCHAEFER is an ex-paratrooper, an ex-military intelligence officer, and an ex-oil field service engineer. He's not a total has-been. Presently, he's a software developer and DBA for a Fortune 50 companya Unix island in a sea of Windows. He's also a contributing editor to Sys Admin, the Journal for UNIX and Linux Systems Administrators, and edits Unix Review's monthly "Shell Corner" column at http://www.unixreview.com
.
Acknowledgments
The authors would like to thank Martin Streicher for the initial concept behind this book and for bringing us together at the start of the project. Thanks also to the Apress staff and our technical reviewers who've done so much work "behind the scenes" to bring this book to you. We authors did only a small part of the job.
Jerry Peek's portrait is by Meredith Hayes.
Preface
A shell is a sophisticated way to control your computerUnix, Linux, Microsoft Windows, Mac OS X, and others. If you do more than the most basic operations, you can do many of them more powerfully and quickly with a shell and your keyboard than by using a mouse.
The history of shells goes back some 30 years. In the early days of the Unix operating system, choosing and customizing your interface to a computer was a new idea. (It still is new to many people today, users of "one-size-fits-all" window systems that can be changed only superficially.) Before windows and a mouse were common, programmers began developing an interface that used the keyboard: typing one or a few words to run programs, then reading results from the same screen. As time went on, more shells were developed, giving users more choices.
New features have been added continually over the years, making the modern shell an incredibly rich environment that saves power users hours of time and frustration. Tasks that take lots of repetitive work with a mouse can be automated. For example, shell features such as completion let you accomplish a lot with little typing.
A shell can work in two ways. You can use it interactively to do things by hand. You can also automate a task by packaging those same operations into a script or function. Learning shell features lets you do both of those because a shell is a user interface and a programming language in one.
Next page