CTCaliberTek

Shell Scripting for Linux and Unix: From First Script to Automation

Learn Bash from the first script: variables, quoting, tests, loops, functions, pipes, grep, sed and awk, safe scripts, a backup project, cron, and debugging.

8 lessons · about 86 minutes of reading

Log in to track your progress through this course.

Start lesson 1
  1. 1

    Shell Scripting for Beginners: Your First Bash Script on Linux

    Learn what a shell script is, write your first Bash script with a shebang, make it executable, read exit codes, and run it from anywhere.

    9 min read

  2. 2

    Bash Variables, Quoting, and Reading User Input

    Learn how Bash variables work, why quoting matters, how to capture command output, do arithmetic, read input, and use script arguments.

    10 min read

  3. 3

    Bash Conditionals: if Statements, Test Operators, and case

    Make decisions in shell scripts with if, elif, double-bracket tests, file checks, numeric comparisons, logical operators, and case statements.

    10 min read

  4. 4

    Bash Loops, Arrays, and Functions Explained

    Repeat work with for and while loops, store lists in arrays and associative arrays, and organize scripts with functions and return values.

    11 min read

  5. 5

    Shell Pipes, Redirection, grep, sed, and awk for Text Processing

    Connect commands with pipes, redirect input and output, and process text with grep, cut, sort, uniq, sed, awk, find, and xargs.

    12 min read

  6. 6

    Writing Safe Bash Scripts: set -euo pipefail, getopts, and trap

    Make Bash scripts reliable with strict mode, argument validation, getopts options, trap cleanup, safe deletion, and ShellCheck.

    11 min read

  7. 7

    Shell Scripting Project: A Backup Script with Rotation and a Log Report

    Build a complete Bash backup script that creates timestamped archives, verifies them, deletes old backups, and add a log summary script.

    12 min read

  8. 8

    Schedule and Debug Shell Scripts: cron, bash -x, and Portability

    Schedule Bash scripts with cron, avoid the common cron environment problems, debug with bash -x, and write scripts that work on Linux and macOS.

    11 min read