Shell (Bash)

The command-line scripting language for Unix/Linux system administration and automation.

Procedural
Scripting
Intermediate
1989
Brian Fox

Overview

Bash (Bourne Again SHell) is a Unix shell and command language. Shell scripting is essential for system administration, automating repetitive tasks, managing deployments, and creating CI/CD pipelines.

Key Features

  • Pipes & redirection — Chain commands into data pipelines
  • Process control — Background jobs, signals, subshells
  • Text processing — Integration with grep, sed, awk, cut, sort
  • Variables & arrays — Basic data structures for automation
  • Universally available — Pre-installed on virtually every Unix system

Code Example

bash
#!/bin/bash
find "${1:-.}" -type f -exec du -h {} + 2>/dev/null |
    sort -rh |
    head -5 |
    while read -r size file; do
        echo "📁 $size  $file"
    done

Learning Resources

Learning Path

11 topics across 3 sections

1Basics

  • Shell Fundamentals — Commands, arguments, shell types, and shebang lines
  • Variables — Assignment, expansion, environment variables, and quoting
  • Control Flow — if/then/else, case, for, while, until, and test conditions
  • I/O Redirection — stdin, stdout, stderr, pipes (|), and here documents

2Text Processing

3Scripting

  • Functions — Function definition, local variables, and return values
  • Arrays — Indexed and associative arrays, iteration
  • Process Management — Background jobs, signals, trap, and exit codes
  • Best Practices — set -euo pipefail, shellcheck, and defensive scripting