In man
pages I come across various syntaxes to write Linux/Unix commands, which include square brackets, angular brackets, hyphens (-
) and double hyphens (--
) in various combinations. Does anyone know the meaning of these syntax conventions?
[ ] < > [< >] [--] - -- [< >...]
A man page (short for manual page) is a form of software documentation usually found on a Unix or Unix-like operating system. Topics covered include computer programs (including library and system calls), formal standards and conventions, and even abstract concepts.
To use man , you type man on the command line, followed by a space and a Linux command. man opens the Linux manual to the “man page” that describes that command—if it can find it, of course. The man page for man opens. As you can see, this is the man(1) page.
The square brackets ( [ ] ) indicate that the enclosed element (parameter, value, or information) is optional. You can choose one or more items or no items. Do not type the square brackets themselves in the command line.
Square Brackets [ ]
The square brackets ( [ ] ) indicate that the enclosed element (parameter, value, or information) is optional. You can choose one or more items or no items. Do not type the square brackets themselves in the command line.
Example: [global options], [source arguments], [destination arguments]
Angle Brackets < >
The angle brackets ( < > ) indicate that the enclosed element (parameter, value, or information) is mandatory. You are required to replace the text within the angle brackets with the appropriate information. Do not type the angle brackets themselves in the command line.
Example: -f [set the File Name variable], -printer <printer name>, -repeat <months> <days> <hours> <minutes>, date access <mm/dd/yyyy>
In Unix-like systems, the ASCII hyphen–minus is commonly used to specify options. The character is usually followed by one or more letters. An argument that is a single hyphen–minus by itself without any letters usually specifies that a program should handle data coming from the standard input or send data to the standard output. Two hyphen–minus characters ( -- ) are used on some programs to specify "long options" where more descriptive option names are used. This is a common feature of GNU software.
Just do 'ls --help' and look at the options, it should be obvious to you.
-A, --almost-all do not list implied . and .. --author with -l, print the author of each file -b, --escape print octal escapes for nongraphic characters --block-size=SIZE use SIZE-byte blocks -B, --ignore-backups do not list implied entries ending with ~ -c with -lt: sort by, and show, ctime (time of last modification of file status information) with -l: show ctime and sort by name otherwise: sort by ctime' -C list entries by columns --color[=WHEN]
There is also uncommon {}
brackets used which from my search is for a required options that can be specified in mutually exclusive ways, ex {-A|--almost-all}
.
"{}" are used in conjunction with a vertical bar to indicate cases where exactly one of the specified options may be used
https://groups.google.com/forum/#!topic/comp.unix.programmer/XOr31SgvvS8
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With