Cover Page

LINUX®

  ESSENTIALS  

Second Edition


Christine Bresnahan

Richard Blum









Wiley Logo

To those looking to further their knowledge of Linux.
Let the journey begin!

“A wise man is full of strength, and a man of knowledge
enhances his might” Prov 24:5 (ESV)

ACKNOWLEDGMENTS

First, all glory and praise go to God, who through His Son, Jesus Christ, makes all things possible and gives us the gift of eternal life.

Many thanks go to the fantastic team at Sybex for their outstanding work on this project. Thanks to acquisitions editor Kenyon Brown for offering us the opportunity to work on this book. Also thanks to developmental editor Gary Schwartz for keeping things on track and making this book more presentable. Thanks, Gary, for all your hard work and diligence. Technical editor Kevin E. Ryan did a wonderful job of double-checking all of the work in the book, in addition to making suggestions to improve the content. Thanks also goes to the young and talented Daniel Anez (theanez.com) for his illustration and cover image work. We would also like to thank Carole Jelen at Waterside Productions for arranging this opportunity for us and for helping us in our writing careers.

Christine would particularly like to thank her husband, Timothy, for his encouragement, patience, and willingness to listen, even when he has no idea what she is talking about.

Rich would like to thank his wife, Barbara, for her love and support of his late-night writing habit, and thank Christine and Timothy for their continued friendship all these years.

ABOUT THE AUTHORS

Christine Bresnahan, CompTIA Linux+, LPIC-1, Linux Essentials, started working with computers more than 30 years ago in the IT industry as a systems administrator. Christine is an adjunct professor at Ivy Tech Community College, where she teaches Linux certification and Python programming classes. She also writes books and produces instructional resources for the classroom.

Richard Blum, CompTIA Linux+, LPIC-1, Linux Essentials, has worked in the IT industry for more than 25 years as both a systems and network administrator, and he has published numerous Linux and open source books. Rich is an online instructor for Linux and web programming courses that are used by colleges and universities across the United States. When he is not being a computer nerd, Rich enjoys spending time with his wife, Barbara, and his two daughters, Katie Jane and Jessica.

INTRODUCTION

This book you hold in your hands provides a solid introduction to the Linux operating system. As its title suggests, it will give you the essential knowledge to begin using and managing this powerful operating system (OS), which is an important one in today’s computing world.

The following pages explain why you should care about Linux, describe the purpose of the Linux Professional Institute’s Linux Essentials certification, offer advice on who should buy this book, detail how the book is organized, and explain some of the typographical and organizational elements within the book’s chapters.

What Is Linux?

Linux is a clone of the Unix OS, which has been popular in academic and business environments for years. Linux consists of a kernel, which is the core control software, and many libraries and utilities that rely on the kernel to provide features with which users interact. The OS is available in many distributions, which are collections of a specific kernel with specific support programs. Popular Linux distributions include Arch, CentOS, Debian, Fedora, Gentoo, Mandriva, openSUSE, Red Hat, Slackware, SUSE Enterprise, and Ubuntu, but there are hundreds—if not thousands—of other Linux distributions. This book focuses on tools and techniques that are used in most, if not all, distributions, although from time to time it demonstrates some distribution-specific tools.

Linux has several characteristics that make it worth learning and using:

You can install Linux on almost any system on which you normally run Windows or Mac OS X. You can install Linux by itself or side by side with another OS, so you can learn Linux without losing your ability to get work done in your regular OS.

What Is the Linux Essentials Certification?

The Linux Professional Institute, or LPI (www.lpi.org), offers a series of Linux certifications. These certifications aim to provide proof of skill levels for employers; if you’ve passed a particular certification, you should be competent to perform certain tasks on Linux computers. The LPI exams include Linux Essentials, LPIC-1, LPIC-2, and LPIC-3. As the name implies, the Linux Essentials exam is the lowest level of the four exams, covering the most basic tasks of using and administering a Linux computer. Its specific objectives can be found at http://wiki.lpi​.org/wiki/LinuxEssentials. This book covers all of these topics, although not in the exact order in which they appear on the LPI website.

Who Should Read This Book?

You may have been assigned this book for a class that you’re taking, but if not, it can still have value for self-study or as a supplement to other resources. If you’re new to Linux, this book covers the material that you will need to learn the OS from the beginning. You can pick up this book and learn from it even if you’ve never used Linux before. If you’re already familiar with Linux, you’ll have a leg up on many of the topics described in these pages.

This book is written with the assumption that you know at least a little about computers generally, such as how to use a keyboard, how to insert a disc into an optical drive, and so on. Chances are that you have used computers in a substantial way in the past—perhaps even Linux, as an ordinary user—or maybe you have used Windows or Mac OS X. We do not assume that you have knowledge of Linux system administration.

System Requirements

As a practical matter, you’ll need a Linux system on which to practice and learn in a hands-on way. You can install Linux in several ways:

  • Alone as the only OS on the computer
  • Side by side with another OS
  • In an emulated computer environment provided by a virtualization program such as VMware (www.vmware.com) or VirtualBox (www.virtualbox.org)

If you’re taking a course on Linux, you may be able to use Linux in a lab environment. However, if you’re using this book in a self-study manner, you should plan to install Linux yourself. Although you can learn something just by reading this book, no amount of reading can substitute for hands-on experience with Linux!

You can use any popular Linux distribution with this book, although if you’re new to Linux, you’ll probably be happiest with one of the more user-friendly distributions, such as CentOS, Fedora, openSUSE, or Ubuntu. This book does not include instructions for how to install Linux; you should consult distribution-specific documentation to help with this task.

