Command-Line Flags Reference
The same flag conventions appear in git, docker, kubectl, curl, rsync, npm, and most Unix tools. Learn them once, recognise them everywhere.
POSIX flag conventions
- Short flags use a single dash:
-r,-f,-v. Often stackable:-rf=-r -f. - Long flags use double dash:
--recursive,--force. Never stack. - Flags before arguments by convention:
rm -rf old/notrm old/ -rf(though most tools accept both). - Use
--to end flag parsing — useful when a filename starts with-:rm -- -weird-name.txt.
-r, -R, --recursive
Recursive
Apply the operation to every file in a directory tree, going into all sub-directories.
Examples
rm -r build/— Delete the build folder and everything inside it.cp -r src/ src-backup/— Copy a directory and its contents.grep -r "TODO" .— Search for "TODO" in every file under the current directory.chmod -R 755 public/— Set permissions on the folder and every file inside it.
How engineers say it: "recursive" or just "the dash-r flag"
⚠️ Order matters with some tools — rm -rf old/ is fine, but always type the path AFTER the flags, never with a leading slash by accident.
-f, --force
Force
Skip confirmation prompts and proceed even when the action would normally be blocked or warned about.
Examples
rm -f config.bak— Delete without prompting, even if the file doesn't exist.git push --force— Overwrite the remote branch — destructive on shared branches.docker rm -f web— Stop and remove a running container in one step.mv -f src.txt dst.txt— Overwrite destination without asking.
How engineers say it: "force" or "the force flag"
⚠️ git push --force on a shared branch can destroy other people's commits. Use --force-with-lease instead — it refuses to overwrite changes you have not seen.
-v, --verbose
Verbose
Print extra detail about what the command is doing. Useful for debugging.
Examples
rm -v *.tmp— Print every file being removed.curl -v https://example.com— Show request headers, response headers, and TLS handshake info.rsync -v src/ dst/— List every file being transferred.ssh -v user@host— Print debug output during the SSH connection.
How engineers say it: "verbose" or "with verbose output"
⚠️ Some tools use -vv or -vvv for increasing verbosity (Ansible, ssh). More v's = more output.
-q, --quiet, --silent
Quiet / Silent
Suppress non-essential output. Useful in scripts where you only care about the exit code.
Examples
grep -q "ERROR" log.txt— Returns exit code 0 if "ERROR" is found, no output.curl -s https://api/health— No progress bar, no errors — just the response body.rm -f --quiet bad.tmp— Silent removal (no message if file doesn't exist).
How engineers say it: "quiet" or "silent mode"
⚠️ In curl, -s also suppresses errors. Pair with -S to show errors but hide the progress bar: curl -sS.
-h, --help
Help
Print the command's usage information and exit.
Examples
git --help— List all git subcommands.docker run --help— Show options for docker run.curl -h— Show curl options.
How engineers say it: "the help flag" or "dash-help"
⚠️ -h sometimes means something else (e.g. du -h means "human-readable sizes"). When in doubt, use --help — the long form is consistent.
--dry-run, -n
Dry Run
Show what the command WOULD do without actually doing it. Critical safety flag for destructive operations.
Examples
rsync --dry-run -av src/ dst/— List files that would be transferred, transfer nothing.git push --dry-run— Show what would be pushed, push nothing.kubectl apply -f deploy.yaml --dry-run=client— Validate the manifest without applying it.npm publish --dry-run— Show what would be published without uploading.
How engineers say it: "dry run" or "dry run it first"
⚠️ Not all tools support --dry-run — rm notably does not. For destructive operations without dry-run support, redirect to a temp dir or use a find ... -print first to preview what would be affected.
-y, --yes, --assume-yes
Auto-Yes
Automatically answer "yes" to all confirmation prompts. Used in scripts where you can't respond interactively.
Examples
apt-get install -y nginx— Install without confirmation prompts.docker system prune -f— Use -f as "yes" — skip the "are you sure?" prompt.yes | npm install— Pipe the 'yes' command to answer Y to anything (legacy trick).
How engineers say it: "dash-y" or "auto-confirm"
⚠️ Be careful in CI scripts — auto-answering "yes" to every prompt can mask migration confirmations you actually wanted to see.
--no-X, --without-X
Negation flag
Disable a feature that is on by default.
Examples
git commit --no-verify— Skip pre-commit hooks.git merge --no-ff feature/x— Force a merge commit even when fast-forward is possible.docker build --no-cache .— Ignore the layer cache; rebuild every step.npm install --no-save— Install without writing to package.json.
How engineers say it: "with --no-cache" or "the no-verify flag"
⚠️ Bypassing checks like --no-verify is sometimes necessary for emergencies but is often a code smell — it usually means the hook is misconfigured, not the commit.
-i, --interactive
Interactive
Prompt for confirmation before each step instead of acting automatically.
Examples
rm -i *.log— Ask before deleting each log file.git rebase -i HEAD~5— Open an editor to reorder/squash the last 5 commits.docker run -it ubuntu bash— Attach an interactive terminal to the container.
How engineers say it: "interactive" or "interactive mode"
⚠️ In Docker, -it is the combination of -i (interactive) and -t (allocate a TTY). Use it whenever you want to type into the container.
-o, --output
Output
Specify where the command should write its output — a file, a format, or a directory.
Examples
curl -o page.html https://example.com— Write the response body to page.html.kubectl get pods -o yaml— Output in YAML format instead of the default table.docker build -o type=local,dest=./out .— Export the build result to a local directory.gcc -o myapp main.c— Name the compiled binary "myapp".
How engineers say it: "output to" or "with -o"
⚠️ In kubectl, -o yaml and -o json are essential for scripting — much easier to parse than the default human-readable table.
--version, -V
Version
Print the tool's version string and exit. Always useful when reproducing bugs.
Examples
node --version— Print Node.js version.docker -v— Print Docker version.git --version— Print Git version.
How engineers say it: "version" or "what version are you on?"
⚠️ Lowercase -v usually means "verbose"; uppercase -V or long-form --version is the safe way to ask for version.
English phrases engineers use
- "Always dry-run it first on destructive commands."
- "You'll need to
--forcethe push, but be careful — that branch is shared." - "Run it with -v so we can see what's failing."
- "The script passes -y to skip the confirmation prompt in CI."
- "Don't recursively chmod 777 — that opens every file to everyone."
- "
kubectl apply --dry-run=clientfirst, then apply for real."