Cover image for Learning Unix for Mac OS X Tiger

Book description

Beneath Mac OS X Tiger's easy-to-use Aqua interface lies a powerful Unix engine. Mac users know that Unix is at their fingertips, if only they knew how to access it. Learning Unix for Mac OS X Tiger provides Mac users with a user-friendly tour of the Unix world concealed beneath Mac OS X's hood and shows how to make the most use of the command-line tools. Thoroughly revised and updated for Mac OS X Tiger, this new edition introduces Mac users to the Terminal application and shows you how to navigate the command interface, explore hundreds of Unix applications that come with the Mac, and, most importantly, how to take advantage of both the Mac and Unix interfaces. Readers will learn how to:

  • Launch and configure the Terminal application

  • Customize the shell environment

  • Manage files and directories

  • Search with Spotlight from the command line

  • Edit and create text files with vi and Pico

  • Perform remote logins

  • Access internet functions, and much more

Learning Unix for Mac OS X Tiger is a clear, concise introduction to what you need to know to learn the basics of Unix on Tiger. If you want to master the command-line, this gentle guide to using Unix on Mac OS X Tiger is well worth its cover price.

Table of Contents

  1. Learning Unix for Mac OS X Tiger
    1. SPECIAL OFFER: Upgrade this ebook with O’Reilly
    2. About the Author
    3. Preface
      1. Who This Book Is For
      2. Who This Book Isn't For
      3. A Brief History of Unix
        1. Versions of Unix
        2. Interfaces to Unix
      4. How This Book Is Organized
      5. Conventions Used in This Book
      6. Using Code Examples
      7. Safari® Enabled
      8. Comments and Questions
      9. The Evolution of This Book
      10. Acknowledgments
    4. 1. Why Use Unix?
      1. 1.1. The Power of Unix
        1. 1.1.1. Batch Renames and Extracting File Lists
        2. 1.1.2. Finding Hidden Files
      2. 1.2. Thousands of Free Applications
        1. 1.2.1. Commands Included with Unix
        2. 1.2.2. Downloading Unix Software from the Web
      3. 1.3. Power Internet Connections
      4. 1.4. A Simple Guided (Unix) Tour
      5. 1.5. The 10 Most Common Unix Commands
    5. 2. Using the Terminal
      1. 2.1. Launching the Terminal
        1. 2.1.1. Syntax of a Unix Command
        2. 2.1.2. Exercise: Entering a Few Commands
        3. 2.1.3. Types of Commands
        4. 2.1.4. Changing the Terminal's Preferences
          1. 2.1.4.1. Shell
          2. 2.1.4.2. Processes
          3. 2.1.4.3. Emulation
          4. 2.1.4.4. Buffer
          5. 2.1.4.5. Display
          6. 2.1.4.6. Color
          7. 2.1.4.7. Window
          8. 2.1.4.8. Keyboard
        5. 2.1.5. Features of the Terminal
          1. 2.1.5.1. Secure Keyboard Entry
      2. 2.2. Customizing Your Terminal Session
        1. 2.2.1. Setting the Terminal's Title
        2. 2.2.2. Using AppleScript to Manipulate the Terminal
        3. 2.2.3. Working with .term Files
      3. 2.3. Working with the Terminal
        1. 2.3.1. The Shell Prompt
        2. 2.3.2. Entering a Command
          1. 2.3.2.1. date
          2. 2.3.2.2. who
        3. 2.3.3. Recalling Previous Commands
        4. 2.3.4. Completing File and Directory Names
        5. 2.3.5. Running Multiple Commands on the Command Line
        6. 2.3.6. Correcting a Command
        7. 2.3.7. Ending Your Session
        8. 2.3.8. Problem Checklist
      4. 2.4. Customizing the Shell Environment
        1. 2.4.1. Picking a Login Shell
        2. 2.4.2. Changing the Command Prompt
      5. 2.5. Advanced Shell Customization
        1. 2.5.1. Shell Configuration Settings
        2. 2.5.2. Creating Aliases
      6. 2.6. The Unresponsive Terminal
    6. 3. Exploring the Filesystem
      1. 3.1. The Mac OS X Filesystem
        1. 3.1.1. Your Home Directory
        2. 3.1.2. Your Working Directory
        3. 3.1.3. The Directory Tree
        4. 3.1.4. Absolute Pathnames
        5. 3.1.5. Relative Pathnames
        6. 3.1.6. Relative pathnames up
        7. 3.1.7. Changing Your Working Directory
          1. 3.1.7.1. pwd
          2. 3.1.7.2. cd
        8. 3.1.8. Files in the Directory Tree
      2. 3.2. Listing Files and Directories
        1. 3.2.1. The All-Powerful ls Command
        2. 3.2.2. Trying Out the ls Command
        3. 3.2.3. Using the -l option
        4. 3.2.4. File Permissions
        5. 3.2.5. Calculating File Size and Disk Space
        6. 3.2.6. Disk Space Available with df
        7. 3.2.7. Exercise: Exploring the Filesystem
      3. 3.3. Protecting and Sharing Files
        1. 3.3.1. File Access Permissions
        2. 3.3.2. Setting Permissions with chmod
          1. 3.3.2.1. Problem checklist
        3. 3.3.3. Changing Group and Owner
      4. 3.4. Changing Your Password
      5. 3.5. Superuser Privileges with sudo
      6. 3.6. Exploring External Volumes
    7. 4. File Management
      1. 4.1. File and Directory Names
      2. 4.2. File and Directory Wildcards
      3. 4.3. Looking Inside Files
        1. 4.3.1. cat
        2. 4.3.2. less
      4. 4.4. grep
      5. 4.5. Creating and Editing Files
        1. 4.5.1. Text Editors and Word Processors
        2. 4.5.2. The vi Text Editor
        3. 4.5.3. vi Basics
          1. 4.5.3.1. Searching in vi
          2. 4.5.3.2. Invoking external Unix commands
          3. 4.5.3.3. More powerful capabilities
        4. 4.5.4. A Simpler vi Alternative: Pico
        5. 4.5.5. The More Complex Option: Emacs
      6. 4.6. Managing Files
        1. 4.6.1. Creating Directories with mkdir
        2. 4.6.2. Copying Files
          1. 4.6.2.1. Problem checklist
          2. 4.6.2.2. Copying Mac files with resources
        3. 4.6.3. Renaming and Moving Files with mv
        4. 4.6.4. Removing Files and Directories
          1. 4.6.4.1. rm
          2. 4.6.4.2. rmdir
        5. 4.6.5. Working with Links
        6. 4.6.6. Compressing and Archiving Files
          1. 4.6.6.1. gzip
          2. 4.6.6.2. tar
        7. 4.6.7. Files on Other Operating Systems
    8. 5. Finding Files and Information
      1. 5.1. The Oddly Named grep Command
        1. 5.1.1. Useful grep Options
          1. 5.1.1.1. Matching context
          2. 5.1.1.2. Matches in color
          3. 5.1.1.3. Counting matches rather than showing matching lines
        2. 5.1.2. Working with Regular Expressions
      2. 5.2. Finding Files with locate
        1. 5.2.1. Building the locate Database
        2. 5.2.2. Using locate
      3. 5.3. Using Find to Explore Your Filesystem
        1. 5.3.1. Matching by File Size
        2. 5.3.2. Exploring find Permission Strings
        3. 5.3.3. Using find to Identify Recently Changed Files
        4. 5.3.4. find's Faithful Sidekick: xarg
        5. 5.3.5. Further Refinements to find
      4. 5.4. Shining a Light on Spotlight
        1. 5.4.1. Listing Spotlight Metadata with mdls
        2. 5.4.2. Finding Files with mdfind
        3. 5.4.3. Making Spotlight Useful
    9. 6. Redirecting I/O
      1. 6.1. Standard Input and Standard Output
        1. 6.1.1. Putting Text in a File
          1. 6.1.1.1. cat
      2. 6.2. Pipes and Filters
        1. 6.2.1. wc
        2. 6.2.2. tr
        3. 6.2.3. grep
        4. 6.2.4. head and tail
        5. 6.2.5. sort
        6. 6.2.6. uniq
        7. 6.2.7. Piping Output to a Pager
      3. 6.3. Printing
        1. 6.3.1. The Unix Way
          1. 6.3.1.1. lpstat
          2. 6.3.1.2. lp
          3. 6.3.1.3. pr
          4. 6.3.1.4. enscript
        2. 6.3.2. The AppleTalk Way
          1. 6.3.2.1. atlookup
          2. 6.3.2.2. at_cho_prn
          3. 6.3.2.3. atprint
          4. 6.3.2.4. atstatus
    10. 7. Multitasking
      1. 7.1. Running a Command in the Background
      2. 7.2. Checking on a Process
        1. 7.2.1. ps
        2. 7.2.2. top
      3. 7.3. Canceling a Process
        1. 7.3.1. kill
        2. 7.3.2. killall
      4. 7.4. Launching GUI Applications
        1. 7.4.1. open
        2. 7.4.2. Useful Starting Options for Use with open
        3. 7.4.3. Making open More Useful
    11. 8. Taking Unix Online
      1. 8.1. Remote Logins
        1. 8.1.1. Web and FTP Access
        2. 8.1.2. Remote Access to Other Unix Systems
      2. 8.2. Transferring Files
        1. 8.2.1. scp and rcp
        2. 8.2.2. FTP
          1. 8.2.2.1. Command-line ftp
          2. 8.2.2.2. SFTP: FTP to secure sites
          3. 8.2.2.3. FTP with a web browser
          4. 8.2.2.4. FTP with curl
          5. 8.2.2.5. FTP from the Finder
          6. 8.2.2.6. Other FTP solutions
        3. 8.2.3. Transferring Files with Your iDisk
        4. 8.2.4. Easy Shortcuts with Connect to Server
      3. 8.3. Practice
    12. 9. Of Windows and X11
      1. 9.1. X11
        1. 9.1.1. Installing X11
        2. 9.1.2. Using X11
        3. 9.1.3. Customizing X11
          1. 9.1.3.1. Customizing X11's Applications menu
      2. 9.2. X11 and the Internet
        1. 9.2.1. Remote X11 Access to Your Mac
        2. 9.2.2. Opening a Private Network
        3. 9.2.3. X11 Access to Other Computers
    13. 10. Open Source Software Via Fink
      1. 10.1. Installing Fink
        1. 10.1.1. Listing Available Packages
        2. 10.1.2. Installing Packages
      2. 10.2. Using FinkCommander
      3. 10.3. Some Picks
        1. 10.3.1. Browsing the Web with Lynx
          1. 10.3.1.1. Downloading a web page with Lynx
        2. 10.3.2. Electronic Mail with Pine
          1. 10.3.2.1. Configuring Pine
          2. 10.3.2.2. Configuring Pine to send and receive email
          3. 10.3.2.3. Reading email with Pine
          4. 10.3.2.4. Sending email with Pine
        3. 10.3.3. Editing Graphics with the GIMP
    14. 11. Where to Go from Here
      1. 11.1. Documentation
        1. 11.1.1. The Terminal's Help Menu
        2. 11.1.2. The man Command
        3. 11.1.3. Documentation on the Internet
        4. 11.1.4. Books
      2. 11.2. Customizing your Unix Experience
        1. 11.2.1. Shell Aliases and Functions
        2. 11.2.2. Programming
          1. 11.2.2.1. Shell scripts
          2. 11.2.2.2. Turning shell scripts into AppleScript droplets
        3. 11.2.3. Perl, Python, and Ruby
        4. 11.2.4. C and C++
    15. About the Author
    16. Colophon
    17. SPECIAL OFFER: Upgrade this ebook with O’Reilly