O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Learning Unix for OS X

Book Description

Think your Mac is powerful now? Author Dave Taylor shows you how to get much more from your system by tapping into Unix, the robust operating system concealed beneath OS X’s beautiful user interface. Mountain Lion puts more than a thousand Unix commands at your fingertips - for finding and managing files, remotely accessing your Mac from other computers, and using a variety of freely downloadable open source applications. Take a friendly tour of the Unix command line and 50 of the most useful utilities, and quickly learn how to gain real control over your Mac.

  • Get your Mac to do exactly what you want, when you want
  • Make changes to your Mac’s filesystem and directories
  • Use Unix’s find, locate, and grep commands to locate files containing specific information
  • Create unique "super-commands" to perform tasks that you specify
  • Run multiple Unix programs and processes at the same time
  • Install the X Window system and get a quick tour of the best X11 applications
  • Learn how to take even greater advantage of Unix on your Mac

Table of Contents

  1. 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® Books Online
    8. How to Contact Us
    9. The Evolution of This Book
    10. Acknowledgments
  2. 1. Why Use Unix?
    1. The Power of Unix
      1. Batch Renames and Extracting File Lists
      2. Finding Hidden Files
    2. Folders or Directories?
    3. Thousands of Free Applications
      1. Power Internet Connections
    4. Commands Included with Unix
      1. Displaying All Unix Commands
      2. The 10 Most Common Unix Commands
    5. A Simple Guided (Unix) Tour
  3. 2. Using the Terminal
    1. Launching the Terminal
      1. Syntax of a Unix Command
      2. Exercise: Entering a Few Commands
      3. Types of Commands
      4. Changing the Terminal’s Preferences
        1. Startup
        2. Settings
      5. Features of the Terminal
        1. Secure Keyboard Entry
        2. More cool Terminal features
    2. Customizing Your Terminal Session
      1. Setting the Terminal’s Title
      2. Using AppleScript to Manipulate the Terminal
      3. Working with .terminal Files
    3. Working with the Terminal
      1. The Shell Prompt
      2. Entering a Command
        1. date
        2. who
      3. Recalling Previous Commands
      4. Completing File and Directory Names
      5. Running Multiple Commands on the Command Line
      6. Correcting a Command
      7. Ending Your Session
      8. Problem Checklist
    4. Customizing the Shell Environment
      1. Picking a Login Shell
      2. Changing the Command Prompt
    5. Advanced Shell Customization
      1. Shell Configuration Settings
      2. Creating Aliases
    6. The Unresponsive Terminal
  4. 3. Exploring the Filesystem
    1. The OS X Filesystem
      1. Your Home Directory
      2. Your Working Directory
      3. The Directory Tree
      4. Absolute Pathnames
      5. Relative Pathnames
        1. Relative pathnames up
      6. Changing Your Working Directory
        1. pwd
        2. cd
      7. Files in the Directory Tree
    2. Listing Files and Directories
      1. The All-Powerful ls Command
      2. Trying Out the ls Command
      3. Using the -l Option
      4. File Permissions
    3. Calculating File Size and Disk Space
      1. Calculating Available Disk Space
      2. Exercise: Exploring the Filesystem
    4. Protecting and Sharing Files
      1. File Access Permissions
      2. Setting Permissions with chmod
        1. Problem checklist
      3. Changing the Group and Owner
    5. Changing Your Password
    6. Superuser Privileges with sudo
    7. Exploring External Volumes
  5. 4. File Management
    1. File and Directory Names
    2. File and Directory Wildcards
    3. Looking Inside Files
      1. cat
      2. less
      3. grep
    4. Creating and Editing Files
      1. Text Editors and Word Processors
      2. The vi Text Editor
      3. vi Basics
        1. Searching in vi
        2. Invoking external Unix commands
        3. More powerful capabilities
      4. A Simpler vi Alternative: Pico
      5. The More Complex Option: Emacs
    5. Managing Files
      1. Creating Directories with mkdir
      2. Copying Files
        1. Problem checklist
      3. Renaming and Moving Files with mv
      4. Removing Files and Directories
        1. rm
        2. rmdir
      5. Working with Links
      6. Compressing and Archiving Files
        1. gzip
        2. tar
      7. Files on Other Operating Systems
  6. 5. Finding Files and Information
    1. The Oddly Named grep Command
      1. Useful grep Options
        1. Matching context
        2. Matches in color
        3. Counting matches rather than showing matching lines
      2. Working with Regular Expressions
    2. Finding Files with locate
      1. Using locate
    3. Using find to Explore Your Filesystem
      1. Matching by File Size
      2. Exploring find Permission Strings
      3. Using find to Identify Recently Changed Files
      4. find’s Faithful Sidekick: xargs
      5. Further Refinements to find
    4. Shining a Light on Spotlight
      1. Listing Spotlight Metadata with mdls
      2. Finding Files with mdfind
      3. Making Spotlight Useful
  7. 6. Redirecting I/O
    1. Standard Input and Standard Output
      1. Putting Text in a File
        1. cat
    2. Pipes and Filters
      1. wc
      2. tr
      3. grep
      4. head and tail
      5. sort
      6. uniq
      7. Piping Output to a Pager
    3. Printing
      1. The Unix Way
        1. lpstat
        2. lp
        3. pr
  8. 7. Multitasking
    1. Running a Command in the Background
    2. Checking on a Process
      1. ps
      2. top
    3. Canceling a Process
      1. kill
      2. killall
    4. Launching GUI Applications
      1. open
      2. Useful Starting Options for Use with open
      3. Making open More Useful
  9. 8. Taking Unix Online
    1. Remote Logins
      1. Web Access
      2. Remote Access to Other Unix Systems
    2. Transferring Files
      1. scp and rcp
      2. FTP
        1. Command-line ftp
        2. sftp: ftp to secure sites
        3. FTP with a web browser
        4. FTP with curl
        5. FTP from the Finder
        6. Other FTP solutions
      3. Easy Shortcuts with New Remote Connection
  10. 9. Of Windows and X11
    1. X11
      1. Using X11
      2. Differences Between OS X and X11
      3. Customizing X11
        1. Customizing X11’s Applications menu
    2. GIMP, the X11 Graphics Editor
  11. 10. Where to Go from Here
    1. Documentation
      1. The man Command
      2. Documentation on the Internet
      3. Books
    2. Customizing Your Unix Experience
      1. Shell Aliases and Functions
      2. Programming
        1. Shell scripts
        2. Turning shell scripts into AppleScript droplets
      3. Perl, Python, and Ruby
      4. C and C++
  12. Index
  13. About the Author
  14. Colophon
  15. Copyright