I have been adjusting to using GETOPT and GETOPTS in my shell scripts and custom functions to enable me to use the functions that I create more flexibly. After using a number of UNIX functions I have realized that a lot of them use a somewhat similar syntax.

Examples being -v for verbose output and -R/-r for recursive functionality.

I looked at the POSIX standard guide for utility conventions and the GNU's option tables for C based utilities. In an attempt to understand whether this was by design and if there are any rules that I should be following.

My questions are:
1. Are there are any specific option flags that have designated meaning?
2. How much freedom do I have with my options and which rules shouldn't I break?
3. Should I stay way from giving options like -t and -T different meanings, or should I group them together for simplicity?
4. What situations should I use uppercase or lowercase letters?

  • 1
    There is no such standard that I am aware of, option names change between programs. See for example, here. While there are some standards for GNU programs (--version and --help for example), AFAIK these are not universal.
    – terdon
    Commented Jan 6, 2014 at 11:56
  • Just for context, the long form --help option was added to GNU coretutils in '93. From changelog : (for 21 commands) Add long --help. Exit successfully for --help, non-zero for usage error.
    – user44370
    Commented Jan 6, 2014 at 17:48

1 Answer 1


There are no fast and firm rules, or even common conventions. At most, there are a few options that are used consistently across some common utilities — but not across all common utilities.

Here are a few common letters — but remember that these are by no means universal conventions. If you have one of the features described below, it's better if you use the corresponding option. If one of the options doesn't make sense for your utility, feel free to use it for something else.

  • -c COMMAND or -e COMMAND: execute a command. Examples: sh -c, perl -e.
  • -d or -D: debug.
  • -f: force, don't ask for confirmation for dangerous actions.
  • -h: help — but many utilities only recognize the long option --help or nothing at all. Examples: Linux getfacl, mount. Counter-examples: GNU ls, du, df (no short option, -h is human size), less (-? is help, -h is something else).
  • -i: prompt for confirmation (interactive).
  • -n: do not act, just print what would be done. Example: make.
  • -r or -R: recursive.
  • -q or -s: quiet or silent. Example: grep -q means display no output, grep -s means display no error message.
  • -v: verbose.
  • -V: show version information.

Traditionally lowercase letters are used, and uppercase letters only came into use because there are only 26 lowercase letters. Sometimes uppercase letters have something to do with the corresponding lowercase letter (example: GNU grep -h/-H, ssh -x/-X, cp -r/-R), sometimes not.

You must log in to answer this question.

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