ABOUT THE BOOK
One of my jobs before writing this book was to teach UNIX to a variety of individuals, including university students, industry C hackers, and, occasionally, friends and colleagues. During that time, I acquired a large amount of knowledge, both in my head as well as in the form of a substantial library, that I often thought would be good to put into book form. When I began preparing my university lecture series about UNIX, I found that none of the available UNIX textbooks suited my purpose-they were either too unstructured, too specialized, or lacking in suitable exercises and projects for my students. In response to this situation, I wrote the very first version of the current book. After a couple of years of using it, I completely rewrote it, giving careful thought to the organization of the new material. I decided to group the information on the basis of various typical kinds of UNIX users, allowing the book to be utilized by a good range of people without completely going over the top (or underneath) anyone's head. One tricky decision concerned the level of detail to include about things like utilities and system calls. Most of these have a large number of specialized options and features that are rarely used, and to document them all and still cover the range of topics that I had targeted would result in a book about two feet thick. Because of this, I've included information only about the most common and useful features of utilities, shells, and system calls. I include references to other commercially available books for more detail. This hybrid-book approach seemed like a good compromise; I hope that you agree.
This edition adds a chapter on the Bourne Again Shell (also called "bash"), which has become more important because of its integral position in Linux. We have also updated the UNIX/Linux version information and X desktop and window manager details, expanded the existing coverage of perl and IPv6, and added and improved some command descriptions, quizzes, and exercises. Many organizational improvements, including new figure numbering, should make the book easier to use, as well.
LAYOUT OF THE BOOK
UNIX is a big thing. To describe it fully requires an explanation of many different topics from several different angles, which is exactly what I've tried to do. The book is split into the following sections, each designed for a particular kind of user:
1. What is UNIX?
2. UNIX Utilities for Nonprogrammers
3. UNIX Utilities for Power Users
4. The UNIX Shells
5. The Bourne Shell
6. The Korn Shell
7. The C Shell
8. The Bourne Again Shell
9. Networking
10. The Internet
11. Windowing Systems
12. C Programming Tools
13. Systems Programming
14. UNIX Internals
15. System Administration
16. The Future
Appendix
Bibliography
LAYOUT OF THE CHAPTERS
Every chapter in this book has the following standard prologue:
Motivation
Why it's useful to learn the material that follows.
Prerequisites
What the reader should know in order to negotiate the chapter successfully.
Objectives
A list of the topics presented.
Presentation
A description of the method by which the topics are presented.
Utilities
A list of the utilities covered in the chapter (when appropriate).
System calls
A list of the system calls covered in the chapter (when appropriate).
Shell commands
A list of the shell commands covered in the chapter (when appropriate).
In addition, every chapter ends with a review section, which contains the following items:
Checklist
A recap of the topics.
Quiz
A quick self-test.
Exercises
A list of exercises, rated easy, medium, or hard.
Projects
One or more related projects, rated easy, medium, or hard.
A GUIDE FOR TEACHERS
As I mentioned earlier, this book was originally written for an audience of undergraduate and graduate students. I suggest that a lecture series based on the book could be designed as follows:
- If the students don't know the C language, then a medium-paced course could begin with Chapters 1, 2, 4, and 12. The lecturer could then introduce the students to C and use the contents of Chapter 13 for class exercises and projects.
- If the students already know the C language, then a medium-paced course could include Chapters 1, 2, 4, 7,12,13, and 14. Projects focusing on parallel processing and interprocess communication will ensure that the students end up with a good knowledge of UNIX fundamentals.
- If the students know the C language and are enthusiastic, I suggest that all of the chapters with the exception of Chapters 3, 5, and 6 be covered in one semester. I know this is possible, as I've taught the class that way!
NOMENCLATURE
Throughout this book, there are references to UNIX utilities, shell commands (i.e., commands that are part of a command shell itself), and system calls (UNIX library functions). It's quite easy to confuse these three things, so I adopted a consistent way to differentiate them:
- UNIX utilities are always written in boldface, like this: "The mkdir utility makes a directory."
- Shell commands are always written in italics, like this: "The history command lists your previous commands."
- System calls are always followed by parentheses, like this: "The fork () system call duplicates a process."
Formal descriptions of utilities, shell commands, and system calls are supplied in a box, using a modified-for-UNIX Backus-Naur notation. The conventions of this notation are fairly simple and are described fully in the appendix.
All utilities, shell commands, and system calls, including the page numbers of the scripts and programs that use them, are fully cross-referenced in the appendix.
Sample UNIX sessions are presented in a Courier font. Keyboard input from the user is always displayed in italics, and annotations are always preceded by ellipses (...).