Monday, August 20, 2012

O'Reilly book review - The Linux Command Line

By Vasudev Ram

I reviewed the book titled "The Linux Command Line", written by William E. Shotts Jr., for O'Reilly Media. The review can be read here (by clicking the reader reviews link or scrolling down a bit on that page):

Review of O'Reilly book - The Linux Command Line

I should mention, as full disclosure, that I got a copy of The Linux Command Line, as an e-book, from O'Reilly, in exchange for doing this review, under the terms of the O'Reilly Blogger Review Program.

I review for the O'Reilly Blogger Review Program

I've also included the same review below, in this post, according to the terms of the agreement with O'Reilly Media:

Book title: The Linux Command Line

Author: William E. Shotts, Jr.

Publisher: No Starch Press

The author is a software professional with over 15 years experience and has worked extensively with Linux. He has a site devoted to Linux education, advocacy and command-line support, at:

That site also has some additional good Linux resources.

The book is a good survey of the subject, with enough detail for beginners. It covers many topics that a new Linux user should know.

I am not going to talk about the table of contents, because that is available at the page for the book, linked at the end of this post.

Below, I make some comments about the book's content itself.

Try to learn what I call meta-commands (for lack of a better word). There is no such term, as far as I know; I made it up. What I mean by meta-commands is, commands that help you learn about other commands, such as apropos, which, man, file, info and whatis.

Understanding input-output (I/O) redirection, pipes and filters is one of the keys to using the power of Linux effectively (because these concepts enable you to chain multiple commands together, to achieve much more powerful results than is possible with a single command).

So is learning to use the Linux metacharacters, such as many that start with the $ sign ($*, $#, $!, $-, ...), as well as *, [], ?, <, >, >>, the different kinds and uses of quotes (', "", `), etc. This may sound complex or vague at this point, but once you read the book, and come across the examples of the metacharacters, it will be easier to understand what they are used for and how and when to use them, and how they can make your work easier.

Commonly used and powerful filters include sed, awk, grep, head, tail, cut, paste, diff, comm, tr, col, tee, sort, uniq, cat, nl, pr, etc.

Learn one or two backup and restore commands such as tar and cpio. Backup of your data, programs and scripts is very important due to things like hard disk or computer failure.

Learn to use one of the commonly used text editors such as vi(m) or emacs reasonably well.

Almost everything in Linux is a file, or at least, can be treated as a file (for many purposes).

File permissions are one of the core concepts in Linux. Learn them - not just read / write / execute permissions for files, but also the meaning of read and execute permissions for directories, and about the sticky bit and the setuid bit, and hard and symbolic links.

Learn the basics of how to know what processes are running on your system, how to identify what process corresponds to what program you ran, how to terminate a process, etc.

Shell environment variables are also a core concept. Learn how to use and set and change them.

Learn how to install and uninstall software packages for your Linux distribution and how to check whether a package is installed. Though the concepts are similar across distributions, the details differ.

Find out about Linux devices. Each hardware peripheral attached to your Linux computer, such as hard disks, CD-ROMs, USB drives, tape drives, etc., is represented by a device and a corresponding device file. You will have to know the names of some device files in order to be able to do operations involving them.

Develop an understanding of file systems, the different types of files systems, partitions, and what it means to, and how to, mount and unmount them.

Basic Linux networking usage is useful - how to transfer files by FTP, how to login to another system via telnet and ssh, how to mount remote file systems so they appear as local ones, etc.

Since there are thousands of files in a typical Linux system, learning how to harness the power of commands that help you find files by various criteria, is useful. Some such commands are find, locate and grep. In Linux, commands are often used in combination, in a pipeline, to get greater functionality than by one command alone.
For example, the output of find can be piped to grep to find required files faster.

This is a somewhat long review (though nearing the end). But I wanted to give some details instead of just hand-waving generalities. A shorter way of putting it would be: learn to harness the power and productivity offered by the Linux operating system. That is one of its distinguishing characteristics.

Apart from the content itself, some other points that I liked about the book, were the writing style:

- short and clear sentences, and a conversational tone

- it feels like a friend is guiding you through the topics.

Overall, I think it is a good book for the purpose.

A very good book to read after reading the one under review, is this one: The Unix Programming Environment, by Kernighan and Pike. This is one of the classics of the field. It was written long ago, but is by some of the people who developed Unix (the predecessor of Linux) at Bell Labs, and most or all of it is still relevant and
up-to-date today, except for the fact that Linux has many new commands (and a few new concepts), which are not covered in it. But the core and most useful commands and programming techniques and guidelines are covered, and very well, in this book.

After reading the above books, those who are programmers coming from other operating systems, and want to explore writing their own Linux command-line tools (in C, which is one of the native languages of UNIX/Linux), may want to read this tutorial article by me on that very topic, written for IBM developerWorks:

Developing a Linux command-line utility

Here is the O'Reilly catalog page for the Linux Command Line book

Enjoy Linux.

- Vasudev Ram - Dancing Bison Enterprises

No comments: