Comprehensive guide full of useful insight into the what, why, how, and when of scripting. (MagPi, February 2016)
Richard Blum, LPIC-1, is a 20-year IT industry veteran, as both systems and network administrator for UNIX, Linux, Novell, and Microsoft servers. Rich is widely published on Linux and open source software, and is an online Linux instructor for universities nationwide. Christine Bresnahan, LPIC-1, started working with computers more than 25 years ago in the IT industry as a system administrator. Christine is an Adjunct Professor at Ivy Tech Community College. She teaches Linux Essentials, LPIC-1/CompTIA Linux+ certification, and Python programming classes. Christine produces educational material for use in the college classroom as well as book education resources.
Introduction xxxi Part I: The Linux Command Line 1 Chapter 1: Starting with Linux Shells 3 What Is Linux? 3 Looking into the Linux kernel 4 The GNU utilities 9 The Linux desktop environment 11 Linux Distributions 17 Summary 21 Chapter 2: Getting to the Shell 23 Reaching the Command Line 23 Accessing CLI via a Linux Console Terminal 25 Accessing CLI via Graphical Terminal Emulation 28 Using the GNOME Terminal Emulator 29 Using the Konsole Terminal Emulator 35 Using the xterm Terminal Emulator 41 Summary 44 Chapter 3: Basic bash Shell Commands 47 Starting the Shell 47 Using the Shell Prompt 48 Interacting with the bash Manual 49 Navigating the Filesystem 52 Listing Files and Directories 59 Handling Files 64 Managing Directories 73 Viewing File Contents 77 Viewing parts of a file 81 Summary 83 Chapter 4: More bash Shell Commands 85 Monitoring Programs 85 Monitoring Disk Space 96 Working with Data Files 102 Summary 111 Chapter 5: Understanding the Shell 113 Exploring Shell Types 113 Exploring Parent and Child Shell Relationships 115 Understanding Shell Built-In Commands 125 Summary 132 Chapter 6: Using Linux Environment Variables 135 Exploring Environment Variables 135 Setting User-Defined Variables 138 Removing Environment Variables 142 Uncovering Default Shell Environment Variables 143 Setting the PATH Environment Variable 148 Locating System Environment Variables 150 Learning about Variable Arrays 158 Summary 159 Chapter 7: Understanding Linux File Permissions 161 Linux Security 161 Using Linux Groups 172 Decoding File Permissions 175 Changing Security Settings 179 Sharing Files 182 Summary 184 Chapter 8: Managing Filesystems 187 Exploring Linux Filesystems 187 Understanding the copy-on-write filesystems 192 Working with Filesystems 192 Managing Logical Volumes 200 Summary 210 Chapter 9: Installing Software 211 Package Management Primer 211 The Debian-Based Systems 212 The Red Hat Based Systems 221 Installing from Source Code 228 Summary 232 Chapter 10: Working with Editors 233 Visiting the vim Editor 233 Navigating the nano Editor 240 Exploring the emacs Editor 242 Exploring the KDE Family of Editors 251 Exploring the GNOME Editor 260 Summary 265 Part II: Shell Scripting Basics 267 Chapter 11: Basic Script Building 269 Using Multiple Commands 269 Creating a Script File 270 Displaying Messages 272 Using Variables 274 Redirecting Input and Output 279 Pipes 281 Performing Math 285 Exiting the Script 292 Summary 295 Chapter 12: Using Structured Commands 297 Working with the if-then Statement 297 Exploring the if-then-else Statement 300 Nesting ifs 301 Trying the test Command 304 Considering Compound Testing 324 Working with Advanced if-then Features 325 Considering the case Command 327 Summary 329 Chapter 13: More Structured Commands 331 The for Command 331 The C-Style for Command 341 The while Command 343 The until Command 346 Nesting Loops 347 Looping on File Data 350 Controlling the Loop 351 Processing the Output of a Loop 358 Practical Examples 359 Summary 362 Chapter 14: Handling User Input 365 Passing Parameters 365 Using Special Parameter Variables 371 Being Shifty 375 Working with Options 376 Standardizing Options 387 Getting User Input 388 Summary 392 Chapter 15: Presenting Data 395 Understanding Input and Output 395 Redirecting Output in Scripts 400 Redirecting Input in Scripts 402 Creating Your Own Redirection 403 Listing Open File Descriptors 408 Suppressing Command Output 410 Using Temporary Files 411 Logging Messages 414 Practical Example 41