This book is practical because it uses tutorial examples that show you what you will see on your terminal, workstation, or terminal emulator screen each step of the way. It is a guide because it takes you from logging in on your system (Chapter 2) through writing complex shell programs (Chapters 11, 12, and 13), using sophisticated software development tools (Chapter 14), and administrating a system (Chapter 15). Part III is a reference guide to more than 90 Solaris utilities. This Practical Guide is intended for people with some computer experience but little or no experience with a Solaris/UNIX system. However, more experienced Solaris/UNIX system users will find Parts II and III to be useful sources of information on subjects such as GUIs, basic and advanced shell programming, editing, C programming, debugging, source code management, networks, the Internet, the World Wide Web, and Solaris system administration.
This book appeals to a wide range of readers. As a minimum it assumes some experience with a PC or a Mac, but it does not require any programming experience. It is appropriate for
You will come away from this book with a broad knowledge of Solaris and how to use it in day-to-day work. Whether you are a C or Shell programmer or a user who wants to run application programs, this book will give you the knowledge to proceed. A Practical Guide to Solaris gives you a broad understanding of Solaris, including how to administer, maintain, and update the system. It will remain a valuable reference tool for years to come.
A Practical Guide to Solaris covers a wide range of topics, from writing simple shell scripts to recursive shell programming; from local email to using Netscape to browse the World Wide Web; from using simple utilities to source code management using SCCS; from using a system to administrating one. The following section highlights some of the features of this book and is followed by more in-depth discussions of some of these features.
A Practical Guide to Solaris shows you how to use Solaris from your terminal. Part I comprises Chapters 1 through 5, which introduce the new user to Solaris: introduction, getting started, basic utilities, filesystem structure, and the shell. Part I contains step-by-step tutorials covering the most important aspects of the Solaris operating system.
Part II comprises Chapters 6 through 15, which cover intermediate and advanced aspects of Solaris: GUI interfaces, networking, the vi and emacs editors, the Bourne, C, and Korn Shells and shell scripts, programming, and system administration.
Part III offers a comprehensive, detailed reference to more than 90 Solaris utilities, with numerous examples. If you are already familiar with the Solaris/UNIX system, this part of the book will be a valuable, easy-to-use reference. If you are not an experienced user, you will find Part III a useful supplement while you are mastering the subjects and tutorials in Parts I and II.
If you have used a Solaris/UNIX system before, you may want to skim over Chapters 2 and 3 or even all of Part I. |
The more advanced material in each chapter is presented in sections marked "Optional," which you are encouraged to return to after mastering the more basic material presented in the chapter. Review exercises are included at the end of each chapter for readers who want to hone their skills. Some of the exercises test the reader's understanding of material covered in the chapter, while others challenge the reader to go beyond the material presented to develop a more thorough understanding.
In Chapters 2, 3, and 4, you will learn how to create, delete, copy, move, and search for information using Solaris utilities. You will also learn how to use the Solaris file structure to organize the information you store on your computer.
Chapters 2 and 3 and Part III include information on how to use utilities (pine, talk, write, and the graphical mail programs dtmail and mailtool) to communicate with users on your system and other systems. Chapter 7 details how to address electronic mail to users on remote, networked systems.
Chapter 5 shows you how to redirect output from a program to the printer, to your terminal, or to a file--just by changing a command. You will also see how you can use pipes to combine utilities to solve problems right from the command line.
Once you have mastered the basics of Solaris, you can use your knowledge to build more complex and specialized programs using a shell programming language (shell scripts). Chapter 10 picks up where Chapter 5 leaves off. It covers more advanced aspects of working with a shell, using the Bourne Shell for examples. Chapter 11 shows you how to use the Bourne Shell to write scripts composed of Solaris system commands. Chapter 12 covers the C Shell. Chapter 13 covers the Korn Shell, which combines many of the popular features of the C Shell (such as history and aliases) with a programming language similar to that of the Bourne Shell. This chapter also covers many concepts of advanced shell programming. The examples in Part III also demonstrate many features of the utilities you can use in shell scripts.
Chapter 14 introduces you to Solaris's exceptional programming environment. This chapter describes how to use some of the most useful software development tools:cc (Solaris C compiler), gcc (the GNU C compiler), make, the Source Code Control System (SCCS), and the dbx and gdb debuggers. The make utility automates much of the drudgery involved in ensuring that a program you compile contains the latest versions of all program modules. SCCS help you to track the versions of files involved in a project. The dbx and gdb debuggers help you get your programs running correctly.
Chapter 7 explains what a network is, how it works, and how you can use it. It tells you about types of networks, various network implementations, distributed computing, how to use the network for communicating with other users, and using various networking utilities (such as rcp, telnet, ftp, pine, nslookup, and more). This chapter also discusses the use of the Internet and shows, with examples, how to use a browser (Netscape) and a search engine (AltaVista) and how to create a very simple page on the Web.
Chapter 6 discusses the X Window system, how to open and control windows, how to customize your X work environment, and how to use and customize the CDE and OpenLook window managers.
Chapter 13 covers many of the features of this powerful shell. It extends the concepts of shell programming introduced in Chapter 11 into more advanced areas, including more information on the locality of variables, recursion, and the coprocess.
The screen-oriented vi editor, which was originally a part of Berkeley UNIX, is still one of the most widely used text editors. Chapter 8 starts with a tutorial on vi and goes on to explain how to use many of the advanced features of vi, including special characters in search strings, the general-purpose and named buffers, parameters, markers, and executing commands from vi . The chapter concludes with a summary of vi commands.
Produced and distributed (for minimal cost) by the Free Software Foundation, the GNU emacs editor has grown in popularity and is available for Solaris. Chapter 9 includes information on emacs versions 19 and above and the X Window System, allowing you to use a mouse and take advantage of X Window System features such as cut and paste with emacs . This chapter explains how to use many of the features of this versatile editor, from a basic orientation to the use of the META, ALT, and ESCAPE keys; key bindings, buffers, the concept of Point, the cursor, Mark, and Region, incremental and complete searching for both character strings and regular expressions; using the online help facilities, cutting and pasting (from the keyboard and with a mouse), and using multiple windows; and C Mode, which is designed to aid a programmer in writing and debugging C code. The chapter concludes with a summary of emacs commands.
The job control commands, which originated on Berkeley UNIX, allow a user to work on many jobs at once from a single window, and switch back and forth between the jobs as desired. Job control is available under the Job, C, and Korn Shells.
A feature of the Bourne and Korn Shells, shell functions enable you to write your own commands that are similar to the aliases provided by the C Shell, only more powerful.
The Source Code Control System is a convenient set of tools that enables programmers to track multiple versions of files on a number of different types of projects.
The IEEE POSIX committees have developed standards for programming and user interfaces based on historical UNIX practice, and new standards are under development. Appendix D describes these standards and their direction and effect on the UNIX industry.
Chapter 15 explains the inner workings of the Solaris system. It details the responsibilities of the Superuser and explains how to bring up and shut down a Solaris system, add users to the system, back up files, set up new devices, check the integrity of a filesystem, and more. This chapter goes into detail about the structure of a filesystem and explains what administrative information is kept in the various files.
The Solaris system includes hundreds of utilities. Part III contains extensive examples of how to use many of these utilities to solve problems without resorting to programming in C (or another language). The example sections of nawk (over 20 pages) and sort give real-life examples that demonstrate how to use these utilities alone and with other utilities to generate reports, summarize data, and extract information.
Many UNIX utilities allow you to use regular expressions to make your job easier. Appendix A explains how to use regular expressions, so that you can take advantage of some of the hidden power of your Solaris system.
The author's home page (www.sobell.com) contains downloadable listings of the longer programs from the book; current pointers to many interesting and useful Solaris sites on the World Wide Web; a list of corrections to the book; and a solicitation for corrections, comments, suggestions, and additional programs and exercises.
First of all a big thanks to Doug Hughes who gave me a big hand with the entire book and especially the parts on system administration, networks, the Internet, and programming. Doug is the Solaris Guru who takes care of everything computer at Auburn University College of Engineering.
Thanks also to the folks at AW who helped bring this book to life: My editor Carter Shanklin who put up with my procrastination and gave me the support and leeway I needed to get this book out; John Fuller who gave me guidance and much latitude in producing the book; and everyone else who worked behind the scenes to make this book happen.
Also, a big, "Thank You" to the folks who read through the drafts of the book and made comments that caused me to refocus parts of the book where things were not clear or were left out altogether. Thanks to Ronald Hiller, Graburn Technology, Inc., Charles A. Plater, Wayne State University, Kaowen Liu, Andy Spitzer, Bob Palowoda, Sun Microsystems, Rik Schneider, Tom Bialaski, Sun Microsystems, Roger Hartmuller, TIS Labs at Network Associates, Jesse St. Laurent, Steve Bellenot, Ray W. Hiltbrand, Jennifer Witham, Gert-Jan Hagenaars, and Casper Dik.
I am also indebted to Denis Howe who edits The Free On-line Dictionary of Computing. Dennis has graciously permitted me to use entries from his compilation. Be sure to look at the dictionary at foldoc.doc.ic.ac.uk/foldoc.
A Practical Guide to Solaris is based in part on two of my previous UNIX books, UNIX System V: A Practical Guide and A Practical Guide to Linux. There were many people who helped me with those books and thanks is due them here: Thanks to Pat Parseghian, Dr. Kathleen Hemenway, and Brian LaRose; Byron A. Jeff, Clark Atlanta University; Charles Stross; Eric H. Herrin, II, University of Kentucky; Jeff Gitlin, Lucent Technologies; Kurt Hockenbury; Maury Bach, Intel Israel Ltd.; Peter H. Salus; Rahul Dave, University of Pennsylvania; Sean Walton, Intelligent Algorithmic Solutions; Tim Segall, Computer Sciences Corporation; Arnold Robbins, Georgia Tech. University; Behrouz Forouzan, DeAnza College; Mike Keenan, Virginia Polytechnic Institute and State University; Mike Johnson, Oregon State University; Jandelyn Plane, University of Maryland; Sathis Menon, Georgia Tech. University; Cliff Shaffer, Virginia Polytechnic Institute and State University; and Steven Stepanek, California State University, Northridge, for reviewing the book.
I also continue to be grateful to the many people who helped with the early editions of my UNIX books. Special thanks to Roger Sippl, Laura King, and Roy Harrington for introducing me to the UNIX system. My mother, Dr. Helen Sobell, provided invaluable comments on the original manuscript at several junctures. Also thanks to Isaac Rabinovitch, Professor Raphael Finkel, Professor Randolph Bentson, Bob Greenberg, Professor Udo Pooch, Judy Ross, Dr. Robert Veroff, Dr. Mike Denny, Joe DiMartino, Dr. John Mashey, Diane Schulz, Robert Jung, Charles Whitaker, Don Cragun, Brian Dougherty, Dr. Robert Fish, Guy Harris, Ping Liao, Gary Lindgren, Dr. Jarrett Rosenberg, Dr. Peter Smith, Bill Weber, Mike Bianchi, Scooter Morris, Clarke Echols, Oliver Grillmeyer, Dr. David Korn, Dr. Scott Weikart, and Dr. Richard Curtis.
Dr. Brian Kernighan and Rob Pike graciously allowed me to reprint the bundle script from their book, The UNIX Programming Environment.
Of course I take responsibility for any errors or omissions. If you find one or just have a comment, let me know (mark@sobell.com), and I'll fix it in the next printing. My home page (www.sobell.com) contains a list of all the errors found so far, and who found them. It also contains copies of the longer scripts from the book and pointers to many interesting Solaris pages.
Mark G. Sobell
Menlo Park, California