You are previewing Unix for Mac OS X 10.4 Tiger: Visual QuickPro Guide.
O'Reilly logo
Unix for Mac OS X 10.4 Tiger: Visual QuickPro Guide

Book Description

 As Unix spreads its tentacles across users' desktops, more and more Mac users are starting to pop the hood and learn about the operating system that's at the root of it all. And there's no better way to conquer that fear than by consulting this Visual QuickPro Guide. Matisse Enzer, who wrote the first edition of this book, Unix for Mac OS X: Visual QuickPro Guide has completely updated this guide to reflect all that's new in Tiger's version of Unix. Readers will learn everything they need to know to make sense of the commands and technical jargon surrounding Unix. In the process they'll find out about useful utilities, editing and printing files, security, and more--all through simple, step-by-step instructions that break the learning process into manageable chunks. Throughout, users will find plenty of the tips and visual references that have become the hallmark of Peachpit's popular Visual QuickPro Guides. Unix for Mac OS X 10.4: Visual QuickPro Guide is perfect for any Mac user interested in learning about the Unix operating system.

Table of Contents

  1. Copyright
    1. Dedications
  2. Acknowledgments for the first edition
  3. Acknowledgments for the second edition
  4. i. Introduction
    1. Who Is This Book For?
    2. What’s in This Book?
      1. An introduction to Unix
      2. The basics of the Unix command-line interface
      3. Beyond the basics: Editing, permissions, and programming
      4. Using the Internet
      5. Intermediate skills: System administration and security
      6. Installing and configuring software
      7. Learning Darwin/Mac OS X Commands
    3. How to Use This Book
      1. Graphic conventions
        1. Keyboard symbols
        2. Bold
        3. Case sensitivity
        4. Darwin-specific features
    4. Requirements
      1. Adventurous and enthusiastic attitude
      2. Mac OS X 10.4 Tiger
      3. Be an administrator
      4. Have the Developer Tools installed
      5. Connection to the Internet
  5. 1. What Is Unix, and Why Is It Good?
    1. The Advantages of a Unix-Based Mac OS
      1. Stability
      2. Flexibility
      3. Openness
      4. Becoming a sophisticated user
    2. But First, a Little History
    3. How Mac OS X’s Unix Differs from Mac OS 9
    4. What You Can Do with Mac OS X and Unix
      1. Accommodating multiple users
      2. Preemptive multitasking
      3. Parents and children
      4. Files and the filesystem
      5. Files and security
      6. Folders are called directories
      7. File paths use / instead of :
      8. Get used to filename extensions
    5. How You Will Be Working with Unix
      1. Working from the command line
      2. Editing files from the command line
      3. Programming and scripting
      4. Shell scripts
      5. Perl
      6. Java
      7. C
      8. Interacting with other Unix machines
      9. Running servers
        1. Apache Web server
        2. Darwin Streaming Server
      10. Using other Unix applications
      11. Ruby on Rails
      12. Samba Windows file-sharing software
      13. SQL database engines
      14. Image manipulation with GIMP
      15. X Windows
      16. Blogs and content-management systems
      17. E-mail list management with Mailman or Majordomo
    6. Where to Find More
      1. The FreeBSD Ports Collection
      2. Mac OS X Apps
  6. 2. Using the Command Line
    1. Getting to the Command Line
      1. Other ways to get to the command line
    2. Understanding the Shell Prompt
    3. Using a Command
      1. The parts of a command line
      2. About the “command” part of the command line
      3. Your PATH—how the shell finds commands
      4. About command options
      5. About command arguments
      6. Operators and special characters in the command line
      7. Stopping commands
      8. Getting help for a command
    4. Using Common Commands
    5. About Commands, Processes, and Jobs
    6. About Spaces in the Command Line
    7. Wildcards
      1. More-specialized glob-patterns
    8. About Standard Input and Output
      1. Redirecting stdout
      2. Redirecting stderr
      3. Redirecting stdin
    9. Creating Pipelines of Commands
    10. Running a Command in the Background
    11. Opening Files from the Command Line
    12. Creating a Simple Unix Shell Script
  7. 3. Getting Help and Using the Unix Manual
    1. Using the Unix Manual
    2. Printing man Pages
    3. Using Commands’ Built-in Help
    4. Using the Web to Get Help
    5. Getting Help from Other People
  8. 4. Useful Unix Utilities
    1. Mac OS X–Specific Utilities
      1. open—“Double-click” files and directories from the command line
      2. osascript—Run AppleScript from the command line
      3. pbcopy and pbpaste—Command-line interface to the pasteboard (“clipboard”)
    2. File Compression and Archiving
      1. gzip
      2. gunzip
      3. tar
    3. File and Text Processing
      1. wc—Counting lines, words, and bytes
      2. sort—Alphabetical or numerical sorting
      3. uniq—Only one of each line
      4. cut
      5. awk
      6. sed
      7. textutil
      8. Perl
    4. Searching for Text Inside Files
      1. Using grep
      2. Using patterns in your search
      3. Testing regular expressions
      4. More rules and tools for building regex atoms
    5. Searching for Files
      1. Spotlight and mdfind
      2. locate
      3. find
      4. which
    6. Viewing and Editing Files
      1. Viewing files
      2. Editing files
    7. Sending E-mail
      1. mail
      2. Pine
    8. Network Analysis
      1. Network Utility
    9. Using the Internet
      1. telnet
      2. ssh
      3. scp
      4. ftp and sftp
      5. Lynx
  9. 5. Using Files and Directories
    1. Seeing the Whole File System
    2. Seeing Where You Are in the File System
    3. Understanding and Using Unix Filenames
      1. Having the shell type the filename for you
    4. Moving Around in the File System
    5. Seeing the Contents of Directories
      1. Hidden files
      2. Getting more information from ls
      3. Sorting the output of ls
    6. Viewing the Contents of Text Files
      1. Using a pager
      2. Seeing just the beginning or end of a file
    7. Creating Files and Directories
      1. Creating a file from command output
    8. Copying Files and Directories
    9. Renaming or Moving Files
    10. Deleting Files and Directories
    11. Getting Information About Files and Directories
      1. Using the ls command to get file information
      2. Displaying file metadata
      3. Discerning different types of files
      4. Working with Classic Mac metadata
    12. About Links (the Unix Version of Aliases)
      1. Using symbolic links
      2. Using hard links
  10. 6. Editing and Printing Files
    1. Editing Files with vi
      1. Super-quick start
      2. Starting vi
    2. About vi’s Two Modes
      1. Switching to command mode
      2. Switching to edit mode
    3. Navigating Using vi
      1. Basic cursor movement
      2. Navigating by searching for text
    4. Saving a File in vi
    5. Quitting vi
    6. Changing and Deleting Text
      1. Deleting text
      2. Changing text
      3. Copy and paste
      4. Search and replace
    7. emacs—an Editor Without Modes
    8. Printing Files
      1. How printing works on a Macintosh
      2. Printing from the command line
      3. Printing to AppleTalk printers
  11. 7. Configuring Your Unix Environment
    1. Finding Configuration Files
    2. Configuring Your Shell
    3. Environment Variables
      1. Changing your PATH
    4. Shell Aliases
      1. Shell functions
    5. Shell Settings
      1. Customizing your shell prompt
      2. Changing your umask
    6. Configuring vi
    7. Configuring Mac OS X Defaults from the Command Line
  12. 8. Working with Permissions and Ownership
    1. About Users and Groups
      1. Seeing all the users and groups on your system
    2. The Root User—Permission to Do Anything
    3. Understanding Permissions and Ownership
      1. The types of permission
      2. What permissions mean for files
      3. What Permissions Mean for Directories
      4. Examples of permissions
    4. Setting and Changing Permissions
      1. Changing permissions with symbolic modes
      2. Changing permissions with absolute modes
    5. Changing Ownership
    6. Default Permissions for File Creation
    7. Recognizing Permission Problems
      1. Using ACLs
  13. 9. Creating and Using Scripts
    1. Common Uses of Shell Scripts
      1. System-startup configuration files
      2. Automating common tasks
      3. Creating new utilities for your personal use
    2. Creating a Shell Script
      1. Running a script without using a path
    3. Using Variables
      1. Using a command inside a variable
      2. Using environment variables in a script
    4. Using Arguments
    5. Using Commands Within Commands
    6. Doing Arithmetic and Using Expressions
    7. Using Control Structures
      1. Using conditionals
      2. Using the if . . . then conditional
      3. Using the case conditional
      4. Using loops
    8. Getting User Input
    9. Creating and Using Functions
  14. 10. Connecting over the Internet
    1. About Hostnames
    2. Logging In to Another Unix Machine
      1. Secure connections using SSH
      2. Connecting using Telnet
      3. Using Telnet to test other systems
    3. Copying Files Across the Internet
      1. Preserving ACLs and other Extended Attributes
      2. Using scp
      3. Using FTP
      4. Retrieving files using curl
      5. Retrieving files using wget
      6. Synchronizing directories using rsync
      7. Using Lynx—a text-based Web browser
    4. Advanced Interactions
      1. Automated (unattended) file transfers
      2. Virtual private networks
      3. Sharing disks with other Unix machines
  15. 11. Introduction to System Administration
    1. About root
      1. The Mac OS X/Darwin approach to root
      2. sudo—the Mac OS X way of using root
      3. Other ways of becoming root
    2. Becoming Another User
    3. Keeping Backups
      1. Doing full and incremental backups from the command line
      2. Using ditto
    4. Managing User Accounts and Groups
      1. Adding and deleting users with System Preferences
      2. Managing passwords
      3. Changing a user’s login shell
      4. Tracking who uses the system
      5. Managing groups
    5. Monitoring System Usage
      1. Monitoring disk space
      2. Monitoring processes and load on your machine
      3. More about top
    6. Running Regularly Scheduled Commands
      1. Scheduling jobs using cron
      2. Controlling who uses cron
      3. About /etc/crontab
      4. Scheduling jobs using launchd
    7. System Log Files
    8. The Boot Sequence
    9. Creating New LaunchDaemons and StartupItems
      1. Looking at StartupItems
    10. Troubleshooting Tips
      1. Using the system log files
      2. Permission problems
      3. Dealing with “device full” problems
      4. Problems booting up
      5. The last resort
  16. 12. Security
    1. Security Checklist
    2. Physical Security
    3. Choosing Good Passwords
      1. How passwords are vulnerable
    4. Protecting Yourself from Internet Attacks
      1. Packet-sniffing attacks
      2. Attacks on services
      3. About ports and sockets
      4. Blocking access to ports
    5. Searching for Files That Make You root
    6. Keeping Up-to-Date
      1. Software Update
      2. Security news and announcements
    7. Monitoring Files for Changes
      1. Using md5sum to check for file changes
  17. 13. Installing Software from Source Code
    1. Installing from Source Code—the Basics
    2. Using Fink to Install Software
      1. Updating and removing packages with Fink
    3. Manually Installing from Source Code
    4. Installing Perl Modules
  18. 14. Installing and Configuring Servers
    1. Setting Your Machine’s Hostname
    2. Controlling the AppleShare Server
    3. Activating the SSH Server
    4. Configuring an Internet E-mail Server
      1. Forwarding e-mail to different addresses
    5. Activating the FTP Server
      1. About Passive vs. Active FTP
      2. Allowing anonymous FTP access
      3. Reducing the security risks from an FTP server
    6. Apache: A Web Server
      1. Activating Apache
      2. Adding a CGI script
    7. The MySQL Database Server
      1. Installing MySQL
      2. Configuring and starting MySQL
      3. Connecting to MySQL
      4. Creating a new database
      5. About the SQL WHERE clause
      6. Creating a script that uses SQL
    8. Even More Servers
  19. A. Darwin-only Unix Commands