Book Review: Learning Unix for OS X Mountain Lion

Book Review: Learning Unix for OS X Mountain Lion
03 November 2012

I love finding ways to use my Mac more efficiently and effectively, and I’ve dabbled with the Command Line a few times with pleasure. I have a small number of commands at my fingertips that I use quite often, but am always keen to extend my skills.

When offered a review copy of Learning Unix for OS X Mountain Lion by Dave Taylor I quickly accepted.

I read the book as a 235 page PDF over the course of a week or two. For me, one of the advantages of a PDF is that I can highlight and annotate passages as I read, making it easy to later find parts I want to refer to.

A book for those comfortable with the Mac

The book isn’t aimed at beginners, as you can deduce from its subtitle: Going Deep with the Terminal and Shell. In fact, in the Preface Taylor says:

This book is for savvy Mac users who are comfortable in their current world (the Finder and other GUI applications) but also want to learn more about the “Power of Unix” that Apple keeps talking about.

The basics of Unix

After introducing Unix, Taylor goes on to explain how to work with the Terminal and issue commands. Already in the first couple of chapters we’re finding out how to change directories (folders) and list, rename or move all the files inside a directory.

Preferences and shortcuts

Chapter 2 spends some time exploring how to set up our working environment, and gives us some very handy tips, such as how to Paste Escaped Text. You see, if you need to deal with files whose name includes spaces and certain other characters you may run into trouble if you don’t ‘escape’ the filenames.

This can be a tedious and arduous process when you do it manually, but the Paste Escaped Text shortcut makes it a breeze. As Taylor explains on Page 22:

One of the common challenges of working with Unix within the OS X environment is that while the Finder has no problems with spaces embedded in filenames, Unix can be rather testy about even a single space. When you’re copying and pasting filenames, however, you don’t have to worry about remembering to escape each and every space: just use Paste Escaped Text (^-⌘-V), and a filename like taylor/Desktop/ My Favorite Martian is automatically pasted as taylor/Desktop/My\ Favorite\ Martian.

Chapter 2 provides all kinds of handy tips for getting the Terminal all set up to work exactly how you like it, and for making sure those settings are used when you want them.

All about files

In Chapters 3, 4 and 5 we learn all about the filesystem and the files it manages. There’s some really useful information here, including good explanations of absolute and relative paths, getting customised lists of files, and dealing with who can access files and what they may do with them.

If you’ve ever looked despairingly at a folder full of all kinds of files and wondered how to see and work with only one subset, such as all files whose extension is ‘jpg’, then you’ll find the answer here.

For example:

For instance, if all the JPEG image files in a directory should be moved to a new subdirectory called JPEG Images, while the TIFF and PNG image files should remain in the current directory, the fast command-line solution is:

$ mv *.{jpg,JPG} JPEG\ Images

Compare this to a tedious one-by-one selection process in the Finder!

Here’s one minor quibble I have with the PDF version of the book I received: my attempts to copy and paste code snippets like this were thwarted. The screenshot shows what was pasted in my text editor. While I enjoyed the ‘aliens’ they weren’t helpful. To be fair though, it may be an artefact of the particular PDF I was given.

Copy paste aliens.

Copy paste aliens.

There are some powerful techniques in these early chapters of the book. If you’re often rummaging round your Mac, working with files, moving them around, looking at them, looking for them, then you’ll spend a lot of time here learning the power techniques.

The massively comprehensive section on finding files may see you abandoning Spotlight. If you can’t find the files you’re looking for after trying the techniques in Chapter 5 then those files clearly don’t exist.

Alice in Wonderland uses only 2,577 different words.

The Uniq command, correctly applied, tells us Alice in Wonderland uses only 2,577 different words. The yellow highlighting is mine. Oh, and although this may all look like gibberish, this section is on Page 147 of the PDF, and it’s all been explained before you reach this part.

Going deep

The second half of the book really does take you deep into Unix, if the first half hasn’t been deep enough.

Stringing commands together, counting words and characters, replacing characters in a text file, eliminating duplicate lines in a text file all have their place here. So do techniques such as running a process in the background, opening and working with files and logging on to remote systems, such as the Mac in the next room or across the country.

Chapter 9 deals with some of the apps you can get for free, such as GIMP, an app for editing photos and graphics, that work on the X11 system on the Mac.

Finally, if you’ve worked through the whole book but are still hungering for more, Chapter 10 fills you in on where to go next.

A comprehensive book

This isn’t a book to rush through. It’s so full of techniques and information that you need to take it gradually, make notes, and embed the new material as you go through.

There are tons of useful techniques here that will speed up your work once you’ve properly learned them.

After rushing through the book myself, in order to review it, I’ve already found myself going back frequently for details of one command or another.

As someone who has worked with websites, changing file permissions and dealing with Group and Owner I found that part of the book very illuminating.

If you’re comfortable working with your Mac’s Graphical User Interface and ready for a challenge then this book is well worth the money. Learning the techniques revealed and explained here will push you across the border into definitely power-user territory.

I’m glad I read the book and will be visiting repeatedly to hone and sharpen the techniques I’ve been introduced to.

Book Details

Learning Unix for OS X Mountain Lion, Using Unix and Linux Tools at the Command Line
by Dave Taylor

Publisher: O’Reilly Media

Print ISBN:978-1-4493-3231-0 | ISBN 10:1-4493-3231-5
Ebook ISBN:978-1-4493-3226-6 | ISBN 10:1-4493-3226-9

Released: September 2012

Pages: 236

Ebook: US$12.99
Print: US$19.99

Need a more gentle introduction to the command line and the Terminal?

Learning Unix for OS X Mountain Lion plunges you right into the action. If you’d like to start with a more gentle dipping the toe into the command line waters I suggest these MacTips. They reflect some of my own progress over the last decade:

Related posts

Top