A Pair of Books for Learning the Mac Command Line
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.
That’s an excellent rundown of two books I was aware of, but haven’t taken the time to investigate whether they would be of use to me. Clearly they would, thanks for a great article @ace.
I also wanted to point out that Armin’s website is useful and interesting for anyone who uses the terminal, especially if you do occasional scripting or configuration via the command line. While it is focused on sysadmins, I have his blog in my RSS reader because the weekly news summary often contains useful nuggets and links that I’ve not come across elsewhere (useful even for mere non-sysadmin mortals).
There are some other good resources, too, such as a guide to moving to zsh (also available in expanded form as a book), and ‘demystifying root’.
I’m guessing Armin Briegel’s book is an ePub? You should be able to use Calibre to convert it to PDF format if you prefer that format.
I convert Mobipocket format books to ePub via Calibre, but I just download the Take Control books in PDF as I find them easier to use in that format.
Here’s a link to Armin’s site, re. his reasoning for sticking solely to Apple Books. Makes sense for his reasons and uses (especially the in-book video issues):
Re. libraries & formats.
I stick the epubs in my Apple Books, and then also mobi (or other Amz formats) copies in my Kindle ‘docs’ section.* Thus can read on both systems.
(*Can’t obviously add them to the ‘books’ section in Kindle, given that, unfortunately, that remains reserved for Amz purchased titles only, rather annoyingly!).
Maybe one day Apple might do an e-paper reader a la Kindle – well, in my dreams; likely only as an iPad screen mode, or something, circa 2028. Lol!
Anyhoo, really great overview Adam. Got the TCO a while ago (along with several other TCO titles), but then…time and tiredness keep interrupting.
I dumped iBooks years ago after the iOS 9 update trashed my carefully curated 1,000 books layout (author+series). I moved everything from iBooks to MapleRead SE by MaplePop. I now use Calibre to convert books to ePub (if need be) then upload them to MapleRead.
Yes, while improved somewhat a while ago, Apple Books is still in great need of further polish and refinement. Especially in the metadata tagging department.
Although Kindle has huge pain points too, so one can’t win.
I’m not quite sure that I understand the absolute stand against ever using Apple Books for a book, if, in fact, that is the only format the author provides it in and your reading devices support it. I can campaigning to the author and publisher to make it available in your preferred format. Nothing stops you from getting and organizing other books in formats you prefer–the Apple Books will just be sitting in their own corner.
In my case, I have a strong preference for Apple Books, to the extent of adding reference PDF’s to my Apple Books library, essentially making Apple Books a cloud database for most of my reading material. I do occasionally come upon a must-have book available only as a Kindle book (or much more economically as a Kindle book). In those cases, I give Amazon its due and add the book to my smaller Kindle library.
As a reader, it’s fine to have a preference, but there’s no need to be exclusive.
I understand somebody wanting to be exclusive because they’d like all their stuffl in once place. Otherwise you have to remember for each publication which app you have it in. As if we had no Finder and you could only open your files by first launching the right app and then choosing from Open Recent…
As per @Simon - it’s more about having one centralised library, rather than an aversion to one or the other.
You can typically convert from one to the other via Calibre, so you could buy those few in Kindle, convert to ebook, then add to Apple Books. But how well using it to convert books with media within them are, I’m not sure.
The trouble for authors that want to incorporate video or other media, is trying to cross-platform the book to fit all formats without re-editing several times, is it being very time consuming, and seemingly quite fiddly.
So here we are as users remaining seemingly forever in this strange and annoying ebook world of multi-format separated gardens, having to juggle between them.
Yep, I was chatting with Armin about the review and he said that he completely shared my frustrations with Apple Books but was pleased that I called out the movies, since those are the big win.
Join the discussion in the TidBITS Discourse forum