A Practical Guide to Linux Commands, Editors, and Shell Programming is a treasure trove for Linux beginners and veterans alike. In this, the second edition of his tome, author Mark Sobell has essentially packed two books into one. The first part covers the basics of working with Linux from the command line, and the second goes into greater detail on the TC Shell, programming tools and important Linux utilities. The publisher has also provided a free download of Chapter 12, "The AWK Pattern Processing Language," for previewing purposes.
I asked Mark Sobell a few questions about his book and how he feels about Linux as a whole.
With all the Linux books on the market today, what makes A Practical Guide to Linux
A Practical Guide to Linux Commands, Editors, and Shell Programming has two parts: The chapters that introduce and explain Linux and Mac OS X and a command reference section that is a user-friendly set of 100 man pages with lots of examples. Most books have one part or the other. Most books also cover Linux or OS X, not both. The book also includes shell and Perl programming chapters and a chapter on networking.
Although the introductory chapters provide an overview of Linux systems, the thickness of
your book might be frightening. Was your intent to be comprehensive and if so, would you say it was
written with Linux rookies or veterans in mind?
No book can cover everything Linux-related to a depth sufficient to satisfy every reader. I introduce important topics to a depth that allows readers to get started using the tool or technique. I also provide references for readers who want more information on a topic.
The book works for both audiences. Veterans can skim or skip some of the first chapters. The new chapter on Perl is of interest to both audiences, while the advanced shell programming chapter will challenge many veterans. While a reader who is new to Linux may read each chapter, a more experienced user will likely use the book more as a reference, reading sections as needed. The book includes an improved main index as well as indexes that cover utilities and files, making it easier to use as a reference.
The back cover of the book mentions that previously, you'd have had to purchase two separate
books to obtain all the knowledge you pack into one. Was it a daunting task to get all that
information into one edition, not to mention the fact that that the book applies to every Linux
No, not daunting, but as I mentioned earlier, the book comprises two distinct parts. That separation makes it easier for the reader to find what he/she wants. It also made it easier for me to write the book because it allowed me to focus on utilities separately from Linux theory and practice.
As far as covering many distributions, there are some differences in the implementation of some utility options based on whether the utility migrated from BSD or GNU. Most of the OS X utilities came from BSD, and their options differ from the Linux versions. I call out all the differences in the command reference section.
In chapter 12, "The AWK Pattern Processing Language," you mention that the gawk utility was
originally implemented as the awk utility, and there is even a mawk utility. Why did you decide to
specifically describe gawk?
The three utilities are very similar and implement the same base set of commands. Except for the GNU extensions covered at the end of the chapter, the chapter covers all three utilities. I find those extensions interesting and useful, thus I decided to cover gawk (GNU awk). Debian/Ubuntu provide mawk as the default version of awk, so it obviously is important to cover that version. And OS X uses the original awk, so that too is important. Thus the chapter covers all three versions and the GNU extensions. I use gawk for examples throughout the chapter, but all examples except those in the last section of the chapter work with all three versions.
You also mention that the authors of the AWK language sacrificed execution speed for
simplicity in the original implementation. How has AWK evolved from that point?
The GNU extensions in gawk I mentioned earlier have added complexity while one of the purposes of mawk was to speed things up. Other than that, because of faster hardware, speed is often less of an issue today than it was when AWK was written in the 1970s.
How important is AWK to Linux users? What specific uses will Linux users find for the
language and its utilities?
AWK is down and dirty and very easy to use. Perl will do most of the things that AWK will do and more, but it is more complex. I have used AWK for years and still use it. AWK is appropriate for simple line-oriented editing and reporting tasks. It is useful for processing records output from a database. AWK is one of the original Unix tools and is frequently used in combination with other utilities such as sed and sort.
What are your top five Linux commands that you think all Linux users should be familiar with
but may not know about?
That is a hard question because it doesn't tell me what the users are doing and I do not know which utilities your readers are familiar with. That said, I find du (disk usage, especially with the -h option), find (it has so many useful options), cut (great for working with columns and in conjunction with paste), and renice (changes the priority of a running process; you can also use top, another great utility, for this purpose) to be very useful.
I think there are many options that users may not know about. The
is great for displaying a quick summary of a utility. Try giving the command
--help and you may find some useful options to cat you did not know about. The -h option is
implemented by many utilities including du and ls. This option displays file sizes in human
readable format (K, M, G), which makes reports on large files easier to grasp at a glance. The grep
utility has the -w option which finds only whole words that match the pattern you are searching
How challenging is it to write about all of the the Linux distributions that are separately
updating and changing?
A Practical Guide to Linux Commands, Editors, and Shell Programming is my most stable book. When I started working with my current editor at Prentice Hall, Mark L. Taub, I had a 1,700 page tome that included much of what is in that book plus a lot of what is in my Ubuntu and Fedora distribution-specific books. He wisely suggested that I break the book into two, using the most stable parts of the book to create the Commands book and creating distro-specific books with the less stable parts. The first edition of the Commands book came out almost four years ago. In today's market that is pretty stable. The edition that I just wrote is the second edition. Compare that to my Fedora/Red Hat book: The fifth edition is at the printer.
In answer to your question, yes, some parts of some books become outdated quickly. The GUI is constantly changing as are the installation techniques. But the command line is quite stable. And I have divided my books by the stability of the material they cover.
This Q&A is based on the second edition of Mark Sobell's "A Practical Guide to Linux Commands, Editors, and Shell Programming," ISBN 0131367366, published Nov. 2009 by Prentice Hall Professional, Copyright 2010 Mark G. Sobell. For additional sample content, please visit the publisher page.
This was first published in January 2010