Shell & Bash
Cheat sheet · https://pcornel.dk/topic.php?topic=362
Answer
Shell & Bash covers how commands are parsed, expanded, redirected, piped and run in interactive sessions and scripts, plus the environment and startup files that shape them.
Remember
Quote variables, check exit codes, and use set -euo pipefail in scripts. Interactive shells, login shells, cron and systemd all have different environments — test scripts the way they will run.
First checks
bash -x script.sh— trace each expanded commandshellcheck script.sh— common mistakestype <cmd>— alias, function, builtin or fileecho $?— exit code
Commands
sudo -i
Verify in this order
command line → expansions → redirections and pipes → program runs → exit status
Where it usually breaks
First mismatch in persistent intent → provider/parser/generator → kernel/userspace runtime → dependency/security context → logs/counters → consumer-visible read-back; preserve identity/native diagnostic/pre-state before mutation.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=362