EBOOK EXTRAS: v3.0.1 Downloads, Updates, Feedback TAKE CONTROL OF THE MAC COMMAND LINE WITH TERMINAL by JOE KISSELL $14.99 3rd EDITION Table of Contents Read Me First ............................................................... 6 Updates and More ............................................................. 6 Basics .............................................................................. 7 What’s New in Version 3.0.1 ............................................... 8 What’s New in the Third Edition ........................................... 9 Introduction .............................................................. 11 macOS Command Line Quick Start ............................. 14 Understand Basic Command-Line Concepts ............... 16 What’s Unix? ................................................................... 16 What’s a Command Line? ................................................. 17 What’s a Shell? ............................................................... 18 What’s Terminal? ............................................................. 19 What Are Commands, Arguments, and Flags? ..................... 21 What Changed in Catalina? ............................................... 25 Get to Know (and Customize) Terminal ..................... 33 Learn the Basics of Terminal ............................................. 33 Modify the Window .......................................................... 35 Open Multiple Sessions .................................................... 36 Change the Window’s Attributes ........................................ 37 Change Your Current Shell ................................................ 40 Set a Default Shell ........................................................... 41 Look Around .............................................................. 44 Discover Where You Are ................................................... 44 See What’s Here ............................................................. 45 Repeat a Command ......................................................... 47 Cancel a Command .......................................................... 49 Move into Another Directory ............................................. 49 Jump Home .................................................................... 52 Understand How Paths Work ............................................. 53 2 Understand the macOS Directory Structure ......................... 55 Use Tab Completion ......................................................... 57 Find a File ...................................................................... 59 View a Text File ............................................................... 61 Get Help ........................................................................ 63 Clear the Screen ............................................................. 64 End a Shell Session ......................................................... 65 Work with Files and Directories ................................. 66 Create a File ................................................................... 66 Create a Directory ........................................................... 67 Copy a File or Directory .................................................... 68 Move or Rename a File or Directory ................................... 70 Delete a File ................................................................... 72 Delete a Directory ........................................................... 73 Use Symbolic Links .......................................................... 74 Work with Programs .................................................. 76 Learn Command-Line Program Basics ................................. 76 Run a Program or Script ................................................... 79 Run a Program in the Background ...................................... 83 See What Programs Are Running ....................................... 84 Stop a Program ............................................................... 88 Edit a Text File ................................................................ 89 Create Your Own Shell Script ............................................ 92 Customize Your Defaults ........................................... 96 About Startup Files .......................................................... 96 Edit .zshrc or .bash_profile ............................................... 97 Create Aliases ................................................................. 97 Modify Your PATH ............................................................ 99 Change Your Prompt ........................................................ 99 Bring the Command Line into the Real World .......... 102 Get the Path of a File or Folder ........................................ 102 Open the Current Directory in the Finder .......................... 104 Open a Hidden Directory without Using Terminal ................ 104 3 Open the Current Folder in Terminal ................................. 105 Run a Shell Script from the Finder ................................... 106 Open a macOS App ........................................................ 107 Open a File in macOS ..................................................... 107 Log In to Another Computer .................................... 108 Start an SSH Session ..................................................... 108 Run Commands on Another Computer .............................. 110 End an SSH Session ....................................................... 111 Transfer Files with sftp or scp .......................................... 111 Work with Permissions ............................................ 115 Understand Permission Basics ......................................... 115 Change an Item’s Permissions ......................................... 119 Change an Item’s Owner or Group ................................... 121 Perform Actions as the Root User ..................................... 122 Learn Advanced Techniques .................................... 126 Pipe and Redirect Data ................................................... 126 Get a Grip on grep ......................................................... 130 Add Logic to Shell Scripts ............................................... 133 Install New Software ............................................... 144 Use Command Line Tools for Xcode .................................. 145 Install Unix Software from Scratch ................................... 147 Use a Package Manager .................................................. 151 Learn Command-Line Shortcuts ............................... 159 Terminal Tips and Shortcuts ............................................ 159 Zsh Tips and Shortcuts ................................................... 161 Command-Line Recipes ........................................... 168 Change Defaults ............................................................ 168 Perform Administrative Actions ........................................ 172 Modify Files .................................................................. 178 Work with Information on the Web ................................... 183 Manage Network Activities .............................................. 184 Do More with SSH .......................................................... 188 4 Work with Remote Macs ................................................. 191 Troubleshoot and Repair Problems ................................... 192 Get Help in Style ........................................................... 200 Do Other Random Tricks ................................................. 203 About This Book ...................................................... 211 Ebook Extras ................................................................. 211 About the Author and Publisher ....................................... 212 Also by Joe Kissell ................................................... 214 Copyright and Fine Print .......................................... 216 5 Read Me First Welcome to Take Control of the Mac Command Line with Terminal, Third Edition, version 3.0.1, published in March 2020 by alt concepts inc. This book was written by Joe Kissell and edited by Geoff Duncan. This book introduces you to the macOS command line environment, teaching you how to use the Terminal utility to accomplish useful, interesting tasks that are either difficult or impossible to perform in the graphical interface. Most of the examples work with 10.6 Snow Leopard and later, although a few techniques require more recent versions of macOS. If you want to share this ebook with a friend, we ask that you do so as you would with a physical book: “lend” it for a quick look, but ask your friend to buy a copy for careful reading or reference. Discounted classroom and user group copies are available. Copyright © 2020, alt concepts inc. All rights reserved. Updates and More You can access extras related to this ebook on the web (use the link in Ebook Extras, near the end; it’s available only to purchasers). On the ebook’s Take Control Extras page, you can: • Download any available new version of the ebook for free, or buy any subsequent edition at a discount. • Download various formats, including PDF, EPUB, and Mobipocket. (Learn about reading on mobile devices on our Device Advice page.) • Read the ebook’s blog. You may find new tips or information, as well as a link to an author interview. If you bought this ebook from the Take Control website, it has been added to your account, where you
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages216 Page
-
File Size-