Friday , January 19 2018
Home / IT Books / Book Reviews – Linux Command Line and Shell Scripting Bible

Book Reviews – Linux Command Line and Shell Scripting Bible

Book Reviews - Linux Command Line and Shell Scripting Bible

Talk directly to your system for a faster workflow with automation capability

Linux Command Line and Shell Scripting Bible is your essential Linux guide. With detailed instruction and abundant examples, this book teaches you how to bypass the graphical interface and communicate directly with your computer, saving time and expanding capability. This third edition incorporates thirty pages of new functional examples that are fully updated to align with the latest Linux features. Beginning with command line fundamentals, the book moves into shell scripting and shows you the practical application of commands in automating frequently performed functions. This guide includes useful tutorials, and a desk reference value of numerous examples.

The Linux command line allows you to type specific shell commands directly into the system to manipulate files and query system resources. Command line statements can be combined into short programs called shell scripts, a practice increasing in popularity due to its usefulness in automation. This book is a complete guide providing detailed instruction and expert advice working within this aspect of Linux.

Write simple script utilities to automate tasks
Understand the shell, and create shell scripts
Produce database, e-mail, and web scripts
Study scripting examples ranging from basic to advanced

Whether used as a tutorial or as a quick reference, this book contains information that every Linux user should know. Why not learn to use the system to its utmost capability? Linux is a robust system with tremendous potential, and Linux Command Line and Shell Scripting Bible opens the door to new possibilities.

