Bash Scripting Solutions

Video Description

Automate tedious repetitive tasks, manage your system efficiency, and become an effective seasoned Bash user

About This Video

  • Automate tedious and repetitive tasks
  • Create several novel applications ranging from a simple IRC logger to a Web Scraper
  • Manage your system efficiently by becoming a seasoned Bash user

In Detail

In Linux, one of the most commonly used and most powerful tools is the Bash shell. With its collection of engaging recipes, Bash solutions takes you through a series of exercises designed to teach you how to effectively use the Bash shell in order to create and execute your own scripts. The course starts by introducing you to the basics of using the Bash shell, and teaching you the fundamentals of generating any input from a command. With the help of a number of exercises, you will get to grips with automating daily tasks for sysadmins and power users. Once you have a hands-on understanding of the subject, you will move on to exploring more advanced projects that can solve real-world problems comprehensively on a Linux system. In addition to this, you will discover projects such as creating an application with a menu, beginning scripts on startup, parsing and displaying human-readable information, and executing remote commands with authentication using self-generated Secure Shell (SSH) keys. By the end of this course, you will have gained significant experience in solving real-world problems, from automating routine tasks to managing your systems and creating your own scripts.

All the code and supporting files for this course are available on Github at

Table of Contents

  1. Chapter 1 : Crash Course in Bash
    1. The Course Overview 00:03:53
    2. Getting Started with Bash and CLI Fundamentals 00:09:29
    3. Creating and Using Basic Variables 00:03:18
    4. Hidden Bash Variables and Reserved Words 00:02:34
    5. Conditional Logic Using if, else, and elseif 00:06:46
    6. Case/Switch Statements and Loop Constructs 00:04:48
    7. Using Functions and Parameters 00:03:59
    8. Including Source Files 00:01:50
    9. Retrieving Return codes and Output 00:03:25
    10. Getting Program Input Parameters 00:02:35
    11. Getting Additional Information about Commands 00:01:44
  2. Chapter 2 : Acting Like a Typewriter and File Explorer
    1. Striping/Altering /Sorting /Deleting/ Searching Strings with Bash Only 00:09:02
    2. Using SED and AWK to Remove/Replace Substrings 00:07:54
    3. Formatting Your Data/Output Using Echo and Printf 00:04:14
    4. Readying Your Script for Different Languages with Internationalization 00:04:23
    5. Calculating Statistics and Reducing Duplicates Based on File Contents 00:04:13
    6. Using File Attributes With Conditional Logic 00:03:21
    7. Reading Delimited Data and Altered Output Format 00:03:30
  3. Chapter 3 : Understanding and Gaining File System Mastery
    1. Viewing Files from Various Angles – Head, Tail, Less, and More 00:04:07
    2. Creating a Diff of Two Files and Patching 00:04:34
    3. Creating Symbolic Links and Using Them Effectively 00:03:51
    4. Crawling Filesystem Directories and Printing a Tree 00:02:32
    5. Finding and Deleting Duplicate Files or Directories 00:04:16
    6. Joining and Splitting Files at Arbitrary Positions 00:05:21
  4. Chapter 4 : Making a Script Behave Like a Daemon
    1. Running a Program Continuously (Forever) Using Looping Constructs or Recursion 00:04:34
    2. Keeping Programs/Scripts Running After Logoff 00:03:05
    3. Invoking Commands When They Require Permissions 00:02:51
    4. Sanitizing User Input and for Repeatable Results 00:07:08
    5. Making a Simple Multi-Level User Menu Using Select 00:02:51
    6. Generating and Trapping Signals for Cleanup 00:02:45
    7. Using Temporary Files and Lock Files in Your Program 00:02:50
    8. Leveraging Timeout When Waiting for Command Completion 00:03:41
    9. Creating a File-in-File-Out Program and Running Processes in Parallel 00:02:54
    10. Executing Your Script on Startup 00:02:35
  5. Chapter 5 : Scripts for System Administration Tasks
    1. Gathering and Aggregating System Information 00:04:36
    2. Gathering Network Information and Connectivity Diagnostics 00:03:16
    3. Compressing and Archiving Files 00:04:07
    4. Rotating Files from RAM to Storage for Log Rotation 00:03:02
    5. Using Linux IPtables for a Firewall 00:02:42
    6. Accessing SQL Databases Remotely or Locally 00:03:56
    7. Creating and Configuring Cron Jobs for Task Scheduling 00:02:38
  6. Chapter 6 : Scripts for Power Users
    1. Creating Syslog Entries and Generating an Alarm 00:02:09
    2. Backing Up and Erasing Media, Disks, and Partitions with DD 00:01:49
    3. Creating Graphics and Presentations on the CLI 00:03:34
    4. Browsing the Web from the CLI 00:02:58
    5. Finding Binary Dependencies 00:01:22
    6. Fetching Time from Different Locations 00:01:00
    7. Encrypting/Decrypting Files from a Script 00:01:40
  7. Chapter 7 : Writing Bash to Win and Profit
    1. Creating a lame utility HTTP server 00:03:09
    2. Parsing RSS Feeds and Output HTML 00:00:49
    3. Scraping the Web and Collecting Files 00:01:29
    4. Making a Simple IRC Chat Bot Logger 00:00:59
    5. Blocking IP Addresses from Failed SSH Attempts 00:01:51
    6. Playing and Managing Audio from Bash 00:01:29
    7. Creating a Simple NAT and DMZ Firewall 00:01:58
    8. Parsing a GitHub Project and Generate a Report 00:00:47
    9. Using Bash Scripts to Monitor udev Input 00:01:08
    10. Using Bash to Monitor Battery Life and Optimize It 00:02:20
    11. Using chroot and Restricted Bash Shells to Secure Scripts 00:01:18
  8. Chapter 8 : Advanced Scripting Techniques
    1. Calculating and Reducing the Runtime of a Script 00:01:27
    2. Writing One-Line Conditional Statements and Loops 00:02:04
    3. Avoiding Command Not Found Warnings/Errors and Improving Portability 00:01:58
    4. Creating a Config File and Using It in Tandem with Your Scripts 00:01:14
    5. Improving Your Shell – GCC and Command Line Colors 00:02:01
    6. Adding Aliases and Altering User Paths/Variables 00:01:03
    7. Echoing Output to Raw Terminal Devices 00:01:27
    8. Creating Simple Frontend GUIs for Bash Scripts 00:02:56
    9. Compiling and Installing Your Own Bash Shell 00:01:52
    10. Recording Terminal Sessions for Automation 00:01:25
    11. Writing High-Quality Scripts by Example 00:02:06

Product Information

  • Title: Bash Scripting Solutions
  • Author(s): Ron Brash, Ganesh Naik
  • Release date: October 2018
  • Publisher(s): Packt Publishing
  • ISBN: 9781789803648