A thick, heavy book with the equally weighty title <em>A Practical Guide to Linux Commands, Editors, and Shell Programming</em> may be the single most important Linux book you ever buy.
In 2005, the year it was published, I bought the first edition of A Practical Guide to Linux Commands, Editors, and Shell Programming by Mark Sobell. The title reads like a nutshell description one might find in the Product Description section of its Amazon page, rather than like a book title. If you think the title is a handful, you should pick up a copy of the book; it is huge, a hefty tome filled from cover to cover with explanations of a wide range of topics relevant to the operation of a Unix-like operating system via the command line interface.
I had my copy of the book for maybe three months -- already a well-thumbed reference on my shelf, and I returned to it over and over again -- when I posted a brief review at Amazon:
This book is the best distro-agnostic foundational Linux reference I've ever seen, out of dozens of Linux-related books I've read. It's a constant battle to find a good Linux book that isn't wedded implicitly or explicitly to a specific distribution (usually something Red Hat related), more about KDE and GNOME applications and other specific applications the authors favor than about real Linux skills, or both. Finding this book was a real stroke of luck. If you want to really understand how to get things done at the command line, where the power and flexibility of free unixlike OSes really live, this book is among the best tools you'll find toward that end. About the only way it could be better is to be released under an open documentation license.
I was not the only person to give such a positive review. In fact, mine was modest by some standards. Out of 61 reviews at Amazon, nine of them gave the book four stars. The rest were all five-star reviews.
I have continued to use it heavily over the intervening years until, in 2009, the publisher contacted me about my Amazon review and asked whether I would consent to being quoted in the listing of reviews inside the second edition. After discussing it with them, we agreed on a distillation of the essence of my Amazon review that reads:
This book is the best distro-agnostic foundational Linux reference I've ever seen, out of dozens of Linux-related books I've read. Finding this book was a real stroke of luck. If you want to really understand how to get things done at the command line, where the power and flexibility of free UNIX-like OSes really live, this book is among the best tools you'll find toward that end.
Aside from reading this again, in print within the book's frontmatter, and realizing I should have been a touch less repetitive in my choice of phrasing, I find my opinion has not changed. The only change I would make to the message conveyed by my Amazon review is replacing the word "documentation" with "content" when referring to licensing. To my delight, the publisher sent a copy of the second edition to me as a "thank you" for the brief review.
Since the first edition, another fifty pages have been added, give or take. Due to the subject matter, there was little danger of most of the material in the book becoming obsolete, but where needed it has been updated for the current edition. It benefits from the addition of some new materials, as well as covering the same subjects as in the first edition. As described on the front cover of the first edition, the book provides (among other things):
- A comprehensive, practical guide plus an outstanding reference with hundreds of realistic, high-quality examples!
- Covers 80+ core utilities, shell programming, editors, and programming tools
- Become a true Linux guru: Master the powerful Linux command line, from the ground up
The second edition alters that text slightly:
- Get more done faster, and become a true Linux guru by mastering the command line!
- Learn from hundreds of realistic, high-quality examples
- NEW! Coverage of the Mac OS X command line and its unique tools
- NEW! Expert primer on automating tasks with Perl
This weighty tome has plenty of room to fill with good information about how to get friendly with a Unix-like operating system, and Sobell did not waste much space. The density of knowledge contained between its covers is prodigious, well-organized, and quite thoroughly relevant. This book is clearly designed with both beginners and experts in mind -- a promise made by many books, but truly fulfilled only by a very rare few, including this specimen.
The choice of subject itself lends to the quality of the work. A common approach to trying to "teach" Unix and Linux to people in a book involves telling people where to click when using GNOME, how to install Fedora Core Linux, and similarly ephemeral, time-sensitive information of very limited applicability. By focusing on the command line, Sobell ensures that the whims of GUI designers and Linux distribution development teams will not render the majority of the book's information the least bit obsolete, and that the knowledge gleaned from it will serve the reader well across a wide range of platforms.
The second edition claims coverage that supports at least CentOS, Debian, Fedora, Mandriva, Mint, OpenSUSE, Red Hat, and Ubuntu, as well as Mac OS X as mentioned above. I find this substantial list insufficiently ambitious, even woefully inadequate. While some of the materials certainly assume versions of utilities typically distributed with Linux-based systems rather than BSD Unix systems (consider GNU cat vs. BSD cat, for instance), I find this an indispensable reference even for my current operating system of choice, FreeBSD -- which is not a Linux-based system at all.
Major subject areas covered include:
- The Basics of Linux and Mac OS X Systems -- Much more comprehensive than it sounds, it touches on the history of Unix and Linux, why such operating systems are worth using, general characteristics of the system, logging in, setting passwords, finding documentation, and getting information about the system.
- Utilities -- Even experienced Unix and Linux users may find themselves learning some surprising things from this section, which includes several categories of utility; basic utilities, tools for working with files, the Unix pipeline, some miscellaneous tools that deserve special mention, compression and archive tools, search tools, user and system information tools, and a couple of utilities suitable for simple ad-hoc messaging needs.
- The Filesystem -- A fairly comprehensive treatment of the topic of dealing with the filesystem, this section covers everything from an explanation of the hierarchical structure of the filesystem to the use of Access Control Lists.
- The Shell Environment -- The techniques of masterful interactive shell usage are exposed succinctly here.
- Vim -- This section provides one of the better introductions to using the Vim editor that I have encountered. It guides the user through major aspects of the editor's operation such that, if the user learns everything provided, he or she should have reached a level competence sufficient to make him or her miss its capabilities while using any common GUI editor. At the very least, the user should be well beyond the awkward beginner stage of Vim use long before finishing this whole section.
- Emacs -- My experience with GNU Emacs is mostly limited to a subset of what this book explains to the reader. It is thoroughly detailed, about fifty pages of head-first introduction to the editor, much like the Vim section that way.
- Bash -- An entire chapter of about eighty pages is devoted to the Bourne Again Shell, the single most common command shell in the Linux world. In fewer than ten pages, this chapter has already introduced the reader to shell scripting in bash. By the end of the chapter, it has gotten as far as writing one's own functions, handling command line options, and parsing the command line.
- TCSH -- Surprisingly, the book does not stop with bash. Another entire chapter is devoted to tcsh, probably the most common default shell on Unix-like systems that do not use use a Linux kernel, apart from the original Bourne Shell itself (aka "sh").
- Shell Scripting -- A more serious and in-depth discussion of shell scripting than the relatively minor (for this book, at least) explanations in the bash and tcsh chapters, this section goes so far as to address recursion. It focuses on bash for this subject.
- Perl -- The Perl programming language, the favorite scripting tool of legions of Unix users, also gets its own chapter. While this chapter is no substitute for a good Perl book like Learning Perl, it offers a primer on the language that should get the reader to the point where he or she can write actually useful scripts within its roughly fifty pages.
- Awk -- Just in case you had not learned enough about admin and user scripting on Unix-like systems, the awk utility's scripting language is also introduced.
- Sed -- Yes, really. Where editors and command line utilities meet, we find sed (the Stream Editor). The treatment of this editor places the reader in serious jeopardy of actually learning to make practical use of this arcane tool.
- Rsync -- The rsync program has become the Swiss army knife of backups on Unix-like systems.
- Command Reference -- A huge command reference is included in the book, just before the appendices.
- Regular Expressions -- The first appendix pays special attention to the use of regular expressions.
- Help -- The second appendix starts with some advice for problem solving; proceeds through Websites, mailing lists, and standard documentation; and winds up explaining how to specify a terminal type, some of the details of different terminal types, and why it matters.
- Updating -- This is the one place in the book where it gets notably specific to particular Linux distributions. The third appendix is about how to keep a system up to date using tools such as Fedora's YUM, Debian's APT, and even BitTorrent.
- Mac OS X -- A slew of additional information particular to Mac OS X is available in the fourth and final appendix.
- The end of the book provides a fifty page glossary, a file tree index, a utility index, and finally the book's main index, which has been reorganized and updated to make using the book as a reference even easier than in the first edition.
The Bad News
- BSD Unix vs. GNU tools -- There is little coverage of BSD Unix core utilities, with a general assumption that the GNU core utilities will be used. This should come as no surprise once one notices the word "Linux" in large letters on the cover. In the midst of reading the wealth of knowledge imparted by the book that is transferable to commercial and BSD Unix systems, however, stumbling across brief mentions of how utilities work can be jarring when using versions of the tools that are in some respects incompatible with the GNU versions.
- Info Pages -- The GNU project's hideous, usability-impaired documentation software is frankly an abomination, overcomplicating the task of finding out information about a particular piece of software. It is obviously being pushed by its developers as a replacement for manpages, despite the fact the usability of the info utility is so poor as to appear utterly devoid of value beside manpages. Despite this, Sobell insists on referring the reader to info pages rather than manpages at times throughout the book.
- HUGE -- This is no pocket book. Do not expect to comfortably lug it around with you everywhere for a little casual reading from time to time.
The flaws in the book are so minor as to be negligible, generally speaking. As the second-best book to act as a reference for BSD Unix users and administrators (after the FreeBSD Handbook) despite the fact it was written for Linux-based systems, it should be obvious that it goes above and beyond the requirements of fulfilling the promise made by its title. Still, there is no denying that the very minor expansion of content necessary to address differences between BSD and GNU utilities, and choosing to recommend more portable and usable documentation tools (i.e., manpages) as preferable to, or at least more widely available than, info pages, would offer a distinct improvement. To get something a bit easier to carry, it might be worthwhile to consider digital formats on devices you tend to carry around with you anyway -- like a netbook.
The final word
Every Unix or Linux user and administrator class at any school offering technical subjects should use this book, or one like it (if such a beast exists), as its primary textbook. Software developers for Unix-like systems can benefit tremendously from A Practical Guide to Linux Commands, Editors, and Shell Programming as well. If you are studying Linux-based systems in particular, or Unix-like systems in general, or even if you just use them regularly, it is a very good book to have within arm's reach.
With more than a thousand pages of densely packed, clearly presented information, this tome's cover price of about fifty dollars is so reasonable it almost seems like a printing error.