Linux Bash β€” Complete Bash Scripting Guide

2 minute read

Welcome to Part 3 of 3 in the Linux tutorial series on timesofcloud.com. You have already learned how to navigate the terminal in Part 1 and manage users, permissions, and text processing in Part 2. Now it is time to put all of that knowledge to work by writing real Bash scripts.

By the end of Part 3, you will be able to write production-ready Bash scripts from scratch β€” with proper error handling, debugging, automation, and clean code practices that hold up in real DevOps environments.


πŸ“š What You Will Learn in Part 3

Area 1 β€” File I/O & String Manipulation (Ch 17–20)

Chapter Topic What You Get
17 Reading & Writing Files cat, while read, mapfile, >,Β Β», heredoc, tee, mktemp
18 File Existence & Permissions -e/-f/-d/-r/-w/-x, defensive handling, chmod/chown in scripts
19 Working with Strings ${#var}, slicing, pattern removal, substitution, case conversion
20 sed & awk in Scripts Capturing output, template substitution, log parsing, regex with =~

Area 2 β€” Arrays & Loops (Ch 21–22)

Chapter Topic What You Get
21 Manipulating Arrays Indexed & associative arrays, slicing, sorting, array vs string
22 Iterating Through Lists Array loops, directory globs, command output loops, find & xargs

Area 3 β€” Error Handling & Debugging (Ch 23–24)

Chapter Topic What You Get
23 Handling Errors Exit codes, set -euo pipefail, trap, custom error functions
24 Debugging Techniques set -x, bash -x/-n, ShellCheck, debug mode, common bug fixes

Area 4 β€” Advanced Scripting (Ch 25–26)

Chapter Topic What You Get
25 Advanced Scripting Heredocs, here-strings, process substitution, subshells, eval/exec
26 Regular Expressions grep -E, =~ operator, BASH_REMATCH, POSIX classes, sed/awk regex

Area 5 β€” Interactive Scripts & Automation (Ch 27–30)

Chapter Topic What You Get
27 Interactive Scripts read prompts, input validation, select menus, getopts, y/n confirm
28 Menu-Driven Scripts CLI menus, sub-menus, dynamic arrays, ANSI colors, quit handling
29 Introduction to Automation What to automate, cron vs at vs systemd, backup scripts, log rotation
30 Scheduling with Cron crontab syntax, expressions, @reboot, cron env, logging output

Area 6 β€” Best Practices & Optimization (Ch 31–32)

Chapter Topic What You Get
31 Clean & Readable Code Naming conventions, commenting, script headers, function organization
32 Optimizing Scripts Avoid forking, builtins vs external, profiling, xargs & GNU parallel

🧭 The Full Linux Series


βœ… Prerequisites

You should be comfortable with:

  • Navigating the terminal and managing files (Part 1)
  • Understanding file permissions, users, and groups (Part 2)
  • Text processing with grep, sed, and awk (Part 2)
  • Basic shell usage β€” running commands, pipes, and redirection

If any of these feel unfamiliar, start with Part 1: Linux Basics and Part 2: Linux Advanced first.


πŸš€ Start Here

Ready to start scripting? Begin with Chapter 17: Reading & Writing Files β†’

Updated: