Cheat sheet

Bash Scripting Cheat Sheet

Bash patterns for safer beginner scripts.

Bash Scripting Cheat Sheet banner
Practice next

Read the concept, then use a quiz, builder or checklist to make it stick.

Quick reference

AreaCommands or meaning
Variablesname="site" and always quote "$name"
Arguments$1, $2, "$@", $#
Tests[[ -f file ]] and [[ "$x" == value ]]
Loopsfor file in *.log; do ...; done
Functionsfunction_name() { ...; }
Exit codescommand; echo $?
Safetyset -u, dry runs, backups

How to use it

Do not memorise every flag. Memorise the situation, the first command to run, and how to check whether the output makes sense.

Practice prompt

Pick three entries from the table and create a tiny lab. For example, make test files, search them, change permissions, and explain what changed.