Learning the Unix Operating System, 5th Edition
Jerry Peek
Grace Todino
John Strang
Beijing Cambridge Farnham Kln Sebastopol Tokyo
Special Upgrade Offer
If you purchased this ebook directly from oreilly.com, you have the following benefits:
DRM-free ebooksuse your ebooks across devices without restrictions or limitations
Multiple formatsuse on your laptop, tablet, or phone
Lifetime access, with free updates
Dropbox syncingyour files, anywhere
If you purchased this ebook from another retailer, you can upgrade your ebook to take advantage of all these benefits for just $4.99. to access your ebook upgrade.
Please note that upgrade offers are not available from sample content.
A Note Regarding Supplemental Files
Supplemental files and examples for this book can be found at http://examples.oreilly.com/9780596002619-files/. Please use a standard desktop web browser to access these files, as they may not be accessible from all ereader devices.
All code files or examples referenced in the book will be available online. For physical books that ship with an accompanying disc, whenever possible, weve posted all CD/DVD content. Note that while we provide as much of the media content as we are able via free download, we are sometimes limited by licensing restrictions. Please direct any questions or concerns to .
Preface
The Unix Family of Operating Systems
An operating system (or OS)is a set of programs that controls a computer.It controls both hardware (things you can touch, likekeyboards, screens, and disk drives) and software (application programs that you run, like a word processor).
Some computers have a single-user OS, which means that only oneperson can use the computer at a time.Many older OSes (such as MS-DOS) can also do only one job at a time.But almost any computer can do a lot more if it has a multiuser, multitasking operating system such as Unix.These powerful OSes let many people use the computer at the same timeand let each user run several jobs at once.
Unix was invented more than 30 years ago for scientific andprofessional users who wanted a very powerful and flexible OS.Its been significantly developed since then.Because Unix was designed for experts, it can be a bit overwhelming at first.But after you get the basics (from this book!) youll start to appreciatesome of the reasons to use Unix:
It comes with a huge number of powerful application programs.You can get many others for free on the Internet.(The GNU utilities, available from the Free SoftwareFoundation, are very popular.)You can thus do much more at a muchlower cost.
Not only are the applications often free, but someUnix versions are also free.Linux is a good example.Like the free applications, most free Unix versions are of excellent quality.Theyre maintained by volunteer programmers who want a powerful OS andare frustrated by the slow, bug-ridden OS development at some bigsoftware companies.
Unlike OSes such as Microsoft Windows and MacOS that are designed forcertain types of hardware, Unix runs on almost any kind,from tiny embedded systems to giant supercomputers.After you read this book, youll be ready to use many kindsof computers without learning a new OS for each one.
In general, Unix (especially without a windowingsystem) is less resource-intensive than other major operating systems.For instance, Linux will run happily on an old system with a x386microprocessor and let multiple users share the same computer.(Dont bother trying to use the latest versions of Microsoft Windows on asystem thats more than a few years old!)If you need a windowing system, Unix lets you choose frommodern feature-rich interfaces as well as from simple ones that need muchless system power.Anyone with limited resourceseducational institutions,organizations in developing countries, and so oncan use Unix todo more with less.
Much of the Internets development was done on Unixsystems.Many Internet web sites and Internet service providers use Unix becauseits so flexible and inexpensive.With powerful hardware, Unix really shines.
Versions of Unix
There are several versions of Unix.Until a few years ago, there were two main versions: the line of Unixreleases that started at AT&T (the latest is System V Release 4),and another from the University of California at Berkeley (thelast version was 4.4BSD).Some past and present commercial versions include SunOS, Solaris, SCO Unix,AIX, HP/UX, and ULTRIX.Freely available versions include Linux, NetBSD, and FreeBSD(FreeBSD is based on 4.4BSD-Lite).
Many Unix versions, including System V Release 4, merge earlierAT&T releases with BSD features.The POSIX standard for Unix-like operating systems defines asingle interface to Unix.Although advanced features differ among systems, you should be able touse this introductory handbook on any system.
When we write Unix in this book, we mean Unix and its versionsunless we specifically mention a particular version.
Interfaces to Unix
Unix can be used as it originally was, ontypewriter-like terminals, from a shell prompt on a command line.(See explains window system basics.)
Although a window system lets you use Unix without typing text at ashell prompt, well spend most of our time on that traditional command-lineinterface to Unix.Why?
Every Unix system has a command-line interface.If you know how to use the command line, youll always be able touse the system.
If you become a more-advanced Unix user, youll find that the commandline is actually much more flexible than a windowing interface.Unix programs are designed to use together from the commandlineas building blocksin an almost infinite number ofcombinations, to do an infinite number of tasks.No windowing system that weve seen (yet!) has this tremendous power.
You can launch and close windowing programs from the command line,but windowing programs generally cant affect a command line orprograms you run from one.
Once you learn to use the command line, you can use those sametechniques to write scripts .These little (or big!) programs automate jobs youd haveto do manually and repetitively with a window system(unless you understand how to program a window system, whichis usually a much harder job).See for a brief introduction to scripting.
In general, text-based interfaces are much easier than GUIsfor sight- and hearing-impaired users.
We arent saying that the command-line interface is right for everysituation.For instance, using the Webwith its graphics andlinksis usually easier with a GUI web browser.But the command line is the fundamental way to use Unix.Understanding it will let you work on any Unix system,with or without windows.
What This Handbook Covers
This book teachesbasic system utility commands to get you started with Unix.Instead of overwhelming you with lots of details, we want you to becomfortable in the Unix environment as soon as possible.So we cover a commands most useful features instead of describingall its options in detail.
We also assume that your computer works properly; someone hasstarted it, knows the procedure for turning the power off,and knows how to perform system maintenance.In other words, we dont cover Unix system administration.