Saturday, January 21, 2012

A Book Review of The Linux Command Line: A Complete Introduction

Author: William E. Shotts Jr.
Format: Paperback, 480 pages
Publisher: No Starch Press; 1st edition (January 14, 2012)
ISBN-10: 1593273894
ISBN-13: 978-1593273897

Linux has been struggling to become a "desktop darling" of the home and small office user for years and has yet to succeed. I don't know if it will ever succeed. One of the biggest hurdles Linux has to cross is its reputation as being command-line driven. Most people fear the command line and if you're old enough, you remember (with dread) the arcane DOS interface or struggling to remember what command syntax to use with the now ancient Apple IIe. Users love Windows because the GUI is easy.

Ubuntu, of all the Linux distros, is about the best in terms of a user-friendly GUI, and yet even when Windows users abandon the Microsoft "mothership", they almost always turn to a Mac and not to Ubuntu (or any other flavor of Linux). Face it. Linux may never succeed as a desktop operating system and may have to "settle" for being the king of the server and embedded device markets.

But is that such a bad thing?

Ironically, the power of a Windows machine is on the command-line, but unless you're a system admin or network guru, that doesn't even occur to you. And absolutely, the power of Linux is in the command-line shell. Why fight the nature of what Linux is? Instead of trying to avoid shell commands, embrace them. That's where The Linux Command Line: A Complete Introduction comes in.

The hardcopy of this book should be on its way to me for my review right now, but I couldn't wait. The publisher kindly allowed me to also download a PDF version of the Shotts book, so here I am, tearing into it (metaphorically speaking) and getting ready to devour its contents. What secrets does it hold and for whom shall they be revealed?

Scrolling through the beginning of the PDF, I discovered the "Who Should Read This Book" section. According to the author, this book is for the rank beginner in the Linux world who is likely a Windows "power user" and who, for whatever reason, must learn Linux management skills. That's a rather amazing statement since, having scanned the table of contents on my way down to page 29, I discovered a rather impressive list of skills to be learned. Among them were "A Gentile Introduction to Vi" (my favorite editor), "Package Management", "Regular Expressions", "Compiling Programs", and "Writing Shell Scripts". Any one of these topics is worthy if its own book (and they're out there) and certainly they will be intimidating to the Linux novice.

But first things first.

The end of the introduction to the book gives rather brief instructions for how to install Linux on a computer or how to use a live CD, so the reader is presumed not to even use Linux on a regular basis (or at all). On the other hand, there are no links or instructions as to where to find a Linux ISO file for download or how to burn a bootable CD or DVD, so I guess the reader is expected to know something. Oh, in case you're wondering, I'm using Ubuntu 11.04 (Natty Narwhal) to write this review and practicing commands in the default bash shell.

The first section of the book is called "Learning the Shell", which is pretty basic. The first chapter, "What is the Shell" offers the reader a little bit of a history lesson on the shell and how to use very basic commands, such as "date", "cal", and "df". It's a very short chapter and fortunately gets the reader into opening and using the shell right away. It's a gentle beginning. When does the book get "rough?"

Technically, the hardcopy of the book is only 480 pages long, so it's not an encyclopaedia (remember them?). Yet, for not being a massive tome, the Shotts book probably best works not only as a linear tutorial but as a reference. After all, even veteran shell users don't remember everything and I've seen Linux developers with decades of experience still have to look up commands they don't use very often (although they almost always do so using Google rather than grabbing a handy book).

I called this book "a linear tutorial" because the first section is written in just that manner. One skill set builds on the previous ones presented and the more the reader goes through and practices what they're reading, the better they should get at navigating the directory tree, copying and moving files, locating files, and using man pages.

Although there are no exercises or labs at the end of each chapter, there are notes encouraging the reader to pause and to practice what they've learned as well as experimenting and adapting on commands they've been using. The reader is also encouraged to refer back to the help and man documentation on commands, which is a further exercise in using the shell, since these tools are the first ones a system admin or programmer turn to when they're trying to recall that rarely used command switch.

Actually, the book doesn't really need a separate section for exercises since each page in the chapters directs the reader to try out various commands. This is a book that needs to be opened alongside a Linux machine where the reader is simultaneously working in the shell.

It would take too long to review the content in each chapter and section, but there are a few notable mentions. In Chapter 12 "A Gentile Introduction to Vi", the reader is treated to a Vi primer (sorry, Emacs users). It's probably just about as much as a new user will need to edit files on a Linux machine and if need be, books such as Learning the vi and Vim Editors by Robbins, Hannah, and Lamb are always available.

I did wonder about introducing the reader to Regular Expressions in Chapter 19. For the average computer user, even the average Linux computer user, Regular Expressions can be a real "migraine maker". This may be your first clue that not everyone who will use this book will use all of it, at least not right away. Although this is a great skill to acquire, not everyone may be up to the challenge. When reading this book, assess whether or not you want or need to learn everything it has to offer.

