Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I did some searching, but I cannot find documentation on how Unix usage works. I know something (mostly through trial and error) but, for example, how do I know that

/usr/bin/ls  [-aAbcCdeEfFghHilLmnopqrRstuvVx1@] [file]...

means that you can include more than one option? That is,

ls -la

Where is some documentation on what the usage syntax is?

share|improve this question

migrated from Apr 23 '10 at 22:27

This question came from our site for professional and enthusiast programmers.

POSIX does have some say on how usage/help displays should be formatted, but beyond the core utilities (GNU), few follow it consistently. – Tim Post Apr 23 '10 at 17:17
@Tim, I don't have anything on usage there. – sixtyfootersdude Apr 23 '10 at 18:58
(please don't take this as a RTFM post it's more a funny comment) you can actually run 'man man' and scroll down to find the syntax guidelines. – ThinkBonobo Dec 18 '14 at 2:19
up vote 33 down vote accepted

It's true there is no RFC or anything, but you don't go too far off base if you stick to these guidelines:

  1. Anything in angle brackets < > means the option is required:

  2. Anything in square brackets [ ] means the option is optional:

  3. Options separated by a pipe | means those are the valid values:

  4. Single-letter options start with one dash:

  5. Multi-letter options start with two dashes:

  6. (based on #4) A single dash with multiple letters usually means the union of those individual single-letter options rather than a multi-letter option. Not all commands support that kind of union. Example:
    -aAbBcC is the same as -a -A -b -B -c -C

share|improve this answer
+1 - Teach a man to fish ... – Tim Post Apr 23 '10 at 17:14
man man or man 5 man – mpez0 Nov 13 '10 at 14:35
There's no RFC, but there are the POSIX specs, which include Utility Conventions – Wildcard Mar 5 at 2:00

There is no strict structure for man pages, but the following covers most commands.

From MANUAL PAGES(5), BSD File Formats Manual, section "MANUAL PAGE SYNTAX":

In manual page syntax, anything in a normal text font is required text. Anything in a boldface font is a flag or a subcommand. Anything underlined is a user-specified argument such as a filename.

Any argument surrounded by brackets is considered to be optional. For example, [ filename ] would indicate an optional filename argument.

Flags, arguments, or subcommands separated by a vertical separator (|) are mutually exclusive. For example, if -a turns on an option and -b turns off the option, the syntax for this command might be -a | -b.

In some cases, you may even see entire groups of arguments wrapped with brackets and separated by a vertical separator. This is one way of showing that a command has more than one valid syntax. In other manual pages, this is expressed by having multiple lines in the synopsis, each of which begins with the command name. The separated format is more common (and more readable), but is not always possible for commands with particularly complex syntax.

Finally, the most important notational convention is the use of the ellipsis (...). This indicates that additional arguments may be added at this point.

share|improve this answer

The usage lines don't follow anything consistent.

You should use man ls or info ls to get a more consistent level of information.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .