Скачать книгу

      Richard Blum, Christine Bresnahan

      Linux® Command Line and Shell Scripting Bible

      Introduction

      Welcome to the third edition of Linux Command Line and Shell Scripting Bible. Like all books in the Bible series, you can expect to find both hands-on tutorials and real-world information, as well as reference and background information that provide a context for what you are learning. This book is a fairly comprehensive resource on the Linux command line and shell commands. By the time you have completed Linux Command Line and Shell Scripting Bible, you will be well prepared to write your own shell scripts that can automate practically any task on your Linux system.

      Who Should Read This Book

      If you're a system administrator in a Linux environment, you'll benefit greatly by knowing how to write shell scripts. The book doesn't walk you through the process of setting up a Linux system, but after you have it running, you'll want to start automating some of the routine administrative tasks. That's where shell scripting comes in, and that's where this book helps you out. This book demonstrates how to automate any administrative task using shell scripts, from monitoring system statistics and data files to generating reports for your boss.

      If you're a home Linux enthusiast, you'll also benefit from Linux Command Line and Shell Scripting Bible. Nowadays, it's easy to get lost in the graphical world of pre-built widgets. Most desktop Linux distributions try their best to hide the Linux system from the typical user. However, sometimes you must know what's going on under the hood. This book shows you how to access the Linux command line prompt and what to do when you get there. Often, performing simple tasks, such as file management, can be done more quickly from the command line than from a fancy graphical interface. You can use a wealth of commands from the command line, and this book shows you how to use them.

      How This Book Is Organized

      This book leads you through the basics of the Linux command line and into more complicated topics, such as creating your own shell scripts. The book is divided into four parts, each one building on the previous parts.

      Part I assumes that you either have a Linux system running or are looking into getting a Linux system. Chapter 1, “Starting with Linux Shells,” describes the parts of a total Linux system and shows how the shell fits in. After describing the basics of the Linux system, this part continues with the following:

      ● Using a terminal emulation package to access the shell (Chapter 2)

      ● Introducing the basic shell commands (Chapter 3)

      ● Using more advanced shell commands to peek at system information (Chapter 4)

      ● Understanding what the shell is used for (Chapter 5)

      ● Working with shell variables to manipulate data (Chapter 6)

      ● Understanding the Linux filesystem and security (Chapter 7)

      ● Working with Linux filesystems from the command line (Chapter 8)

      ● Installing and updating software from the command line (Chapter 9)

      ● Using the Linux editors to start writing shell scripts (Chapter 10)

      In Part II, you begin writing shell scripts. As you go through the chapters, you'll do the following:

      ● Learn how to create and run shell scripts (Chapter 11)

      ● Alter the program flow in a shell script (Chapter 12)

      ● Iterate through code sections (Chapter 13)

      ● Handle data from the user in your scripts (Chapter 14)

      ● See different methods for storing and displaying data from your Script (Chapter 15)

      ● Control how and when your shell scripts run on the system (Chapter 16)

      Part III dives into more advanced areas of shell script programming, including these things:

      ● Creating your own functions to use in all your scripts (Chapter 17)

      ● Utilizing the Linux graphical desktop for interacting with your script users (Chapter 18)

      ● Using advanced Linux commands to filter and parse data files (Chapter 19)

      ● Using regular expressions to define data (Chapter 20)

      ● Learning advanced methods of manipulating data in your scripts (Chapter 21)

      ● Generating reports from raw data (Chapter 22)

      ● Modifying your shell scripts to run in other Linux shells (Chapter 23)

      The last section of the book, Part IV, demonstrates how to use shell scripts in real-world environments. In this part, you will learn these things:

      ● How to put all the scripting features together to write your own scripts (Chapter 24)

      ● How to store and retrieve data using databases, access data on the Internet, and send e-mail messages (Chapter 25)

      ● Write more advanced shell scripts to interact on your Linux system (Chapter 26)

Cautions, Tips, and Notes

      You will find many different organizational and typographical features throughout this book designed to help you get the most of the information.

      Caution

      This information is important and is set off in a separate paragraph with a special icon. Cautions provide information about things to watch out for, whether simply inconvenient or potentially hazardous to your data or systems.

      Tip

      Tips provide helpful advice to make your work easier and more effective. Tips may suggest a solution to a problem or a better way to accomplish a task.

      Note

      Notes provide additional, ancillary information that is helpful, but somewhat outside of the current presentation of information.

Downloadable code

      You can obtain the book's code files at www.wiley.com/go/linuxcommandline.

      Minimum Requirements

      Linux Command Line and Shell Scripting Bible doesn't focus on any specific Linux distribution, so you can follow along in the book using any Linux system you have available. The bulk of the book references the bash shell, which is the default shell for most Linux systems.

      Where to Go from Here

      After you've finished reading Linux Command Line and Shell Scripting Bible, you're well on your way to incorporating Linux commands in your daily Linux work. In the ever-changing world of Linux, it's always a good idea to stay in touch with new developments. Often, Linux distributions change, adding new features and removing older ones. To keep your knowledge of Linux fresh, always stay well-informed. Find a good Linux forum site and monitor what's happening in the Linux world. Many popular Linux news sites, such as Slashdot and Distrowatch, provide up-to-the-minute information about new advances in Linux.

      Part I

      The Linux Command Line

      Chapter 1

      Starting with Linux Shells

In This Chapter

      What is Linux?

      Parts of the Linux kernel

      Exploring the Linux desktop

      Visiting Linux distributions

      Before you can dive into working with the Linux command line and shells, you should first understand what Linux is, where it came from, and how it works. This chapter walks you through what Linux is and explains where the shell and command line fit in the overall Linux picture.

      What Is Linux?

      If you've never worked with Linux before, you may be confused about why so many

Скачать книгу