Take Control of the Mac Command Line with Terminal, Second Edition
Take Control of the Mac Command Line with Terminal, Second Edition
Minimum price
Suggested price
Take Control of the Mac Command Line with Terminal, Second Edition

Last updated on 2016-02-02

About the Book

If you’ve ever thought you should learn to use the Unix command line that underlies Mac OS X, or felt at sea when typing commands into Terminal, Joe Kissell is here to help! With this 167-page ebook, you’ll become comfortable working on the Mac’s command line, starting with the fundamentals and adding more advanced topics as your knowledge increases.

Joe includes numerous real-life “recipes” for tasks that are best done from the command line, as well as directions for working with permissions, carrying out grep-based searches, creating shell scripts, and installing Unix software.

The book begins by teaching you these core concepts:

  • The differences between Unix, a command line, a shell, and Terminal
  • Exactly how commands, arguments, and flags work
  • The basics of Terminal’s interface and how to customize it

Next, it’s on to the command line, where you’ll learn:

  • How to navigate your Mac’s file system
  • Basic file management: creating, copying, moving, renaming, opening, viewing, and deleting files
  • Creating symbolic links
  • The types of command-line programs
  • How to start and stop a command-line program
  • How to edit a text file in nano
  • What a profile is, why it’s cool, and how to customize yours
  • The importance of your PATH and how to change it, if you need to
  • How to get help (Joe goes way beyond telling you to consult the man pages)

You’ll extend your skills as you discover how to:

  • Create basic shell scripts to automate repetitive tasks.
  • Make shell scripts that have variables, user input, conditional statements, loops, and math.
  • See which programs are running and what system resources they’re consuming.
  • Quit programs that refuse to quit normally.
  • Enable the command line to interact with the Finder.
  • Control another Mac via its command line with ssh.
  • Understand and change an item’s permissions, owner, and group.
  • Run commands as the root user using sudo.
  • Handle output with pipe (|) or redirect (>).
  • Use grep to search for text patterns in files and filter output.
  • Install new command-line software from scratch or with a package manager.

Questions answered include:

  • Which shell am I using, and how can I change my default shell?
  • How do I quickly figure out the path to an item on my Mac?
  • How can I customize my Terminal window so I can see man pages behind it?
  • How can I make a shortcut to avoid retyping the same long command?
  • Is there a trick for entering a long path quickly?
  • What should I say when someone asks if I know how to use vi?
  • How do I change my prompt to suit my mood or needs?
  • What is Command Line Tools for Xcode?
  • When it comes to package managers, which one should I use?

Finally, to help you put it all together, the book showcases over 50 real-world “recipes” that combine commands to perform useful tasks, such as listing users who’ve logged in recently, copying text from Quick Look, using a separate FileVault password, figuring out why a disk won’t eject, copying the source code of a Web page, determining which apps have open connections to the Internet, flushing the DNS cache, finding out why a Mac won’t sleep, sending an SMS message, and deleting stubborn items from the Trash.

About the Author

Joe Kissell
Joe Kissell

Joe Kissell has written numerous books about technology, including many popular Take Control ebooks, with an emphasis on Apple products. He's also Senior Editor of TidBITS and a Senior Contributor to Macworld, and previously spent ten years in the Mac software industry.

Table of Contents

  • Read Me First
    • Updates and More
    • Basics
    • What’s New in Version 2.1
    • What Was New in the Second Edition
  • Introduction
  • Mac OS X Command Line Quick Start
  • Understand Basic Command-Line Concepts
    • What’s Unix?
    • What’s a Command Line?
    • What’s a Shell?
    • What’s Terminal?
    • What Are Commands, Arguments, and Flags?
  • Get to Know (and Customize) Terminal
    • Learn the Basics of Terminal
    • Modify the Window
    • Open Multiple Sessions
    • Change the Window’s Attributes
    • Set a Default Shell
  • Look Around
    • Discover Where You Are
    • See What’s Here
    • Repeat a Command
    • Cancel a Command
    • Move into Another Directory
    • Jump Home
    • Understand How Paths Work
    • Understand Mac OS X’s File System
    • Use Tab Completion
    • Find a File
    • View a Text File
    • Get Help
    • Clear the Screen
    • End a Shell Session
  • Work with Files and Directories
    • Create a File
    • Create a Directory
    • Copy a File or Directory
    • Move or Rename a File or Directory
    • Delete a File
    • Delete a Directory
    • Use Symbolic Links
  • Work with Programs
    • Learn Command-Line Program Basics
    • Run a Program or Script
    • Run a Program in the Background
    • See What Programs Are Running
    • Stop a Program
    • Edit a Text File
    • Create Your Own Shell Script
  • Customize Your Profile
    • How Profiles Work
    • Edit .bash_profile
    • Create Aliases
    • Modify Your PATH
    • Change Your Prompt
  • Bring the Command Line into the Real World
    • Get the Path of a File or Folder
    • Open the Current Directory in the Finder
    • Open a Hidden Directory without Using Terminal
    • Open the Current Folder in Terminal
    • Open a Mac OS X Application
    • Open a File in Mac OS X
  • Log In to Another Computer
    • Start an SSH Session
    • Run Commands on Another Computer
    • End an SSH Session
    • Transfer Files with sftp or scp
  • Work with Permissions
    • Understand Permission Basics
    • Change an Item’s Permissions
    • Change an Item’s Owner or Group
    • Perform Actions as the Root User
  • Learn Advanced Techniques
    • Pipe and Redirect Data
    • Get a Grip on grep
    • Add Logic to Shell Scripts
  • Install New Software
    • Use Command Line Tools for Xcode
    • Install Unix Software from Scratch
    • Use a Package Manager
  • Command-Line Recipes
    • Change Defaults
    • Perform Administrative Actions
    • Modify Files
    • Work with Information on the Web
    • Manage Network Activities
    • Work with Remote Macs
    • Troubleshoot and Repair Problems
    • Get Help in Style
    • Do Other Random Tricks
  • About This Book
    • Ebook Extras
    • About the Author
    • About the Publisher
  • Copyright and Fine Print

About the Publisher

This book is published on Leanpub by Take Control Books

With its Take Control series of ebooks, alt concepts inc. covers a wide range of technology topics, with a special emphasis on Apple products and services. Our catalog comprises over 100 titles, and we’ve sold hundreds of thousands of ebooks in the process of providing expert advice and technical know-how to tens of thousands of readers around the world. Join us today!

The Leanpub 45-day 100% Happiness Guarantee

Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Write and Publish on Leanpub

Authors, publishers and universities use Leanpub to publish amazing in-progress and completed books and courses, just like this one. You can use Leanpub to write, publish and sell your book or course as well! Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks. Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. It really is that easy.

Learn more about writing on Leanpub