This section describes the information that each chapter covers and explains how that information can help you take advantage of the power of Mac OS X. You may want to review the table of contents for more detail. Chapter 1 Welcome to Mac OS X Presents background information on Mac OS X. This chapter covers the history of Mac OS X, explains the connection between OS X and open-source software including GNU and BSD software, and discusses some of OS X's important features that distinguish it from other operating systems, including other versions of UNIX. Part I: The Mac OS X Operating System Tip: Experienced users may want to skim Part I If you have used a UNIX-like system before, you may want to skim or skip some or all of the chapters in Part I. All readers should take a look at "Conventions Used in This Book" (page 18), which explains the typographic conventions that this book uses, and "Getting the Facts: Where to Find Documentation" (page 27), which points you toward both local and remote sources of Mac OS X documentation. Part I introduces UNIX on a Mac OS X system and gets you started using it from the command line. Chapter 2 Getting Started Explains the typographic conventions this book uses to make explanations clearer and easier to read. This chapter provides basic information and explains how to log in, display a shell prompt, give OS X commands using the shell, and find system documentation. Chapter 3 The Mac OS X Utilities Explains the command line interface (CLI) and briefly introduces more than 30 command line utilities. Working through this chapter gives you a feel for UNIX and introduces some of the tools you will use day in and day out. Chapter 3 also introduces pipes, which allow you to combine utilities on the command line. The utilities covered in this chapter include grep, which searches through files for strings of characters; ditto, which copies files and directories (folders); tar, which creates archive files that can hold many other files; bzip2 and gzip, which compress files so that they take up less space on disk and allow you to transfer them over a network more quickly; and diff, which displays the differences between two text files.
Chapter 4 The Mac OS X Filesystem Discusses the OS X hierarchical filesystem from a UNIX perspective, covering files, filenames, pathnames, working with directories (folders), access permissions, and hard and symbolic links. This chapter also discusses extended attributes including file forks, attribute flags, type codes, creator codes, and Access Control Lists (ACLs). Understanding the filesystem allows you to organize your data so that you can find information quickly. It also enables you to share some of your files with other users while keeping other files private. Chapter 5 The Shell Explains how to use shell features to make your work faster and easier. All of the features covered in this chapter work with both the Bourne Again Shell (bash) and the TC Shell (tcsh). This chapter discusses Using command line options to modify the way a command works; How a minor change in a command line can redirect input to a command to come from a file instead of from the keyboard; How to redirect output from a command to go to a file instead of to the screen; Using pipes to send the output of one utility directly to another utility so that you can solve problems right on the command line; Running programs in the background so that you can work on one task while UNIX is working on a different one; and Using the shell to generate filenames to save you time spent on typing and help you when you do not recall the exact name of a file.
Part II: The Editors Part II covers two classic, powerful UNIX command line text editors. Mac OS X includes the vim text editor, an "improved" version of the widely used vi editor, as well as the popular GNU emacs editor. Text editors enable you to create and modify text files that can hold programs, shell scripts, memos, and input to text formatting programs. Chapter 6 The vim Editor Starts with a tutorial on vim and then explains how to use many of the advanced features of vim, including special characters in search strings, the General-Purpose and Named buffers, parameters, markers, and execution of commands from vim. The chapter concludes with a summary of vim commands. Chapter 7 The emacs Editor Opens with a tutorial and then explains many of the features of the emacs editor as well as how to use the META, ALT, and ESCAPE keys. The chapter also covers key bindings, buffers, and incremental and complete searching for both character strings and regular expressions. In addition, it details the relationship between Point, the cursor, Mark, and Region. It also explains how to take advantage of the extensive online help facilities available from emacs. Other topics covered include cutting and pasting, using multiple windows and frames, and working with emacs modesspecifically C mode, which aids programmers in writing and debugging C code. Chapter 7 concludes with a summary of emacs commands. Part III: The Shells Part III goes into more detail about bash and introduces the TC Shell (tcsh). Chapter 8 The Bourne Again Shell Picks up where Chapter 5 leaves off, covering more advanced aspects of working with a shell. For examples it uses the Bourne Again Shellbash, the shell used almost exclusively for system shell scripts. Chapter 8 describes how to Use shell startup (preference) files, shell options, and shell features to customize your shell; Use job control to stop jobs and move jobs from the foreground to the background, and vice versa; Modify and reexecute commands using the shell history list; Create aliases to customize commands; Work with user-created and keyword variables in shell scripts; Set up functions, which are similar to shell scripts but can execute more quickly; Write and execute simple shell scripts; and Redirect error messages so that they go to a file instead of the screen.
Chapter 9 The TC Shell Describes tcsh and covers features that are common to and differ between bash and tcsh. This chapter explains how to Run tcsh and change your default shell to tcsh; Redirect error messages so that they go to files instead of to the screen; Use control structures to alter the flow of control within shell scripts; Work with tcsh array and numeric variables; and Use shell builtin commands.
Part IV: More About Mac OS X Chapter 10 Networking Discusses networks, network security, and the Internet. This chapter Covers types of networks, subnets, protocols, addresses, hostnames, and various network utilities; Discusses distributed computing including the client/server model; and Describes briefly some of the servers you can use on a network.
Chapter 11 System Maintenance Discusses core system concepts including Superuser and the use of sudo as well as system operation. This chapter Provides general information about how to set up a server, including information on property list and other configuration files; Describes how the launchd superserver works; Discusses the NetInfo database and delves into how it differs from the classic UNIX system databases; Describes briefly many important standard directories and files; Explains how to set up a chroot jail; and Describes how DHCP works.
Part V: Programming Tools Part V covers programming under Mac OS X. It discusses the C programming environment, the use of bash as a programming language, and ways to write programs using awk and sed. Chapter 12 Programming Tools Introduces Mac OS X's exceptional programming environment. This chapter focuses on the traditional UNIX command line development environment because this environment is the one you will likely have to work in with free software developed for UNIX systems. This chapter Discusses the Carbon, Cocoa, and UNIX APIs; Explains how to invoke the GNU gcc compiler; Describes how to use make to keep a set of programs up-to-date; Explains how to debug a C program using gdb; Describes how to work with shared libraries; Explains how to set up and use CVS to manage and track program modules in a software development project; and Discusses system calls and explains how you can use them to initiate kernel operations.
Chapter 13 Programming the Bourne Again Shell Once you have mastered the basics of OS X, you can use your knowledge to build more complex and specialized programs, by using the shell as a programming language. Chapter 13 shows you how to use bash to write advanced shell scripts. It discusses Control structures such as if...then...else and case; Variables, including locality of variables; Arithmetic and logical (Boolean) expressions; and Some of the most useful shell builtin commands, including exec, trap, and getopts.
Chapter 13 poses two complete shell programming problems and then shows you how to solve them step by step. The first problem uses recursion to create a hierarchy of directories. The second problem develops a quiz program and shows you how to set up a shell script that interacts with a user and how the script processes data. (The examples in Part VI also demonstrate many features of the utilities you can use in shell scripts.) Chapter 14 The awk Pattern Processing Language Explains how to write programs using the powerful awk language that filter data and write reports. The advanced programming section describes the powerful getline statement, which gives you better control over bringing data into awk and the system statement, which allows you to run external commands from inside an awk program. Chapter 15 The sed Editor Describes sed, the noninteractive stream editor that finds many applications as a filter within shell scripts. This chapter discusses how to use sed's buffers to write simple yet powerful programs and includes many examples. Part VI: Command Reference Mac OS X includes hundreds of utilities. Chapters 14 and 15 as well as Part VI provide extensive examples of the use of more than 90 of the most important utilities with which you can solve problems without resorting to programming in C. If you are already familiar with UNIX, this part of the book will be a valuable, easy-to-use reference. If you are not an experienced user, it will serve as a useful supplement while you are mastering the earlier sections of the book. Although the descriptions of the utilities in Chapters 14 and 15 and Part VI are presented in a format similar to that used by the Mac OS X manual (man) pages, they are much easier to read and understand. These utilities were chosen because you will work with them day in and day out (for example, ls and cp), because they are powerful tools that are especially useful in shell scripts (sort, paste, and test), because they help you work with your Mac OS X system (ps, kill, sysctl, and GetFileInfo), or because they enable you to communicate with other systems (ssh, scp, and ftp). Part VI also covers several utilities that were developed by Apple for OS Xthey are not found on other UNIX systems (nidump, otool, launchctl, and plutil). Each utility description includes complete explanations of its most useful options. The "Discussion" and "Notes" sections present tips and tricks for using the utility to full advantage. The "Examples" sections demonstrate how to use these utilities in real life, alone and together with other utilities to generate reports, summarize data, and extract information. Take a look at the "Examples" sections for awk (more than 20 pages, starting on page 609), ftp (page 738), and sort (page 837) to see how extensive these sections are. Part VII: Appendixes Part VII includes the appendixes and the glossary. Appendix A Regular Expressions Explains how to use regular expressions to take advantage of the hidden power of UNIX. Many utilities, including grep, sed, vim, and awk, accept regular expressions in place of simple strings of characters. A single regular expression can match many simple strings. Appendix B Help Details the steps typically used to solve the problems you may encounter with a Mac OS X/UNIX system. This appendix also includes many links to Web sites that offer documentation, useful UNIX information, mailing lists, and software. Appendix C Mac OS X for UNIX Users This appendix is a brief guide to Mac OS X features and quirks that may be unfamiliar to users who have been using other UNIX or UNIX-like systems. Glossary Defines more than 500 terms that pertain to the use of Mac OS X/UNIX. The index helps you quickly find the information you want. |