In most scripts (but mainly bash) it's commonplace to see some arguments that are configured like so:

bash-4.3:$ command --longer-argument -la

Where did this originate from? I'm mainly just curious as to why this became effectively a unanimous standard. Is it mainly for readability?

Also, why not use something like

bash-4.3:$ command -longer-argument, where all CLI arguments are specified by only one dash?


This can be helpful (for tar but I think it can be extended to other programs as well): https://www.gnu.org/software/tar/manual/html_section/tar_21.html

Long options are meant to be obvious and easy to remember, and their meanings are generally easier to discern than those of their corresponding short options (see below). For example:

$ tar --create --verbose --blocking-factor=20 --file=/dev/rmt0

gives a fairly good set of hints about what the command does, even for those not fully acquainted with tar.

Also this link Standards for Command Line Interfaces.

And here is a joke about GNU long options: https://www.gnu.org/fun/jokes/long-options.en.html

Usually running command -h/--help shows which options (short/long) the command provides.


You can't disambiguate options with arguments from one another unless a double-dash denotes a long one and a single dash signifies a short one.

-f file

...would mean the -f option with its file argument

...whereas --ffile would be a wholly different option without an argument.

Not the answer you're looking for? Browse other questions tagged or ask your own question.