Table of Contents
To Hope, for loving me anyway.
Thomas Myer
About the Authors
Thomas Myer currently resides in Austin, Texas, where he runs Triple Dog Dare Media, a consulting group that builds CodeIgniter applications, writes technical documentation and copy, and works as a systems analyst for hire. He is the author of Lead Generation on the Web, No Nonsense XML Web Development with PHP, Professional CodeIgniter, and From Geek to Peak: Your First 365 Days as a Technical Consultant, as well as dozens of articles on technology and business. If you have any feedback on this book, or wish to discuss anything related to Web development, writing, or marketing, contact him via his website at www.tripledogs.com.
Christopher Negus is the author of the Fedora and Red Hat Linux Bibles, as well as BSD UNIX Toolbox. Chris served for eight years on development teams for the UNIX operating system at AT&T, where UNIX was created and developed.
Franois Caen, through his company Turbosphere LLC, hosts and manages business application infrastructures, 95 percent of which run on Linus systems.
Credits
Acquisitions Editor
Jenny Watson
Development Editor
William Bridges
Technical Editor
Brian Joseph
Production Editor
Daniel Scribner
Copy Editor
Luann Rouff
Editorial Manager
Mary Beth Wakefield
Production Manager
Tim Tate
Vice President and Executive Group
Publisher
Richard Swadley
Vice President and Executive Publisher
Barry Pruett
Associate Publisher
Jim Minatel
Project Coordinator, Cover
Lynsey Stanford
Compositor
Jeff Lytle, Happenstance Type-O-Rama
Proofreader
Publication Services, Inc.
Indexer
Melanie Belkin
Acknowledgments
I would like to acknowledge all the work done by the developers, project managers, analysts, and others on the Mac OS X team. Theyve created something wonderful in this stable, secure, and speedy little OS. Ive had a great deal of fun and joy working with it, which is more than most people can say when it comes to computing.
Special thanks to Jenny Watson for being such a joy to work with. Even more thanks to Bill Bridges, who took my calls, answered my questions, and kept things moving forward even when it looked like we were going to become permanently stuck in the weeds.
I wouldnt have been able to work on this book if it werent for my ever-loving and ever-patient wife, Hope. Your name says it allyou fill my life with hope and joy and love andwell, everything. Thanks for being such a champ.
Thomas Myer
Introduction
Mac OS X UNIX Toolbox is loosely based on the BSD UNIX Toolbox written by Chris Negus and Franois Caen. When I was asked by Wiley to extend what they had done into the world of Mac OS X, I heartily agreed to do so, partly because the original was such an excellent resource.
From the very beginning, I decided to keep to the spirit and structure of the original title as much as I could. Thankfully, about 90 percent of what you experience UNIX-WISE on Mac OS X is the same as on BSD or Linux environments, so I was able, for the most part, to abide by this agreement. In some cases, though, I had to nip and tuck a few sections; in others, I had to add a bit back in.
At the end of the day, what you hold is a handbook with more than 1,000 specific command lines to help you become a Mac OS X power user. Whether you are a systems administrator or desktop user, the book will show you commands to create file systems, troubleshoot networks, lock down security, and dig out almost anything you care to know about your Mac OS X system.
Of course, Mac OS X being what it is, not everything in this book is about the command line (although most of it is). In some cases, I show you not only how to do things on the venerated command line, but also how to take advantage of the Mac OS X GUI. Either way, you learn how to leverage UNIX to do your job.
Who Should Read This Book
This book is for anyone who wants to access the power of a Mac OS X system as a systems administrator or user. You may be a free and open-source software (FOSS) enthusiast, a UNIX professional, or possibly a computer professional who is increasingly finding the Windows systems in your data center supplanted by BSD, Linux, and Mac OS X systems.
The bottom line is that you want to find quick and efficient ways of getting Mac OS X systems working at peak performance. These may be a few desktop systems at work, a file and print server at your school, or a home web server that youre setting up mostly for fun.
In the best case, you should already have some experience with BSD, Linux, or other UNIX-like systems. However, if you are a computer professional with skills managing other types of operating systems, such as Windows, you should be able to leverage your knowledge and use the specific commands covered in the book.
What This Book Covers
I assume that youre new to Mac OS X, but that youre coming to that platform from some other UNIX platform, such as Linux or BSD. In other words, I assume that you know something about the command line, but dont yet know the Mac OS X Way. I will show you that way, pointing out how to get to the shell, how to run commands, and how things (most of which you may take for granted) have changed from one flavor of UNIX (i.e., the one youre used to) to Mac OS Xs flavor of UNIX. The book will then supplement that knowledge with information you need to do the following activities:
Get softwareMac OS X can be extended using various package managers. Using these package managers, you can install both binary packages and source code. I will introduce you to Fink, which youll use to find, download, install, and manage software from the command line.
Access applicationsFind whats available from the Mac OS X distribution.
Use the shellFind neat techniques and tips for using the shell.
Play with GUI toolsUse the command-line options to run products such as iTunes, TextEdit, and Safari.
Work with filesUse, manipulate, convert, and secure a wide range of file types in Mac OS X.
Administer file systemsAccess, format, partition, and monitor your file storage hardware (hard disks, CD/DVD drives, floppy disks, USB flash drives, and so on). Then create, format, and check the file systems that exist on those hardware devices.
Back up and restore dataUse simple commands to gather, archive, and compress your files into efficient backup archives. Then store those archives locally or on remote computers.
Work with processesList running processes in a variety of ways, such as by CPU use, processor use, or process ID. Then change running processes to have them run in the background or foreground. Send signals to processes to have them reread configuration files, stop and resume processing, or stop completely (abort).
Manage the system