To install Linux and use all of its GUI tools, your computer should meet the following requirements:

CPU 400 MHz Pentium Pro or better

Minimum RAM 640 MiB

Recommended RAM At least 1,152 MiB

Hard Disk Space At least 9 GiB in unpartitioned space

Some distributions can work on less-powerful computers than these, and others may require better hardware to take full advantage of all of their features. Consult your distribution’s documentation to fine-tune these requirements.

How This Book Is Organized

This book consists of 15 chapters plus this introduction. The chapters are organized as follows:

Chapter 1: Selecting an Operating System This chapter provides a birds-eye view of the world of operating systems. The chapter will help you understand exactly what Linux is and the situations in which you might want to use it.

Chapter 2: Understanding Software Licensing This chapter describes copyright law and the licenses that both Linux and non-Linux OSs use to expand or restrict users’ rights to use and copy software.

Chapter 3: Investigating Linux’s Principles and Philosophy This chapter covers Linux’s history and the ways in which Linux, and other OSs, are commonly used.

Chapter 4: Using Common Linux Programs This chapter covers the major categories of Linux software, and it provides pointers to some of the most popular Linux programs.

Chapter 5: Managing Hardware This chapter provides advice on how to select and use hardware in Linux. Specific topics range from the central processing unit (CPU) to device drivers.

Chapter 6: Getting to Know the Command Line This chapter tackles using typed commands to control Linux. Although many new users find this topic intimidating, command-line control of Linux is important.

Chapter 7: Managing Files This chapter describes how to move, rename, delete, and edit files. Directories are just a special type of file, so they are covered here as well.

Chapter 8: Searching, Extracting, and Archiving Data This chapter summarizes the tools that you can use to find data on your computer, as well as how you can manipulate data archive files for data transport and backup purposes.

Chapter 9: Exploring Processes and Process Data This chapter describes how to install programs in Linux and how to adjust the priority of running programs or terminate selected programs.

Chapter 10: Editing Files This chapter introduces the topic of editing text files. This includes the basic features of the pico, nano, and vi text-mode text editors, as well as some common configuration file and formatted text file conventions.

Chapter 11: Creating Scripts This chapter describes how to create simple scripts, which are programs that can run other programs. You can use scripts to help automate otherwise tedious manual tasks, thus improving your productivity.

Chapter 12: Understanding Basic Security This chapter introduces the concepts that are critical to understanding Linux’s multiuser nature. It also covers the root account, which Linux uses for most administrative tasks.

Chapter 13: Creating Users and Groups This chapter covers the software and procedures you use to create, modify, and delete accounts and groups, which define who may use the computer.

Chapter 14: Setting Ownership and Permissions This chapter describes how to control which users may access files and in what ways they may do so. In conjunction with users and groups, ownership and permissions control your computer’s security.

Chapter 15: Managing Network Connections This chapter covers the critical topic of telling Linux how to use a network, including testing the connection and some basic network security measures.

Broadly speaking, the chapters are arranged in order of increasing complexity in terms of the tasks and systems described. The book begins with background information on Linux and the philosophies that drive its development. Subsequent chapters describe basic user tasks, such as moving files around. The book concludes with the tasks that are of most interest to system administrators, such as account management and network configuration.

Each chapter begins with a list of the topics covered in that chapter. At the end of each chapter, you’ll find a few elements that summarize the material and encourage you to go further:

The Essentials and Beyond This is a one-paragraph summary of the material covered in the chapter. If something sounds unfamiliar when you read it, go back and review the relevant section of the chapter!

Suggested Exercises Each chapter includes two to four exercises that you should perform to give yourself more hands-on experience with Linux. These exercises do not necessarily have “correct” answers; instead, they’re intended to promote exploration and discovery of your own computer and of Linux.

Review Questions Each chapter concludes with a series of 10 review questions, in multiple-choice, true/false, or fill-in-the-blank format. (Answers to review questions appear in Appendix A.) These questions can help you test your knowledge and prepare you for the Linux Essentials exam. Note, however, that these questions are not taken from LPI’s exam. You should not memorize the answers to these questions and assume that doing so will enable you to pass the exam. Instead, study the text of the book and use Linux.

To get the most out of this book, you should read each chapter from start to finish, perform the suggested exercises, and answer the review questions. Even if you’re already familiar with a topic, you should skim the chapter; Linux is complex enough that there are often multiple ways to accomplish a task; you may learn something even if you’re already competent in a given area.

Conventions Used in This Book

This book uses certain typographic styles in order to help you quickly identify important information and to avoid confusion over the meaning of words such as onscreen prompts. In particular, look for the following styles:

In addition to these text conventions, which can apply to individual words or to entire paragraphs, a few conventions highlight segments of text.

A margin note identifies additional information that may be relevant to the principal point of the accompanying paragraph, but that isn’t critical to its basic understanding. This could be a cross-reference to information in another chapter, an interesting but noncritical minor fact, or a warning about a rare pitfall of a procedure.


Many chapters of this book describe both GUI and text-mode methods of accomplishing tasks. Because you’re likely to be more familiar with GUI tools, most chapters begin with them; however, in most cases, Linux’s text-mode tools are more powerful. Furthermore, the Linux Essentials certification covers mainly text-mode tools. Therefore, be sure to learn the text-mode tools. As you gain proficiency with Linux, you’re likely to find yourself using the text-mode tools more often than the GUI tools because of the added flexibility that the text-mode tools provide. Furthermore, the GUI tools tend to vary a lot between distributions, whereas the text-mode tools vary much less.