Usage message
In computer programming, a usage message or help message is a brief message displayed by a program that utilizes a command-line interface for execution. This message usually consists of the correct command line usage for the program and includes a list of the correct command-line arguments or options acceptable to said program. Usage messages are utilized as a quick way for a program to inform the user of proper command syntax, and should not be substituted for proper error messages or for detailed documentation such as a man page.
In computer programming, a usage message or help message is a brief message displayed by a program that utilizes a command-line interface for execution. This message usually consists of the correct command line usage for the program and includes a list of the correct command-line arguments or options acceptable to said program. Usage messages are utilized as a quick way for a program to inform the user of proper command syntax, and should not be substituted for proper error messages or for detailed documentation such as a man page. ==Pattern== On Unix-like platforms, usage messages usually follow the same common pattern: They often begin with "Usage:", the command, followed by a list of arguments. To indicate optional arguments, square brackets are commonly used, and can also be used to group parameters that must be specified together. To indicate required arguments, angled brackets are commonly used, following the same grouping conventions as square brackets. Exclusive parameters can be indicated by separating them with vertical bars within groups. ==Examples== Here is an example based on the NetBSD source code style guide: Usage: program [-aDde] [-f | -g] [-n number] [-b b_arg | -c c_arg] req1 req2 [opt1 [opt2]] This would indicate that "program" should be called with: options without operands: , , , (any of which may be omitted). Note that in this case some parameters are case-sensitive exclusive options: , (denoted by the vertical bar) options with operands: exclusive options with operands: , required arguments: , optional argument , which may be used with or without (marked optional within the group by using another set of square brackets) optional argument , which requires ==Implementation== To print a usage statement in a shell script, one might write: case "$arg" in ... h) printf 'Usage: %s parameter1 parameter2 ...\n' "$(basename "$0")" exit 0 ;; ... esac ==See also== Command-line interface ==References==
References
- CS 11: How to write usage statements · retrieved 2026-11-17 · rev 1352272202
Cite this reference
MLA "CS 11: How to write usage statements." 2026-11-17. https://courses.cms.caltech.edu/cs11/material/general/usage.html. Accessed 24 November 2026.
Chicago "CS 11: How to write usage statements." 2026-11-17. https://courses.cms.caltech.edu/cs11/material/general/usage.html.
APA encyclopegia.org. (2026). CS 11: How to write usage statements. Retrieved November 24, 2026, from https://courses.cms.caltech.edu/cs11/material/general/usage.html
- Usage Statements (Common Desktop Environment: Internationalization Programmer's Guide) · retrieved 2026-11-17 · rev 1352272202
Cite this reference
MLA "Usage Statements (Common Desktop Environment: Internationalization Programmer's Guide)." 2026-11-17. https://docs.oracle.com/cd/E19455-01/806-2914/6jc3mhd5q/index.html. Accessed 24 November 2026.
Chicago "Usage Statements (Common Desktop Environment: Internationalization Programmer's Guide)." 2026-11-17. https://docs.oracle.com/cd/E19455-01/806-2914/6jc3mhd5q/index.html.
APA encyclopegia.org. (2026). Usage Statements (Common Desktop Environment: Internationalization Programmer's Guide). Retrieved November 24, 2026, from https://docs.oracle.com/cd/E19455-01/806-2914/6jc3mhd5q/index.html
Cite this article
MLA
"Usage message." encyclopegia.org, 2026, https://encyclopegia.org/wiki/usage-message. Accessed 24 November 2026.
Chicago
"Usage message." encyclopegia.org. Accessed November 24, 2026. https://encyclopegia.org/wiki/usage-message.
APA
encyclopegia.org. (2026). Usage message. Retrieved November 24, 2026, from https://encyclopegia.org/wiki/usage-message
Accessed November 24, 2026 · CC BY-SA 4.0 · citation page · JSON