What is -p (context-dependent) (Port / Parents / Publish)?
-p (context-dependent) (Port / Parents / Publish): One of the most overloaded short flags in CLI tooling — meaning depends entirely on the command. -p is a short flag with no fixed meaning. In docker run -p 8080:80 it publishes a port. In mkdir -p it creates parent folders as needed. In ssh -p 2222 it sets the port, in mysql -p it asks for a password, and in git add -p it lets you stage a file in pieces.
How is -p (context-dependent) (Port / Parents / Publish) used in practice?
So knowing what -p did in one tool tells you nothing about the next. Read the help text, or better, use the long option where it exists, such as --publish or --parents.
What should you keep in mind with -p (context-dependent) (Port / Parents / Publish)?
The ones worth remembering are mkdir -p, which makes a script safe to run twice, and git add -p, which lets you split unrelated changes into separate commits. That last one makes reviews much easier, because each commit then does one thing.
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.