What is -x, --exclude, -x (trace) (Extract / Exclude / Trace)?
-x, --exclude, -x (trace) (Extract / Exclude / Trace): Extracts an archive, excludes a pattern from an operation, or turns on shell execution tracing — three unrelated meanings sharing one letter. -x has at least three unrelated meanings. In tar -xf archive.tar it extracts files. In rsync --exclude and zip -x it leaves matching files out. In bash -x script.sh, or set -x inside a script, it prints every command before it runs.
How is -x, --exclude, -x (trace) (Extract / Exclude / Trace) used in practice?
The tracing meaning is the one worth knowing for debugging. When a shell script fails and you cannot see why, add set -x near the top. You will see each line with its variables already filled in, which usually shows the wrong path or empty value straight away.
What should you keep in mind with -x, --exclude, -x (trace) (Extract / Exclude / Trace)?
Remove it again when you are done. A trace prints everything, including tokens and passwords that pass through variables. That is fine on your own machine, but not in a CI log that a whole team or the public can read.
Use before running or suggesting shell commands with flags, especially destructive or broad ones (-f/--force, -r/-R recursive, -a/--all, -y/--yes, prune, --hard), and when a user asks what a flag means (-v, -q, -n/--dry-run, -h, -o, -p, -t, -u, -w, -x, -c, -i). Explains flags per tool and prefers dry runs and narrow scopes.
Use this skill before running, or recommending, any Docker command that deletes, wipes, resets, or otherwise irreversibly changes state — even if the user just says to "clean up", "clear the cache", "start fresh", "wipe everything", "nuke it", "reset", "force remove", or "tear down" Docker resources. Covers generic Docker CLI destructive operations not owned by a more specific skill — `docker rm`,
Master ShellCheck static analysis configuration and usage for shell script quality. Use when setting up linting infrastructure, fixing code issues, or ensuring script portability.