Reading Man Pages & CLI Help
5 exercises on decoding CLI synopses, flags, exit codes, and option descriptions from git --help, curl --help, and similar tools.
Key patterns for reading man pages and CLI help
[ ]= optional,<>= required placeholder,|= choose one- Exit code 0 = success; 128+n = killed by signal n (130 = Ctrl+C)
- Short flags (
-v) and long flags (--verbose) usually do the same thing - Check the description, not just the synopsis, for "Required" flags hidden in OPTIONS
0 / 5 completed
1 / 5
Read this excerpt from
In this synopsis, what do the square brackets
git --help:usage: git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]
[--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p | --paginate | -P | --no-pager] [--no-replace-objects]
[--bare] [--git-dir=<path>] [--work-tree=<path>]
[--namespace=<name>] [--super-prefix=<path>]
[--config-env=<name>=<envvar>] <command> [<args>]In this synopsis, what do the square brackets
[ ] around options signify?Square brackets
This is a universal convention across man pages, GNU help output, and POSIX documentation:
[ ] in CLI synopses denote optional elements.This is a universal convention across man pages, GNU help output, and POSIX documentation:
[option]— optional; you may include or omit it<arg>— a mandatory placeholder (angle brackets = fill this in)(-a | -b)or[-a | -b]— mutually exclusive options (choose one or neither)...— one or more of the preceding element
[-v | --version]— optionally print the version[-C <path>]— optionally change to <path> before running<command>— required; this is the git subcommand (e.g.,commit,push)[<args>]— optional arguments to the subcommand
Next up: More Reading exercises →