TidBITS readers likely know that macOS is based on Unix and that opening the Terminal enables them to interact with files, folders, and apps at the command line. For the majority of Mac users, the command line is largely a curiosity that goes unexplored. On the other end of the spectrum are those who are fluent in Unix-like operating systems and spend more time at the command line than they do in graphical apps. Many of us fall somewhere in the middle, aware of the command line’s power but more comfortable in native Mac apps. That’s certainly true of me—I can use grep at the command line if necessary, but I’ll rely on BBEdit instead if at all possible.
If you’re like me, perhaps the most important point to be made about the command line is that it’s seldom an either/or question. Most of the time, when I drop to the command line to do something, it’s because it would be difficult or impossible to accomplish the task using the Finder, BBEdit, or any other native Mac app. That’s not to say that there isn’t a vast amount of overlap. Just as you know how to traverse the filesystem in the Finder by double-clicking folders and opening files, you need to know those basics at the command line as well.
Two books, Joe Kissell’s just-updated Take Control of the Mac Command Line with Terminal ($14.99 from Take Control Books) and Armin Briegel’s new macOS Terminal and Shell ($19.99 on Apple Books), promise to help you become more capable at the command line, whether you’re just starting out or would benefit from admin-level chops.
(Full disclosure: Joe originally wrote Take Control of the Mac Command Line with Terminal when Tonya and I owned Take Control Books, and I had significant input into its development. However, we sold Take Control to Joe in May 2017 and no longer have any financial interest in the book or the company. And, although I don’t know Armin Briegel well, we periodically see each other at conferences, and many years ago at MacTech, he graciously wrote an AppleScript for me that I continue to use to populate my calendar with Monday events for each numbered TidBITS issue.)
Unsurprisingly, both books cover much of the same ground at the start. It’s that overlap problem—everyone needs to understand the basics of working in Terminal, entering commands, navigating the filesystem, reading the man pages, and so on. After that, the books diverge a bit.
Take Control of the Mac Command Line with Terminal
Take Control of the Mac Command Line with Terminal takes the high road, with Joe Kissell employing his friendly, practical style to explain how to create shell scripts to automate tasks (complete with variables, user input, conditional statements, loops, and math), control other Macs via ssh, get started with key Unix techniques like piping and redirection, use grep to search for text patterns in files, and install new command-line software with package managers.
For many Mac users unaccustomed to the command line, the hardest part is realizing what it can do. If you don’t understand its power, you’re unlikely even to think of it when faced with a problem. To help short-circuit that learning process, Joe includes 64 “recipes” that give you real-world solutions that often require tying multiple commands together. I’m especially fond of the ones that operate under the hood, such as the recipe that helps you figure out why a volume won’t eject (some app is using it, but which one?) or dealing with files that won’t delete when you empty the Trash. I was also particularly pleased to learn about the
textutil command that converts text documents between various common formats. It’s easy to imagine a situation where you need to convert a folder full of Word documents to HTML (or vice versa), and doing it one-by-one would be mind-numbing.
macOS Terminal and Shell
Where Take Control of the Mac Command Line with Terminal is aimed at everyday Mac users, Armin Briegel has drawn on his experience as a system administrator to write macOS Terminal and Shell for sysadmins, developers, scientists, and “pro” users who need more flexibility than is always available in the Finder and with other native Mac apps.
That accounts for the book’s more extensive coverage of managing users (with
sysadminctl) and groups (with
dseditgroup), a topic that’s often of great interest to sysadmins, if not regular people who are the only users of their Macs. Armin even explains how to make a hidden user account, which sysadmins often do so they can have an admin-level account on employee Macs for troubleshooting and repair without it cluttering up the login window or other aspects of the Mac interface. Similarly, Armin goes into detail on the various link types, special file attributes, and macOS permissions that are most likely to be of use to admins and developers.
The other place where macOS Terminal and Shell shines is in the way it exposes all the ways you can configure both the Terminal app and your shell to personalize how they work. For instance, I had never realized you could select a command in Terminal and choose Help > Open man Page for Selection (or Control-click a selection and choose Open man Page) to open a new window—automatically styled with a yellow background so it stands out—displaying the man page for whatever you selected. There are sections explaining scrolling back through output with marks (handy when the output spans multiple screens), keyboard navigation within commands, using Option to select rectangular selections, and much more. My favorite new tip is that Terminal lets me create a window group that opens tabs to the remote servers I need to access frequently.
An Aside about Apple’s Books App
Although I’m painfully biased, having collaborated on the Take Control design language, I vastly prefer reading the PDF version of Take Control of the Mac Command Line with Terminal in Preview to the mediocre user experience of paging through macOS Terminal and Shell in Apple’s Books app. (Like all Take Control books, Take Control of the Mac Command Line with Terminal is also available in EPUB for Books and Mobipocket for Kindle, for situations where reflowable text is helpful.)
To be fair, my criticisms of reading in Apple’s books app are entirely out of Armin Briegel’s hands, and I understand better than anyone the difficulty of publishing in multiple formats. Nevertheless, I do find Books frustrating in comparison to reading a well-produced PDF in Preview in a few key ways:
- The short line length of the Books standard two-column format doesn’t lend itself to technical documentation, particularly a book like macOS Terminal and Shell that has to show a lot of command-line output. It’s best to shrink the window to where it switches to a single column.
- You can display the table of contents in Books with a button click or a keyboard shortcut (Command-T), but there’s no way to leave it on screen, as with Preview’s sidebar, which makes establishing your location and context within the book difficult.
- Similarly, Preview puts its search results in the sidebar and leaves them there for reference, whereas Books displays them in a popover that disappears as soon as you click one.
On the plus side for Books, Armin Briegel includes a number of very short videos that illustrate certain capabilities—such as dragging files and folders from the Finder into Terminal—better than static screenshots could. Unless something has changed in the past few years, embedding videos in a PDF wasn’t a nut we were ever able to crack satisfactorily, and it’s a good reason why macOS Terminal and Shell sticks with Books.
But I don’t mean to focus too hard on the reading experience between the two titles because you should pick the book that’s most appropriate for your needs. If you just want to learn more about using Terminal and the command line for your own purposes, Joe Kissell’s Take Control of the Mac Command Line with Terminal is the most appropriate first step. It’s a skim across the surface of a deep lake. In contrast, Armin Briegel’s macOS Terminal and Shell dives deeper, with a focus on imparting the sort of command-line expertise that a Mac admin or developer would need in their daily work. You won’t go wrong with either one.