UNIX Unleashed, System
Table of Contents
Part I - Introduction to UNIX
Chapter 1 - The UNIX Operating System
Chapter 2 - Getting Started: Basic Tutorial
Chapter 3 - Additional UNIX Resources
Chapter 4 - The UNIX File System
Chapter 5 - General Commands
Chapter 6 - Getting Around the Network
Chapter 7 - Communicating with Others
Part II - UNIX Shells
Chapter 8 - What Is a Shell?
Chapter 9 - The Bourne Shell
Chapter 10 - The Bourne Again Shell
Chapter 11 - The Korn Shell
Chapter 12 - The C Shell
Chapter 13 - Shell Comparison
Part III - System Administration
Chapter 14 - What Is System Administration
Chapter 15 - UNIX Installation Basics
Chapter 16 - Starting Up and Shutting Down
Chapter 17 - User Administration
Chapter 18 - File System and Disk Administration
Chapter 19 - Kernel Configuration
Chapter 20 - Networking
Chapter 21 - System Accounting
Chapter 22 - Performance and Tuning
Chapter 23 - Device Administration
Chapter 24 - Mail Administration
Chapter 25 - News Administration
Chapter 26 - UUCP Administration
Chapter 27 - FTP Administration
Chapter 28 - Backing Up and Restoring Your System
UNIX® Unleashed, System
Robin Burk and David B. Horvath, CCP, et al
To Stephen P. Kowalchuk, who provided an IS manager and practicing network administrator's
point of view.
This edition is dedicated to my parents and grandparents. Education and doing one's best was
always important to them.
----David B. Horvath
Special thanks to Roger for support and grocery shopping. Also to the Laurelwood English Cockers,
who intuitively understand how to negotiate a communications session (beg), allocate resources (if
it's on the counter, it's ours!), and travel in encapsulated cells (show crates) over broadband highway
As with all the other projects I get involved with, my wife and muse, Mary, has been tremendously
supportive. Even when I spent my evenings and weekends at the keyboard. Of course, she filled her
time by shopping (she said this, not me).
My parents, brothers, and the rest of family, who always wondered about the time I spent with
computers, are now seeing the concrete results of it all.
I've been involved with this project for close to a year now. The development staff were very helpful
and have certainly kept it interesting. I want to thank them and the other authors (especially those
that I talked into helping out). This certainly turned out to be a bigger project (and resulting book)
than any of us expected. I hope and expect that people will be looking at these two volumes as
especially with the effort this one entailed, I miss them when I'm not working on one.
---- David B. Horvath
About the Authors
Robin Burk has over 25 years' experience in advanced software, computer, and data
communications technologies. She has provided technical and managerial leadership for the
development of language tools, communications software, operating systems, and multimedia
applications. A successful executive in entrepreneurial companies, she consults on software product
development and the use of the Internet for business success. Robin's undergraduate degree is in
physics and math. She also holds an MBA in finance and operations. Robin's other passion is
breeding, training, and showing dogs. She moderates an e-mail list for English Cocker Spaniel
fanciers and can be reached at email@example.com.
David B. Horvath, CCP, is a Senior Consultant with CGI Systems, Inc., an IBM Company, in the
Philadelphia, Pennsylvania area. He has been a consultant for over twelve years and is also a
part-time Adjunct Professor at local colleges teaching topics that include C Programming, UNIX,
and Database Techniques. He is currently pursuing an M.S. degree in Dynamics of Organization at
the University of Pennsylvania. He has provided seminars and workshops to professional societies
and corporations on an international basis. David is the author of "UNIX for the Mainframer" and
numerous magazine articles.
When not at the keyboard, he can be found working in the garden or soaking in the hot tub. He has
been married for over ten years and has several dogs and cats.
David can be reached at firstname.lastname@example.org for questions related to this book. No Spam please!
Fred Trimble holds a master's degree in computer science from Villanova University. In his nine
years with Unisys Corporation, he held many positions, including UNIX system administrator, C
programmer, and Oracle database administrator. Currently, he is a senior consultant and instructor
with Actium Corporation in Conshohocken, Pennsylvania, specializing in C++, Java, and the Brio
data warehousing product line. He is currently pursuing a master's degree in software engineering
from Drexel University.
Sanjiv Guha has 14 years of experience in managing and developing financial and other application
systems. He specializes in C, UNIX, C++, Windows, and COBOL. Sanjiv holds a Master of
Technology Degree from Indian Institute of Technology, New Delhi, India.
William A. Farra's computer career started in the summer of 1978, working in a time sharing shop
on a IBM 365. It had 768 KB, 8 disk packs totaling 125 MB and a cost of 10 million dollars. That
fall, Mr. Farra went to the University of Delaware for electrical engineering and worked part time at
Radio Shack playing with the trash 80's. He continued to work for the Shack until he met a bright
guy who was writing custom programs for the larger computers the Shack sold. Bill took a full time
job with him in September of 1983, working on Microsoft's first versions of UNIX (called Xenix at
the time) and writing BASIC and C code.
various clients in the Philadelphia area including "Dan Peter Kopple and Associates," the architects
who renovated 30th Station. Since 1991, Bill has returned to employment, developing and/or
enhancing various systems including "Fraud Detection Delivery System" for MBNA and Settlement
systems for EPS "MAC card ATM processor." Recently he got away from the "Big Cities" and is
living at the Jersey Shore. He is a lead developer for National Freight Industries, working with
various UNIX based systems including real-time tracking of vehicles using national transportation
satellite and ground-based networks. Always keeping an eye on the future, Bill is just having more
fun doing it now.
Richard E. Rummel, CDP, is the president of ASM Computing, Jacksonville, Florida, which
specializes in UNIX software development and end user training. He has been actively employed in
the computer industry for over 20 years. Married for 25 years, he is the father of two children, a dog,
and a cat.
Sriranga Veeraraghavan is earning his B.E. from UC Berkeley in 1997. He is a GUI designer on
UNIX, and currently uses Java for multiple Web-based applications. He is currently working at
Cisco Systems. Sriranga amuses himself with Perl, Marathon and MacsBugs.
Christopher Johnson is currently studying at Sheffield Hallam University in the UK for a degree in
Electronic and Information Engineering. He is mostly self taught in the computer field, with
experience being gained from helping other students, people on Usenet, and colleagues at work. He
is part of a team that administers a Linux server on the university's network, and administers a web
server on it. When not working, his interests include cycling and music, and he enjoys traveling.
John Valley lives in Richmond, Virginia with his wife Terri and his Labrador retriever, Brandon.
Mr. Valley currently operates a small practice as an independent consultant for UNIX and Windows
tools and applications. With more than 20 years of experience in the computer industry, his
background ranges from Cobol business applications and mainframe operating system development
to UNIX tools and Windows programming. He teaches courses in C/C++ programming and UNIX
Mr. Valley has published three books on UNIX topics and was a contributing author for the first
edition of UNIX Unleashed.
Sydney S. Weinstein, CDP, CCP, is a consultant, columnist, lecturer, author, professor, and
president of Myxa Corporation, an Open Systems technology company specializing in helping
companies move to and work with Open Systems. He has 20 years experience with UNIX dating all
the way back to Version 6.
Sean Drew is a distributed object software developer, working primarily with UNIX, C++, and
CORBA. Sean is married to his college sweetheart Sheri and together they have two children, Dylan
Thomas and Terran Caitlin. At the time of this writing a third child is on the way, and depending on
the gender will probably be named Erin Nichole, Brenna Nichole, or Ryan Patrick. When Sean is not
busy with his family or church, he likes to brew beer. Anybody up for a nice imperial stout? Sean
can be reached at email@example.com.
developing new market data and transaction distribution systems.
Ron Rose is an international management consultant with over 20 years of data processing
management experience. He has led large-scale data processing installations in Asia, Europe, and the
United States, and he has managed several software product start-up efforts. He completed a master's
in information systems from Georgia Institute of Technology after completing undergraduate work at
Tulane University and the University of Aberdeen, Scotland.
Lance Cavener is co-founder of Senarius. His function is to provide support to employers in Eastern
Canada. Tasks such as payroll, work force deployment, and more are part of his business. He is also
the President and Senior Network Administrator of ASCIO Communications, a subsidiary of
Senarius. He provides the public and businesses with Internet related services. Lance has been
actively involved in UNIX since 1990, as an administrator for corporate networks at various
companies in Eastern Canada. His work includes working with BIND/DNS, Sendmail, Usenet setup,
web servers, and UNIX security. He has also written various programs for SunOS, MS-DOS,
MS-Windows, and VMS.
David Gumkowski currently is a senior systems analyst for Digital Systems Group, Inc.,
Warminster, PA. Nineteen years ago, he emerged from his computing womb at Purdue University
and cut his system administration teeth using Control Data and Texas Instruments machines. For the
last 11 years, he developed his UNIX skills prodding Sun, Hewlett Packard, Digital Equipment and
Silicon Graphics machines to behave for approximately 3,000 users. He would publicly like to thank
his wife and children for their support when trying new things like writing chapters for this book.
John Semencar is a senior software analyst for Thomas Jefferson University, Philadelphia, PA.
Beginning system administration on Control Data legacy systems 10 years ago, and with a
background that also includes DEC and SGI, he presently surrounds himself with Hewlett Packard
9000 servers running HP-UX v10.x. He would like to thank his wife Georgia and little Buster for
Steve Shah is a systems administrator for the Center of Environmental Research and Technology at
the University of California, Riverside. He received his B.S. in Computer Science with a minor in
Creative Writing from UCR and is currently working on his M.S. there as well. In his copious spare
time, he enjoys writing fiction, DJing, and spending time with his friends, family, and sweet, Heidi.
Daniel Wilson currently performs UNIX Systems Administration and Database Administration
work for the Defense Finance and Accounting Services Financial Systems Organization, which is a
financial organization within the Department of Defense.
William D. Wood currently works at Software Artistry, Inc as a support specialist on UNIX
systems. He supports the Expert Advisor software it runs on SUN OS, HP-UX and IBM AIX. He has
specialized in multi-systems and remote systems support since 1985, when he started work at the
Pentagon. He has solely supported infrastructures that span the world and just the U.S. He has also
supported up to 80 UNIX machines at one time.
William G. Pierce currently performs UNIX Systems Administration and is the Technical Lead for
the MidTier Management Operation at the Defense Finance and Accounting Services, Financial
Services Organization, Indianapolis, Indiana.
mainly specializing in UNIX, NetWare, and mainframe connectivity. He also designs and
implements TCP/IP-based networks and enterprise network management solutions. Salim holds a
master's degree in electrical engineering from the American University of Beirut. His experience and
main career interests have primarily been in internetworking, multiplatform integration, and network
analysis and management.
Chris Byers is a systems administrator for a financial securities firm in Philadelphia. As a former
consultant and disaster recovery specialist, he has many years of experience in the UNIX world with
its many different variants. He lives in South Jersey with his wife, his son, and his cat. He can be
Jeff Smith is a psychology major who took a wrong turn and ended up working with computers. Jeff
has worked with UNIX systems since 1982 as a programmer and systems administrator. He has
administered mail, news, security, and the domain name system on several varieties of UNIX
including 2.9 BSD, 4.3 BSD, Dynix, SunOS, and AIX.
James C. Armstrong, Jr. is a software engineer with more than ten years of industry experience
with UNIX and C.
James Edwards (
firstname.lastname@example.org) is an IT professional experienced in data
communications, network integration, and systems design in both North America and Europe. He
holds an M.S. in information technology from the University of London and a B.A. (Hons) from
Middlesex University, both in the United Kingdom. James currently resides in Toronto, Canada,
where he is employed as a manager with the Deloitte & Touche Consulting Group. His spare time is
taken up with his girls, Denise, Lauren, and Poppy.
Tell Us What You Think!
As a reader, you are the most important critic and commentator of our books. We value your opinion
and want to know what we're doing right, what we could do better, what areas you'd like to see us
publish in, and any other words of wisdom you're willing to pass our way. You can help us make
strong books that meet your needs and give you the computer guidance you require.
Do you have access to the World Wide Web? Then check out our site at
If you have a technical question about this book, call the technical support line
at 317-581-3833 or send e-mail to
As the team leader of the group that created this book, I welcome your comments. You can fax,
e-mail, or write me directly to let me know what you did or didn't like about this book--as well as
what we can do to make our books stronger. Here's the information:
201 W. 103rd Street
Indianapolis, IN 46290
by Robin Burk and David B. Horvath, CCP
Welcome to UNIX Unleashed, System Administrator's Edition.
Who Should Read This Book
Our highly popular first edition brought comprehensive, up-to-date information on UNIX to a wide
audience. That original edition was already 1,600 pages. The new topics covered in this edition have
obliged us to split the second edition into two volumes, namely, the System Administrator's Edition
and the Internet Edition, which we'll refer to jointly as "the new" or the second edition. Though each
volume can stand alone and may be read independently of the other, they form a complementary set
with frequent cross-references. This new edition is written for:
People new to UNIX
Anyone using UNIX who wants to learn more about the system and its utilities
Programmers looking for a tutorial and reference guide to C, C++, Perl, awk, and the UNIX
System administrators concerned about security and performance on their machines
Webmasters and Internet server administrators
Programmers who want to write Web pages and implement gateways to server databases
Anyone who wants to bring his or her UNIX skills and knowledge base up-to-date
A lot has happened in the UNIX world since the first edition of UNIX Unleashed was released in
1994. Perhaps the most important change is the tremendous growth of the Internet and the World
Wide Web. Much of the public Internet depends on UNIX-based servers. In addition, many
corporations of all sizes have turned to UNIX as the environment for network and data servers. As
UNIX fans have long known, the original open operating system is ideal for connecting
heterogeneous computers and networks into a seamless whole.
What's New in UNIX Unleashed, Second Edition
This edition of UNIX Unleashed includes a substantial amount of new information describing
Internet and World Wide Web technologies in UNIX. New topics include:
Programming Web pages with HTML
Object-oriented programming in C++
Programming Common Gateway Interfaces (CGI) using Perl, C/C++, HTML, and the UNIX
MIME, the Multipurpose Internet Mail Extension
HTTP, the HyperText Transfer Protocol
Web servers and server performance
As UNIX becomes the platform of choice for critical network and data applications, UNIX vendors
have placed increased emphasis on system maturity, ease-of-use, and security capabilities. Even with
the growth of Microsoft Windows NT, UNIX still has a place in the industry. It is more mature,
more stable, more scaleable, and has a wider array of applications than NT. Many people claim that
NT is the open operating system of the future; that may be true (I have my own personal opinion),
but for now, UNIX holds that place.
We've also updated this edition of UNIX Unleashed to bring you current information regarding:
Frequently Asked Questions (FAQs) about the most popular variants of UNIX
Security issues and the technologies you can use to protect your system and its information
against intruders and malicious users
The most popular Graphical User Interfaces (GUIs)
As with the original edition, we set out to bring users the most comprehensive, useful, and up-to-date
UNIX guide. To meet this goal, we've added nearly two dozen new chapters and have revised much
of the original material in the book. The resulting book is so large that it is now divided into two
volumes. The System Administrator's Edition introduces UNIX and contains much of the
information required for basic users and for systems administrators. The Internet Edition includes
advanced information for programmers, Internet/Web developers, and those who need detailed
information regarding specific UNIX flavors.
Coverage of Popular UNIX Variants
Based on input from some of the experts, application developers, consultants, and system
administrators working in industry, we have provided information about a number of the UNIX
variants. We split the variants into two categories: major and minor. This is not a comment on the
quality or capabilities of the variant, but on the penetration in the marketplace (popularity).
We consider AIX, HP-UX, Solaris, and SVR4 to be major and BSD, IRIX, Linux, and SunOS to be
minor players in the marketplace. There are other variants; the next edition may cover them as they
become more popular.
You can identify where something specific to a variant is discussed by the icon next to it:
AIX--major--IBM's version that runs on the RS/6000 series of RISC systems and mainframes.
Over 500,000 RS/6000 systems have been sold!
BSD--minor--This version has a lesser presence in the marketplace. Although many variants
can trace their heritage to BSD, it is not that popular as a product.
HP-UX--major--Hewlett Packard's (HP) version with a strong hardware presence in the
marketplace and a strong future growth path.
IRIX--minor--While the Silicon Graphics (SGI) machines are wonderful for graphics, they
have not found wide acceptance in business environments.
Linux--minor--Although this is a very nice and free variant, it has little commercial presence
in the marketplace (probably because corporations do not want to run their mission-critical
applications without a vendor they can sue when there is a problem). See the SAMS Linux
Unleashed series books (Red Hat and Slackware) for detailed information.
Solaris--major--Sun Microsystems' version with a strong hardware presence in the
marketplace and a strong future growth path.
SunOs--minor--Largely being superseded by Solaris installations. A good variant, but it is
difficult for a company to support two versions of UNIX at a time.
SVR4--major--This version has a strong presence in the marketplace. In addition, many
variants can trace their heritage to System V Release 4.
We've also enhanced our CD-ROM with a C compiler, the most popular Web server software, and
megabytes of other useful tools and information. The CD-ROM packaged with each volume contains
exactly the same software and materials. Here are some of the noteworthy inclusions:
The entire text of both volumes in HTML format
Listings and code examples from various chapters in the volume
FreeBSD 2.2.5, full binary release
Linux RedHat 4.2, full binary release [x86 platform only]
BASH, sources and documentation.
sendmail version 8.7
RFCs 821, 822, 1425, 1123, 976, 977, 1036
latest version of INN source code
GNU findutils 4.1
GNU fileutils 3.16
Crack (or equivalent)
elm and pine
UNIX sort utility
GNU awk, gawk
APACHE web server
GNU C compiler
NCSA Web Server
Isearch and Isearch-cgi
LessTif 0.80 sources Linux & FreeBSD bins
fvwm window manager
Enlightenment window manager
libg 2.7.2 (useful companion to C compiler)
acroread, Adobe Acrobat PDF reader (for Linux and FreeBSD)
To make use of the CD-ROM easier, whenever a reference in print is made to the CD-ROM, you
will see an icon. You can also scan through the text to find the CD-ROM icons to find more
information the disk contents.
How These Volumes are Organized
The books are divided into parts (detailed information about each volume is in the next sections).
Each volume also contains a glossary of terms and an index.
Whenever there is special information you should pay attention to, it will be placed in a blocks to
grab your attention. There are three types of special blocks: note, tip, and caution.
A note is used to provide you with information that you may want to pay
attention to but is not critical. It provides you with information that can be critical but
should not cause too much trouble.
exposure to problems (and how they were solved).
A caution is used to grab your attention to prevent you from doing
something that would cause problems. Pay close attention to cautions!
The icons shown in the CD-ROM Contents and Coverage of Popular UNIX Variants sections also
provide a quick means of referencing information.
How the System Administrator's Edition Is
The first volume, UNIX Unleashed, Systems Administrator Edition, consists of three major sections
or parts. The general focus is getting you started using UNIX, working with the shells, and then
administering the system.
Part I, Introduction to UNIX, is designed to get you started using UNIX. It provides you with the
general information on the organization of the UNIX operating system, how and where to find files,
and the commands a general user would want to use. Information is also provided on how to get
around the network and communicating with other users on the system.
Part II, UNIX Shells, provides you the information on how to choose which shell to use and how to
use that shell. The most popular shells: Bourne, Bourne Again (BASH), Korn, and C, are covered as
well as a comparison between them. Under UNIX, the shell is what provides the user interface to the
Part III, System Administration, gets you started and keeps you going with the tasks required to
administer a UNIX system. From installation through performance and tuning, the important topics
are covered. The general duties of the system administrator are described (so you can build a job
description to give to your boss). In case you are working on a brand-new UNIX system, the basics
of UNIX installation are covered. Other topics covered in this section include: starting and stopping
UNIX, user administration, file system and disk administration, configuring the kernel (core of the
operating system), networking UNIX systems, accounting for system usage, device (add-on
hardware) administration, mail administration, news (known as netnews or UseNet) administration,
UUCP (UNIX to UNIX Copy Program, an early networking method still in wide use today)
administration, FTP (File Transfer Protocol) administration, and finally, backing up and restoring
How the Internet Edition Is Organized
The second volume, UNIX Unleashed, Internet Edition, consists of seven major parts. The general
focus is programming (GUI, application languages, and the Internet), text formatting (which
involves embedding commands in your text and then processing it), security considerations
Part I, Graphical User Interfaces, provides you with information about using and writing GUI
applications. When the operating system is UNIX, the GUI is the X-windowing system.
Part II, Programming, introduces the most popular program development tools in the UNIX
environment. The most important part is how to enter your program (editing with vi and emacs)! The
awk, Perl, C, and C++ programming languages are covered. Awk and Perl are interpreted languages
designed for quick program development. C is the compiled language developed by Kernighan and
Ritchie--UNIX is written in this language. C++ is an enhancement to the C language that supports
object oriented programming. The final chapter in this section discusses the
provides a rule-based method to control program compilation.
Part III, Text Formatting and Printing, covers the tools that support the development, formatting, and
printing of documents in the UNIX environment. These tools were much of the original justification
for hardware that was used to develop UNIX. The formatting programs,
standard macro packages, and many of the other document preparation tools are covered. In addition,
developing your own text formatting macros is discussed.
Part IV, Security, is an advanced area of systems administration. One of the criticisms of UNIX is
that it is not secure. It was developed in an environment where the individuals were trusted and
sharing information was important. UNIX is capable of being very secure; you just have to know
how to set it up. This section provides that information. The risks, available tools, and helpful
organizations are covered.
Part V, UNIX and the Internet, introduces the tools used with the world wide web and the
transmission of binary files via email (MIME). The web page definition language, HTML, is
introduced, along with the methods of developing CGI (Common Gateway Interface--programs that
run on the web server processing data from web pages) programs in shell scripting languages, Perl,
and C/C++. Administrative information is provided in chapters on HTTP (HyperText Transport
Protocol) and monitoring server activity.
Part VI, Source Control, covers the tools that UNIX provides to maintain control of your source code
as different versions (and revisions) are created. The three major tools are RCS, CVS, and SCCS.
Part VII, Frequently Asked Questions, provides answers, as the name implies, to the most frequently
asked questions about the various variants of UNIX. AIX, BSD, HP-UX, Linux, Solaris, SVR4, and
IRIX are covered in individual chapters.
Conventions Used in This Volume
This book uses the following typographical conventions:
Menu names are separated from the individual menu options with a vertical bar (|). For
example, "File|Save" means "Select the File menu and then choose the Save option."
New terms appear in italic.
All code appears in
. This includes pseudocode that is used to show a general
format rather than a specific example.
Words that you are instructed to type appear in
Placeholders (words that stand for what you actually type) appear in
Lines of code that are too long to fit on only one line of this book are broken at a convenient
place and continued on the next line. A code continuation character (
) precedes the new
line. Any code that contains this character should be entered as one long line without a line
An ellipsis (...) in code indicates that some code has been omitted for the sake of brevity.
UNIX Unleashed, System Administrator's Edition
Copyright©, Macmillan Computer Publishing. All rights reserved.
No part of this book may be used or reproduced in any form or by any means, or stored in a database
or retrieval system without prior written permission of the publisher except in the case of brief
quotations embodied in critical articles and reviews.
For information, address Macmillan Publishing, 201 West 103rd Street, Indianapolis, IN 46290.
UNIX Unleashed, System Administrator's Edition
-The UNIX Operating System
by Rachel and Robert Sartin, and Robin Burk
Welcome to the world of UNIX. Once the domain of wizards and gurus, today UNIX has spread beyond the
university and laboratory to find a home in global corporations and small Internet servers alike. This ability to
scale up or down, to accommodate small installations or complex corporate networks with little or no
modification, is only one of the characteristics that have won UNIX its popularity and widespread use.
As we'll see through the course of this book, UNIX is a rich and complex system built upon simple, powerful
elements. Although many more recent operating systems have borrowed concepts and mechanisms from
UNIX, those who are most familiar with legacy mainframe environments, or whose experience is mostly
limited to single-user personal computers, may find UNIX to be a bit intimidating at first. The best advice I
can give is to take it slowly, but don't give up. As you read through these chapters and begin to use some of
the features and utilities described in this book, you'll find that once-foreign ideas have taken clear and
concrete shape in your mind.
One distinctive characteristic of UNIX compared to other operating systems is the fact
that there are several flavors, or variants, of the operating system. Because the source code of the
early versions was made available to a variety of computer manufacturers and third parties, many
slightly different forms of UNIX co-exist. Some are specific to a given hardware manufacturer;
others differ in the utilities, configuration methods or user interfaces they offer. In this book, we
will call your attention to the differences among the most commonly used UNIX variants,
HP-UX (Hewlett Packard)
Other UNIX variants we will examine in these two volumes include:
BSD (Berkeley Software)
SunOS (predecessor to Solaris)
Throughout these two volumes, you will find specific details regarding how to accomplish
tasks in each of the most popular versions of UNIX. In addition, Part VII in the second volume,
UNIX Unleashed, Internet Edition, contains one chapter each of answers to Frequently Asked
Questions for each major UNIX flavor.
At its base UNIX is both simple and elegant, with a consistent architecture that, in turn, underlies and guides
the design of its many application programs and languages. If you are new to UNIX, I want you to know that
I'm a bit jealous of the fun you'll have as you begin to explore this fascinating environment for the first time. If
you are a more experienced UNIX user, administrator, or programmer, this revised edition of UNIX Unleashed
contains a wealth of information that can help you extend your UNIX use to Internet and World Wide Web
applications, guard against hackers and other unauthorized intruders, and fine-tune your system management
What is UNIX?
A trademark of Novell Corporation
A multitasking, multiuser operating system
The name given to a whole family of related operating systems and their most common application,
utility, and compiler programs
A rich, extensible, and open computing environment
Let's take these one at a time. To begin with, UNIX is a trademark, which means that there is intellectual
property associated with UNIX that is not in the public domain. Some versions of UNIX require a paid license
for their use.
The term UNIX also refers to a powerful multitasking, multiuser operating system.
Once upon a time, not so long ago, everyone knew what an operating system (OS) was. It was the complex
software sold by the maker of your computer system, without which no other programs could function on that
computer. It spun the disks, lit the terminals, and generally kept track of what the hardware was doing and
why. Application (user) programs asked the operating system to perform various functions; users seldom
talked to the OS directly.
Today those boundaries are not quite so clear. The rise of graphical user interfaces, macro and scripting
languages, suites of applications that can exchange information seamlessly, and the increased popularity of
networks and distributed data--all of these factors have blurred the traditional distinctions. Today's computing
environments consist of layers of hardware and software that interact together to form a nearly organic whole.
At its core (or, as we say in UNIX, in the kernel), however, UNIX does indeed perform the classic role of an
operating system. Like the mainframe and minicomputer systems that came before, UNIX enables multiple
people to access a computer simultaneously and multiple programs and activities to proceed in parallel with
Those who do not care much for these programs, however, will find themselves free to substitute their own
approach for getting various computing jobs done. A salient characteristic of UNIX is that it is extensible and
open. By extensible, I mean that UNIX allows the easy definition of new commands, which can then be
invoked or used by other programs and terminal users. This is practical in the UNIX environment because the
architecture of the UNIX kernel specifically defines interfaces, or ways that programs can communicate with
one another without having been designed specifically to work together.
Understanding Operating Systems
An operating system is an important part of a computer system. You can view a computer system as being
built from three general components: the hardware, the operating system, and the applications. (See Figure
1.1.) The hardware includes pieces such as a central processing unit (CPU), a keyboard, a hard drive, and a
printer. You can think of these as the parts you are able to touch physically. Applications are why you use
computers; they use the rest of the system to perform the desired task (for example, play a game, edit a memo,
send electronic mail). The operating system is the component that on one side manages and controls the
hardware and on the other manages the applications.
Computer system components.
When you purchase a computer system, you must have at least hardware and an operating system. The
hardware you purchase is able to use (or run) one or more different operating systems. You can purchase a
bundled computer package, which includes the hardware, the operating system, and possibly one or more
applications. The operating system is necessary in order to manage the hardware and the applications.
When you turn on your computer, the operating system performs a series of tasks, presented in chronological
order in the next few sections.
Hardware Management, Part 1
One of the first things you do, after successfully plugging together a plethora of cables and components, is
turn on your computer. The operating system takes care of all the starting functions that must occur to get your
computer to a usable state. Various pieces of hardware need to be initialized. After the start-up procedure is
complete, the operating system awaits further instructions. If you shut down the computer, the operating
system also has a procedure that makes sure all the hardware is shut down correctly. Before turning your
computer off again, you might want to do something useful, which means that one or more applications are
executed. Most boot ROMs do some hardware initialization but not much. Initialization of I/O devices is part
of the UNIX kernel.
After the operating system completes hardware initialization, you can execute an application. This executing
application is called a process. It is the operating system's job to manage execution of the application. When
you execute a program, the operating system creates a new process. Many processes can exist simultaneously,
but only one process can actually be executing on a CPU at one time. The operating system switches between
your processes so quickly that it can appear that the processes are executing simultaneously. This concept is
referred to as time-sharing or multitasking.
When you exit your program (or it finishes executing), the process terminates, and the operating system
manages the termination by reclaiming any resources that were being used.
perform these tasks, the program makes requests to the operating system, and the operating system responds to
the requests and allocates necessary resources to the program. When an executing process needs to use some
hardware, the operating system provides access for the process.
Hardware Management, Part 2
To perform its task, a process may need to access hardware resources. The process may need to read or write
to a file, send data to a network card (to communicate with another computer), or send data to a printer. The
operating system provides such services for the process. This is referred to as resource allocation. A piece of
hardware is a resource, and the operating system allocates available resources to the different processes that
See Table 1.1 for a summary of different actions and what the operating system (OS) does to manage them.
Table 1.1. Operating system functions.
OS Does This
You turn on the computer
You execute an application
Application reads a tape
Application waits for data
Process waits while other process runs Process management
Process displays data on screen
Process writes data to tape
You quit, the process terminates
You turn off the computer
From the time you turn on your computer until you turn it off, the operating system is coordinating the
operations. As hardware is initialized, accessed, or shut down, the operating system manages these resources.
As applications execute, request, and receive resources, or terminate, the operating system takes care of these
actions. Without an operating system, no application can run and your computer is just an expensive
The UNIX Operating System
The previous section looked at operating systems in general. This section looks at a specific operating system:
UNIX. UNIX is an increasingly popular operating system. Traditionally used on minicomputers and
workstations in the academic community, UNIX is now available on personal computers, and the business
community has started to choose UNIX for its openness. Previous PC and mainframe users are now looking to
UNIX as their operating system solution. This section looks at how UNIX fits into the operating system
The UNIX system is actually more than strictly an operating system. UNIX includes the traditional operating
system components. In addition, a standard UNIX system includes a set of libraries and a set of applications.
Figure 1.2 shows the components and layers of UNIX. Sitting above the hardware are two components: the
file system and process control. Next is the set of libraries. On top are the applications. The user has access to
the libraries and to the applications. These two components are what many users think of as UNIX, because
together they constitute the UNIX interface.
The layers of UNIX.
The part of UNIX that manages the hardware and the executing processes is called the kernel. In managing all
hardware devices, the UNIX system views each device as a file (called a device file). This allows the same
simple method of reading and writing files to be used to access each hardware device. The file system
(explained in more detail in Chapter 4, "The UNIX File System") manages read and write access to user data
and to devices, such as printers, attached to the system. It implements security controls to protect the safety
and privacy of information. In executing processes (see Chapter 18), the UNIX system allocates resources
(including use of the CPU) and mediates accesses to the hardware.
One important advantage that results from the UNIX standard interface is application portability. Application
portability is the ability of a single application to be executed on various types of computer hardware without
being modified. This can be achieved if the application uses the UNIX interface to manage its hardware needs.
UNIX's layered design insulates the application from the different types of hardware. This allows the software
developer to support the single application on multiple hardware types with minimal effort. The application
writer has lower development costs and a larger potential customer base. Users not only have more
applications available, but can rely on being able to use the same applications on different computer hardware.
UNIX goes beyond the traditional operating system by providing a standard set of libraries and applications
that developers and users can use. This standard interface allows application portability and facilitates user
familiarity with the interface.
The History of UNIX
How did a system such as UNIX ever come to exist? UNIX has a rather unusual history that has greatly
affected its current form.
The Early Days
In the mid-1960s, AT&T Bell Laboratories (among others) was participating in an effort to develop a new
operating system called Multics. Multics was intended to supply large-scale computing services as a utility,
much like electrical power. Many people who worked on the Bell Labs contributions to Multics later worked
In 1969, Bell Labs pulled out of the Multics effort, and the members of the Computing Science Research
Center were left with no computing environment. Ken Thompson, Dennis Ritchie, and others developed and
simulated an initial design for a file system that later evolved into the UNIX file system. An early version of
the system was developed to take advantage of a PDP-7 computer that was available to the group.
AT&T was not allowed to market computer systems, so it had no way to sell this creative work from Bell
Labs. Nonetheless, the popularity of UNIX grew through internal use at AT&T and licensing to universities
for educational use. By 1977, commercial licenses for UNIX were being granted, and the first UNIX vendor,
Interactive Systems Corporation, began selling UNIX systems for office automation.
Later versions developed at AT&T (or its successor, Unix System Laboratories, now owned by Novell)
included System III and several releases of System V. The two most recent releases of System V, Release 3
(SVR3.2) and Release 4 (SVR4; the most recent version of SVR4 is SVR4.2) remain popular for computers
ranging from PCs to mainframes.
All versions of UNIX based on the AT&T work require a license from the current owner, UNIX System
Berkeley Software Distributions
In 1978, the research group turned over distribution of UNIX to the UNIX Support Group (USG), which had
distributed an internal version called the Programmer's Workbench. In 1982, USG introduced System III,
which incorporated ideas from several different internal versions of and modifications to UNIX, developed by
various groups. In 1983, USG released the original UNIX System V, and thanks to the divestiture of AT&T,
was able to market it aggressively. A series of later releases continued to introduce new features from other
versions of UNIX, including the internal versions from the research group and the Berkeley Software
While AT&T (through the research group and USG) developed UNIX, the universities that had acquired
educational licenses were far from inactive. Most notably, the Computer Science Research Group at the
University of California at Berkeley (UCB) developed a series of releases known as the Berkeley Software
Distribution, or BSD. The original PDP-11 modifications were called 1BSD and 2BSD. Support for the
Digital Equipment Corporation VAX computers was introduced in 3BSD. VAX development continued with
4.0BSD, 4.1BSD, 4.2BSD, and 4.3BSD, all of which (especially 4.2 and 4.3) had many features (and much
source code) adopted into commercial products.
UNIX and Standards
Because of the multiple versions of UNIX and frequent cross-pollination between variants, many features
have diverged in the different versions of UNIX. With the increasing popularity of UNIX in the commercial
and government sector came the desire to standardize the features of UNIX so that a user or developer using
UNIX could depend on those features.
The Institute of Electrical and Electronic Engineers (IEEE) created a series of standards committees to create
standards for "An Industry-Recognized Operating Systems Interface Standard based on the UNIX Operating
System." The results of two of the committees are important for the general user and developer. The POSIX.1
committee standardizes the C library interface used to write programs for UNIX. (See UNIX Unleashed,
Internet Edition, Chapter 6, "The C and C++ Programming Languages.") The POSIX.2 committee
standardizes the commands that are available for the general user.
In Europe, the X/Open Consortium brings together various UNIX-related standards, including the current
attempt at a Common Open System Environment (COSE) specification. X/Open publishes a series of
specifications called the X/Open Portability. The MOTIF user interface is one popular standard to emerge
from this effort.
Various commercial consortia have attempted to negotiate UNIX standards as well. These have yet to
converge on an accepted, stable result.
UNIX for Mainframes and Workstations
Many mainframe and workstation vendors make a version of UNIX for their machines. We will be discussing
several of these variants (including Solaris from SunSoft, AIX from IBM and HP-UX from Hewlett Packard)
throughout this book.
UNIX for Intel Platforms
Thanks to the great popularity of personal computers, there are many UNIX versions available for Intel
platforms. Choosing from the versions and trying to find software for the version you have can be a tricky
business because the UNIX industry has not settled on a complete binary standard for the Intel platform. There
are two basic categories of UNIX systems on Intel hardware: the SVR4-based systems and the older, more
established SVR3.2 systems.
SVR4 vendors include NCR, IBM, Sequent, SunSoft (which sells Solaris for Intel), and Novell (which sells
UnixWare). The Santa Cruz Operation (SCO) is the main vendor in the SVR3.2 camp.
Source Versions of "UNIX"
Several versions of UNIX and UNIX-like systems have been made that are free or extremely cheap and
include source code. These versions have become particularly attractive to the modern-day hobbyist, who can
now run a UNIX system at home for little investment and with great opportunity to experiment with the
operating system or make changes to suit his or her needs.
An early UNIX-like system was MINIX, by Andrew Tanenbaum. His book Operating Systems: Design and
Implementations describes MINIX and includes a source listing of the original version of MINIX. The latest
version of MINIX is available from the publisher. MINIX is available in binary form for several machines
(PC, Amiga, Atari, Macintosh, and SPARCStation).
The most popular source version of UNIX is Linux (pronounced "lin nucks". Linux was designed from the
ground up by Linus Torvalds to be a free replacement for UNIX, and it aims for POSIX compliance. Linux
itself has spun off some variants, primarily versions that offer additional support or tools in exchange for
license fees. Linux has emerged as the server platform of choice for small to mid-sized Internet Service
Providers and Web servers.
Making Changes to UNIX
Many people considering making the transition to UNIX have a significant base of PC-based MS-DOS and
Microsoft Windows applications. There have been a number of efforts to create programs or packages on
UNIX that would ease the migration by allowing users to run their existing DOS and Windows applications on
the same machine on which they run UNIX. This is a rapidly changing marketplace as Microsoft evolves its
Windows and Windows NT operating systems.
Introduction to the UNIX Philosophy
on all UNIX systems. There are several common key items throughout UNIX:
Simple, orthogonal commands
Commands connected through pipes
A (mostly) common option interface style
No file types