Go to the first, previous, next, last section, table of contents.

Standards for Command Line Interfaces

Please don't make the behavior of a utility depend on the name used to invoke it. It is useful sometimes to make a link to a utility with a different name, and that should not change what it does.

Instead, use a run time option or a compilation switch or both to select among the alternate behaviors.

It is a good idea to follow the POSIX guidelines for the command-line options of a program. The easiest way to do this is to use getopt to parse them. Note that the GNU version of getopt will normally permit options anywhere among the arguments unless the special argument `--' is used. This is not what POSIX specifies; it is a GNU extension.

Please define long-named options that are equivalent to the single-letter Unix-style options. We hope to make GNU more user friendly this way. This is easy to do with the GNU function getopt_long.

It is usually a good idea for file names given as ordinary arguments to be input files only; any output files would be specified using options (preferably `-o'). Even if you allow an output file name as an ordinary argument for compatibility, try to provide a suitable option as well. This will lead to more consistency among GNU utilities, so that there are fewer idiosyncracies for users to remember.

Programs should support an option `--version' which prints the program's version number, and an option `--help' which prints option usage information.


Go to the first, previous, next, last section, table of contents.