Part I: The Linux Command Line
Chapter 1: Starting with Linux Shells
What Is Linux?
Looking into the Linux kernel
System memory management
Software program management
Hardware management
Filesystem management
The GNU utilities
The core GNU utilities
The shell
The Linux desktop environment
The X Window system
The KDE desktop
The GNOME desktop
The Unity desktop
Other desktops
Linux Distributions
Core Linux distributions
Specialized Linux distributions
The Linux LiveCD
Chapter 2: Getting to the Shell
Reaching the Command Line
Console terminals
Graphical terminals
Accessing CLI via a Linux Console Terminal
Accessing CLI via Graphical Terminal Emulation
Using the GNOME Terminal Emulator
Accessing the GNOME terminal
The menu bar
Using the Konsole Terminal Emulator
Accessing the Konsole terminal
The menu bar
Using the xterm Terminal Emulator
Accessing xterm
Command line parameters
Chapter 3: Basic bash Shell Commands
Starting the Shell
Using the Shell Prompt
Interacting with the bash Manual
Navigating the Filesystem
Looking at the Linux fi lesystem
Traversing directories
Using absolute directory references
Using relative directory references
Listing Files and Directories
Displaying a basic listing
Displaying a long listing
Filtering listing output
Handling Files
Creating fi les
Copying fi les
Using tab auto-complete
Linking fi les
Renaming fi les
Deleting fi
Managing Directories
Creating directories
Deleting directories
Viewing File Contents
Viewing the fi le type
Viewing the whole fi le
Using the cat command
Using the more command
Using the less command
Viewing parts of a fi le
Using the tail command
Using the head command
Chapter 4: More bash Shell Commands
Monitoring Programs
Peeking at the processes
Unix-style parameters
BSD-style parameters
The GNU long parameters
Real-time process monitoring
Stopping processes
The kill command
The killall command
Monitoring Disk Space
Mounting media
The mount command
The unmount command
Using the df command
Using the du command
Working with Data Files
Sorting data
Searching for data
Compressing data
Archiving data
Chapter 5: Understanding the Shell
Exploring Shell Types
Exploring Parent and Child Shell Relationships
Looking at process lists
Creatively using subshells
Investigating background mode
Putting process lists into the background
Looking at co-processing
Understanding Shell Built-In Commands
Looking at external commands
Looking at built-in commands
Using the history command
Using command aliases
Chapter 6: Using Linux Environment Variables
Exploring Environment
Looking at global environment variables
Looking at local environment variables
Setting User-Defi ned Variables
Setting local user-defi ned variables
Setting global environment variables
Removing Environment Variables
Uncovering Default Shell Environment Variables
Setting the PATH Environment Variable
Locating System Environment Variables
Understanding the login shell process
Viewing the /etc/profi le fi le
Viewing the $HOME startup fi les
Understanding the interactive shell process
Understanding the non-interactive shell process
Making environment variables persistent
Learning about Variable Arrays
Chapter 7: Understanding Linux File Permissions
Linux Security
The /etc/passwd fi le
The /etc/shadow fi le
Adding a new user
Removing a user
Modifying a user
passwd and chpasswd
chsh, chfn, and chage
Using Linux Groups
The /etc/group fi le
Creating new groups
Modifying groups
Decoding File
Using fi le permission symbols
Default fi le permissions
Changing Security Settings
Changing permissions
Changing ownership
Sharing Files
Chapter 8: Managing Filesystems
Exploring Linux Filesystems
Understanding the basic Linux fi lesystems
Looking at the ext fi lesystem
Looking at the ext2 fi lesystem
Understanding journaling fi lesystems
Looking at the ext3 fi lesystem
Looking at the ext4 fi lesystem
Looking at the Reiser fi lesystem
Looking at the journaled fi lesystem
Looking at the XFS fi lesystem
Understanding the copy-on-write filesystems
Looking at the ZFS fi lesystem
Looking at the Btrfs fi lesystem
Working with Filesystems
Creating partitions
Creating a fi lesystem
Checking and repairing a fi lesystem
Managing Logical Volumes
Exploring logical volume management layout
Using the LVM in Linux
Taking a snapshot
Using the Linux LVM
Defi ning physical volumes
Creating volume groups
Creating logical volumes
Creating the fi lesystem
Modifying the LVM
Chapter 9: Installing Software
Package Management Primer
The Debian-Based Systems
Managing packages with aptitude
Installing software packages with aptitude
Updating software with aptitude
Uninstalling software with aptitude
The aptitude repositories
The Red Hat–Based Systems
Listing installed packages
Installing software with yum
Updating software with yum
Uninstalling software with yum
Dealing with broken dependencies
Yum repositories
Installing from Source Code
Chapter 10: Working with Editors
Visiting the vim Editor
Checking your vim package
Exploring vim basics
Editing data
Copying and pasting
Searching and substituting
Navigating the nano Editor
Exploring the emacs Editor
Checking your emacs package
Using emacs on the console
Exploring the basics of emacs
Editing data
Copying and pasting
Searching and replacing
Using buffers in emacs
Using windows in console mode emacs
Using emacs in a GUI
Exploring the KDE Family of Editors
Looking at the KWrite editor
Looking at the Kate editor
Exploring the GNOME Editor
Starting gedit
Understanding basic gedit features
Setting preferences
Setting view preferences
Setting editor preferences
Setting font & color preferences
Managing plug-ins
Part II: Shell Scripting Basics
Chapter 11: Basic Script Building
Using Multiple Commands
Creating a Script File
Displaying Messages
Using Variables
Environment variables
User variables
Command substitution
Redirecting Input and Output
Output redirection
Input redirection
Performing Math
The expr command
Using brackets
A fl oating-point solution
The basics of bc
Using bc in scripts
Exiting the Script
Checking the exit status
The exit command
Chapter 12: Using Structured Commands
Working with the if-then Statement =
Exploring the if-then-else Statement =
Nesting ifs =
Trying the test Command =
Using numeric comparisons =
Using string comparisons =
Looking at string equality =
Looking at string order =
Looking at string size =
Using fi le comparisons =
Checking directories
Checking whether an object exists
Checking for a fi le
Checking for read access
Checking for empty fi les
Checking whether you can write to a fi le
Checking whether you can run a fi le
Checking ownership
Checking default group membership
Checking fi le date
Considering Compound
Working with Advanced if-then Features
Using double parentheses
Using double brackets
Considering the case Command
Chapter 13: More Structured Commands
The for Command
Reading values in a list
Reading complex values in a list
Reading a list from a variable
Reading values from a command
Changing the fi eld separator
Reading a directory using wildcards
The C-Style for Command
The C language for command
Using multiple
The while Command
Basic while format
Using multiple test commands
The until Command
Nesting Loops
Looping on File Data
Controlling the Loop
The break command
Breaking out of a single loop
Breaking out of an inner loop
Breaking out of an outer loop
The continue command
Processing the Output of a Loop
Practical Examples
Finding executable fi les
Creating multiple user accounts
Chapter 14: Handling User Input
Passing Parameters
Reading parameters
Reading the script name
Testing parameters
Using Special Parameter Variables
Counting parameters
Grabbing all the data
Being Shifty
Working with Options
Finding your options
Processing simple options
Separating options from parameters
Processing options with values
Using the getopt command
Looking at the command format
Using getopt in your
Advancing to getopts
Standardizing Options
Getting User Input
Reading basics
Timing out
Reading with no display
Reading from a fi le
Chapter 15: Presenting Data
Understanding Input and Output
Standard fi le descriptors
Redirecting errors
Redirecting errors only
Redirecting errors and data
Redirecting Output in Scripts
Temporary redirections
Permanent redirections
Redirecting Input in Scripts
Creating Your Own Redirection
Creating output fi le descriptors
Redirecting fi le descriptors
Creating input fi le descriptors
Creating a read/write fi le descriptor
Closing fi le descriptors
Listing Open File Descriptors
Suppressing Command Output
Using Temporary Files
Creating a local temporary fi le
Creating a temporary fi le in /tmp
Creating a temporary directory
Logging Messages
Practical Example
Chapter 16: Script Control
Signaling the bash shell
Generating signals
Interrupting a process
Pausing a process
Trapping signals
Trapping a script exit
Modifying or removing a trap
Running Scripts in Background Mode
Running in the background
Running multiple background jobs
Running Scripts without a Hang-Up
Controlling the Job
Viewing jobs
Restarting stopped jobs
at the cron table
Building the cron table
Viewing cron directories
Looking at the anacron program
Starting scripts with a new shell
Part III: Advanced Shell Scripting
Chapter 17: Creating Functions
Basic Script Functions
Creating a function
Using functions
Returning a Value
The default exit status
Using the return command
Using function output
Using Variables in Functions
Passing parameters to a function
Handling variables in a function
Global variables
Local variables
Array Variables and Functions
Passing arrays to functions
Returning arrays from functions
Function Recursion
Creating a Library
Using Functions on the Command Line
Creating functions on the command line
Defi ning functions in the .bashrc fi le
Directly defi ning functions
Sourcing function fi les
Following a Practical Example
Downloading and installing
Building the library
The shtool library functions
Using the library
Chapter 18: Writing Scripts for Graphical Desktops
Creating Text Menus
Create the menu layout
Create the menu functions
Add the menu logic
Putting it all
Using the select command
Doing Windows
The dialog package
The msgbox widget
The yesno widget
The inputbox widget
The textbox widget
The menu widget
The fselect widget
The dialog options
Using the dialog command in a script
Getting Graphic
The KDE environment
kdialog widgets
Using kdialog
The GNOME environment
zenity widgets
Using zenity in scripts
Chapter 19: Introducing sed and gawk
Manipulating Text
Getting to know the sed editor
Defining an editor command in the command line
Using multiple editor commands in the command line
Reading editor commands from a file
Getting to know the gawk program
Visiting the gawk command format
Reading the program script from the command line
Using data field variables
Using multiple commands in the program script
Reading the program from a file
Running scripts before processing data
Running scripts after processing data
Commanding at the sed Editor
Introducing more substitution options
Substituting flags
Replacing characters
Using addresses
Addressing the numeric line
Using text pattern fi lters
Grouping commands
Inserting and appending text
Changing lines
Transforming characters
Printing revisited
Printing lines
Printing line numbers
Listing lines
Using files with sed
Writing to a file
Reading data from a file
Chapter 20: Regular Expressions
What Are Regular Expressions?
A definition
Types of regular expressions
Defining BRE Patterns
Plain text
Special characters
Anchor characters
Starting at the beginning
Looking for the ending
Combining anchors
The dot character
Character classes
Negating character classes
Using ranges
Special character classes
The asterisk
Extended Regular Expressions
The question mark
The plus
Using braces
The pipe symbol
Grouping expressions
Regular Expressions in Action
Counting directory files
Validating a phone number
Parsing an e-mail
Chapter 21: Advanced sed
Looking at Multiline Commands
Navigating the next command
Using the single-line next command
Combining lines of text
Navigating the multiline delete command
Navigating the multiline print command
Holding Space
Negating a Command
Changing the Flow
Replacing via a Pattern
Using the ampersand
Replacing individual words
Placing sed Commands in
Using wrappers
Redirecting sedoutput
Creating sed
Spacing with double lines
Spacing files that may have blanks
Numbering lines in a file
Printing last lines
Deleting consecutive blank lines
Deleting leading blank lines
Deleting trailing blank lines
Removing HTML tags
Chapter 22: Advanced gawk
Using Variables
Built-in variables
The fi eld and record separator variables
Data variables
User-defi ned variables
Assigning variables in scripts
Assigning variables on the command line
Working with Arrays
Defi ning array variables
Iterating through array
Deleting array variables
Using Patterns
Regular expressions
The matching operator
Mathematical expressions
Structured Commands
The if statement
The while statement
The do-while statement
The for statement
Formatted Printing
Built-In Functions
Mathematical functions
String functions
Time functions
User-Defi ned Functions
Defi ning a function
Using your functions
Creating a function library
Working through a Practical Example
Chapter 23: Working with Alternative Shells
What Is the dash Shell?
The dash Shell Features
The dash command line parameters
The dash environment variables
Default environment variables
Positional parameters
User-defi ned environment variables
The dash built-in commands
Scripting in dash
Creating dash scripts
Things that don’t work
Using arithmetic
The test command
The function Command
The zsh Shell
Parts of the zsh Shell
Shell options
Built-in commands
Core built-in commands
Add-in modules
Viewing, adding, and removing modules
Scripting with zsh
Mathematical operations
Performing calculations
Mathematical functions
Structured commands
Part IV: Creating Practical Scripts
Chapter 24 Writing Simple Script Utilities
Performing Archives
Archiving data fi les
Obtaining the required functions
Creating a daily archive location
Creating a daily archive script
Running the daily archive script
Creating an hourly archive script
Running the hourly archive script
Managing User Accounts
Obtaining the required functions
Getting the correct account name
Creating a function to get the correct account name
Verifying the entered account name
Determining whether the account exists
Removing any account processes
Finding account fi les
Removing the account
Creating the script
Running the script
Monitoring Disk Space
Obtaining the required functions
Creating the script
Running the script
Chapter 25: Producing Scripts for Database, Web, and E-Mail
Using a MySQL Database
Using MySQL
Connecting to the server
The mysql commands
Creating a database
Creating a user account
Creating a table
Inserting and deleting data
Using the database in your scripts
Logging into the server
Sending commands to the server
Formatting data
Using the
Installing Lynx
The lynx command line
The Lynx confi guration fi le
Capturing data from Lynx
Using E-Mail
Chapter 26: Creating Fun Little Shell Scripts
Sending a Message
Understanding the required functions
Determining who is on the system
Allowing messages
Sending a message to another user
Creating the script
Checking if user is logged on
Checking if user accepts messages
Checking if message was included
Transmitting a simple message
Transmitting a long message
Obtaining a Quote
Understanding the required functions
Learning about the wget utility
Testing a web address
Creating the script
Checking the passed URL
Obtaining web page information
Parsing out the desired information
Generating an Excuse
Understanding the required functions
Learning about curl
Choosing to use e-mail
Creating the script

Book Reviews – Linux Command Line and Shell Scripting Bible

Top books

About huydam

Check Also

[UWP] The program could not build Windows Universal Samples

If you get this error like this: “Type universe cannot resolve assembly: System.Runtime, Version=, Culture=neutral, …

Leave a Reply

Your email address will not be published. Required fields are marked *