Chapter 23: "Compiling Programs" is another chapter that may not always be useful to all readers. The content goes quickly from "What is Compiling" to downloading source code from the web (specifically ftp.gnu.org), examining the source tree, and building a program. Note that the reader isn't expected to know how to actually write a program, so the general purpose of this chapter is to introduce the power of compiling in the shell and, like vi and Regular Expressions skills, is something that can be built upon using other resources if the reader so desires.

All of the fourth and last section of the book is devoted to "Writing Shell Scripts". If the hypothetical reader of this book is someone who wants or needs to learn Linux server management skills, everything presented in the book up to this point is not only useful, but required. Certainly writing shell scripts (and again, there are entire books available on this subject), is a necessary skill set for the Linux systems admin or even for people who just like to "get under the hood" a little.

After a brief introduction, the reader is lead through the "rudimentaries" of their first shell script which is about as basic as echo 'Hello World!' The reader must dig back into what they've learned before about using vi or vim, creating a file in the desired directory, making it executable, and saving it (none of these instructions are presented again in the shell script chapter). The last bit in the chapter gives the reader a tip on how to configure vim for shell scripting by turning on syntax highlighting, highlighting search results, and using auto indent. The rest of the section takes the reader through building a scripting project and pulls together previously learned skills to develop more complex scripts, including teaching the use of loops and arrays.

The final note in the final chapter addresses the reader, "Well, we have completed our journey. The only thing left to do now is practice, practice, practice. Even though we've covered a lot of ground in our trek, we barely scratched the surface as far as the command line goes."

I can agree with that. There's a reason why the book's subtitle is "A Complete Introduction." That's not a contradiction in terms, it's the literal truth. Part of the power of the shell is in its almost infinite potential, which most shell users never master, but if you buy and then use The Linux Command Line: A Complete Introduction to its fullest extent, your "introduction" to the shell will be very impressive.

Review: Kindle Fire Web Experience

I've already reviewed the video and book reading capacities of my Kindle Fire. Time to turn to the web experience. How is it?

One of the things I was looking forward to when I got my Kindle Fire was being able to wirelessly surf the web while not being tied down to a desktop or laptop computer. I expected the experience to be somewhat slower but wasn't prepared for how much longer it seemed to take for a webpage to download into Kindle's Silk web browser. Not quite as bad as dial-up, but I wasn't used to waiting for (by today's standards) ages for a webpage to appear.

To get to a webpage, you can select Web in the overhead menu or select amazon, IMDb, or Facebook from the shortcuts at the bottom of the main page. Selecting Web opens the last webpage you visited, which in my case was marvel.com. I admit that one of the ideas I had was to be able to read comicbooks digitally using my Kindle Fire. I figured buying an annual subscription at Marvel would let me read all of the old comicbooks I loved as a kid but not take up any valuable storage space in the home (or costing me billions of dollars to replace everything I had when I was young).

But first, the general web experience.

To go to another site by typing in the URL, tap the URL bar to make the keyboard appear. Depending on your relative "texting" skills (mine are awful), you can type in the address of the site you want to visit. There's even a .com button so you are spared entering the suffix as individual characters. As you type, the history shows the URLs you've most recently visited, and you can select any of those if it's where you want to go.

While my fingers aren't overly fat, if there are a lot of links or buttons on the page I want to press, I tend to tap and miss the mark. Changing the orientation of the screen from portrait to landscape helps a bit, but of course, I sacrifice the length of the page. When I do "fat finger" the wrong link or button. I have to hit the back button, wait for the previous page to load, and then try again. I don't know if this is a problem in Silk, the website in question not being well designed for mobile web devices, or me being clumsy. It's just my experience. I do find that using a very gentle tap seems to work better in these delecate cases.

Now on to comicbooks at Marvel.

This one I blame on whoever designed Marvel's website.

I'd love to read 1960s vintage comicbooks. It was the silver age and my childhood and Marvel was just a lot of fun back then. You can read the first few pages of any comic for free, so I thought I'd try my Kindle Fire out by trying to read the beginning of an old Spider-Man comic. Here's what happened.
When the cover of the comic loads into the browser, there are two green arrows (no reference to the comicbook character intended) at the bottom of the screen for forward and back. To advance to page one, I have to successfully tap the right arrow. But nothing happens when I do. Or I get a white screen with an exclamation mark in the middle and have to hit the browser's back button. Unlike a book on Kindle, I can't just use a sliding finger motion to move to the next page.

I tried changing to landscape orientation to see if that helped. After multiple taps, page 1 finally appeared. Changing back to portrait orientation makes the page readable. At this point, I can use my finger to drag the page and move to page 2, but there's an annoying tendency to snap back to page 1 when I remove my finger. Frankly, the entire experience is more frustrating than it's worth. I don't want to have to sit at my desktop to read comics. It's something best done sitting in a living room chair or reading in bed late at night.

I don't know if Kindle Fire could improve this problem or if it's something the folks at Marvel.com have to fix. However, the Silk web browser, though passable, still leaves a lot to be desired. Or maybe mobile web browsing still needs to be perfected. In any case, as of now, browsing the web with my Kindle fire is not the main reason I'll be using the device.