Originally based on the classic O’Reilly quick reference, Unix in a Nutshell, this book has been expanded to include much information that is specific to Linux. These enhancements include chapters on:
Package managers (which make it easy to install, update, and remove related software files)
The Subversion and Git version control systems
The book also contains dozens of Linux-specific commands, along with tried-and-true Unix commands that have been supporting users for decades (though they continue to sprout new options).
This book does not cover the graphical tools contained in most distributions of Linux. Many of these, to be sure, are quite useful and can form the basis of everyday work. Examples of these tools include OpenOffice (Sun Microsystems’ free, open source version of the StarOffice suite), Evolution (a mail, calendar, and office productivity tool from Novell), Firefox and Thunderbird (a browser and mail program from Mozilla), and the GIMP (a graphic image-manipulation program and provider of a powerful library used by the GNOME project). But they are not Linux-specific, and their graphical models do not fit well into the format of this book.
While you probably log in to one of the graphical desktop environments such as GNOME or KDE and do much of your work with the graphical applications, the core of Linux use is the text manipulation and administration done from the command line, within scripts, or using text editors such as vi and Emacs. Linux remains largely a command-driven system, and this book continues to focus on this level of usage; for many tasks, the command line is the most efficient and flexible tool. In your day-to-day work, you’ll likely find yourself moving back and forth between graphical programs and the commands listed in this book.
Every distribution of Linux is slightly different. There are variations in directory structure, choice of standard utilities, and software versions, but you’ll find that the commands we document are the ones you use most of the time, and that they work the same on all distributions. Note, though, that some commands are only available with certain devices or configurations, or have alternatives that may be preferred in your environment. Basic commands, programming utilities, system administration, and network administration are all covered. However, some areas were so big that we had to leave them out. The many applications that depend on the X Window System didn’t make the cut. Nor did the many useful programming languages—such as Java, Perl, and Python—with which users can vastly expand the capabilities of their systems. XML isn’t covered here, either. These subjects would stretch the book out of its binding.
Linux in a Nutshell doesn’t teach you Linux—it is, after all, a quick reference—but novices as well as highly experienced users will find it of great value. When you have some idea of what command you want but aren’t sure just how it works or what combinations of options give you the exact output required, this book is the place to turn. It can also be an eye-opener, making you aware of options that you never knew about before.
Once you’ve installed Linux, the first thing you need to do is get to know the common utilities run from the shell prompt. If you know absolutely nothing about Unix, we recommend you read a basic guide (introductory chapters in the O’Reilly books Learning Red Hat Enterprise Linux and Fedora, by Bill McCarty, and Running Linux, mentioned previously, can get you started). This chapter and Chapter 2 offer a context for understanding different kinds of commands (including commands for programming, system administration, and network administration). Chapter 3 is the central focus of the book, containing about one half its bulk.
The shorter chapters immediately following Chapter 3 help you get your system set up. Since most users do not want to completely abandon other operating systems (whether a Microsoft Windows system or some Unix flavor), many users opt for a dual-boot system, with Linux residing on the same computer as other operating systems. Users can then boot to the system they need for a particular job. Chapter 4 describes the commonly used booting options on Intel systems, including LILO (Linux Loader) and GRUB (the GRand Unified Bootloader). Chapter 5 covers the Red Hat package manager (rpm) — which is supported by many distributions, including Red Hat Enterprise Linux, Fedora, SUSE, and Mandriva — and the Debian package-management system, which is used by such distributions as Ubuntu, Knoppix, and Gnoppix. It also describes some of the frontend package-management tools that simplify package management and automatically resolve dependencies. These tools include yum for rpm-based systems and aptitude and synaptic for Debian-based systems. Package managers are useful for installing and updating software; they make sure you have all the files you need in the proper versions.
All commands are interpreted by the shell. The shell is simply a program that accepts commands from the user and executes them. Different shells sometimes use slightly different syntax to mean the same thing. Under Linux, the standard shell is bash. Others, such as the ksh Korn shell, the tcsh enhanced C shell, and zsh, are available. Chapter 6 provides thorough coverage of bash; you may decide to read this chapter after you’ve used Linux for a while, because it mostly covers powerful, advanced features that you’ll want when you’re a steady user. Chapter 7 covers pattern matching, which is used by the Linux text-editing utilities for searching based on a pattern rather than an explicit string.
To get any real work done, you’ll have to learn some big, comprehensive utilities, notably an editor and some scripting tools. Two major editors are used on Linux: vi and Emacs. Emacs is covered in Chapter 8, and vi is discussed in Chapter 9. Chapter 9 also describes vim, an extended version of vi, commonly found on Linux systems. Chapter 10 and Chapter 11 cover two classic Unix tools for manipulating text files on a line-by-line basis: sed and gawk (the GNU version of the traditional awk). O’Reilly offers separate books about these topics that you may find valuable, as they are not known for being intuitive upon first use. (Emacs does have an excellent built-in tutorial, though; to invoke it, press Ctrl-h followed by t for “tutorial.”)
The Subversion and Git version control systems manage files so you can retrieve old versions and maintain different versions simultaneously. Originally used by programmers, who have complicated requirements for building and maintaining applications, these tools have turned out to be valuable for anyone who maintains files of any type, particularly when coordinating a team of people. Version control systems have become a distribution channel for thousands of free software projects. Chapter 12 offers a brief overview of version control, including basic terms and concepts. Chapter 13 presents Subversion commands, and Chapter 14 presents Git commands.
Chapter 15 covers virtualization and examines several virtualization systems such as Xen and VMWare and their command-line tools.
Our goal in producing this book is to provide convenience, and that means keeping the book (relatively) small. It certainly doesn’t have everything the manual pages have, but you’ll find that it has what you need 95 percent of the time. See the man command in Chapter 3 for information on reading the manpages. They can also be read with the info command, the GNU hypertext documentation reader, also documented in Chapter 3.