Bash Scripting Solutions [Video]
-
Free ChapterCrash Course in Bash
- The Course Overview
- Getting Started with Bash and CLI Fundamentals
- Creating and Using Basic Variables
- Hidden Bash Variables and Reserved Words
- Conditional Logic Using if, else, and elseif
- Case/Switch Statements and Loop Constructs
- Using Functions and Parameters
- Including Source Files
- Retrieving Return codes and Output
- Getting Program Input Parameters
- Getting Additional Information about Commands
-
Acting Like a Typewriter and File Explorer
- Striping/Altering/Sorting/Deleting/Searching Strings with Bash Only
- Using SED and AWK to Remove/Replace Substrings
- Formatting Your Data/Output Using Echo and Printf
- Readying Your Script for Different Languages with Internationalization
- Calculating Statistics and Reducing Duplicates Based on File Contents
- Using File Attributes With Conditional Logic
- Reading Delimited Data and Altered Output Format
-
Understanding and Gaining File System Mastery
- Viewing Files from Various Angles – Head, Tail, Less, and More
- Creating a Diff of Two Files and Patching
- Creating Symbolic Links and Using Them Effectively
- Crawling Filesystem Directories and Printing a Tree
- Finding and Deleting Duplicate Files or Directories
- Joining and Splitting Files at Arbitrary Positions
-
Making a Script Behave Like a Daemon
- Running a Program Continuously (Forever) Using Looping Constructs or Recursion
- Keeping Programs/Scripts Running After Logoff
- Invoking Commands When They Require Permissions
- Sanitizing User Input and for Repeatable Results
- Making a Simple Multi-Level User Menu Using Select
- Generating and Trapping Signals for Cleanup
- Using Temporary Files and Lock Files in Your Program
- Leveraging Timeout When Waiting for Command Completion
- Creating a File-in-File-Out Program and Running Processes in Parallel
- Executing Your Script on Startup
-
Scripts for System Administration Tasks
- Gathering and Aggregating System Information
- Gathering Network Information and Connectivity Diagnostics
- Compressing and Archiving Files
- Rotating Files from RAM to Storage for Log Rotation
- Using Linux IPtables for a Firewall
- Accessing SQL Databases Remotely or Locally
- Creating and Configuring Cron Jobs for Task Scheduling
-
Scripts for Power Users
-
Writing Bash to Win and Profit
- Creating a lame utility HTTP server
- Parsing RSS Feeds and Output HTML
- Scraping the Web and Collecting Files
- Making a Simple IRC Chat Bot Logger
- Blocking IP Addresses from Failed SSH Attempts
- Playing and Managing Audio from Bash
- Creating a Simple NAT and DMZ Firewall
- Parsing a GitHub Project and Generate a Report
- Using Bash Scripts to Monitor udev Input
- Using Bash to Monitor Battery Life and Optimize It
- Using chroot and Restricted Bash Shells to Secure Scripts
-
Advanced Scripting Techniques
- Calculating and Reducing the Runtime of a Script
- Writing One-Line Conditional Statements and Loops
- Avoiding Command Not Found Warnings/Errors and Improving Portability
- Creating a Config File and Using It in Tandem with Your Scripts
- Improving Your Shell – GCC and Command Line Colors
- Adding Aliases and Altering User Paths/Variables
- Echoing Output to Raw Terminal Devices
- Creating Simple Frontend GUIs for Bash Scripts
- Compiling and Installing Your Own Bash Shell
- Recording Terminal Sessions for Automation
- Writing High-Quality Scripts by Example
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 https://github.com/PacktPublishing/Bash-Scripting-Solutions-video-
Style and Approach
This video course introduces several key concepts of the Bash scripting language that you will need to master to begin writing functional scripts. Starting with input/output and string manipulation, the course moves progressively toward writing an application or daemon, using scripts for system/user tasks, and finally creating several unique mini-projects. Filled with best practices and tricks, this course provides you with everything possible to save you time and help you get things done easily on any Linux system.
- Publication date:
- October 2018
- Publisher
- Packt
- Duration
- 3 hours 36 minutes
- ISBN
- 9781789803648