Why are there short and long alternatives for command line options?
Originally there were only single-character options. Some programs took multiple-character options, but still with a single dash. AFAIK double-dash multiple-character options come from GNU; they were introduced because they are more readable and often more memorable (and you can have more than 52 of them). Many programs now have both: short options for when you're typing on the command line and remember the character, long options for scripts or on the command line if you only remember the longer option name.
Another purpose I can see in having different ways of specifying parameters (short and long) is that when typing, Unix/Linux command-line folks like to have as short as possible commands. However, those can become cryptic, and if a script is written using those short versions, they can become hard to understand down the road. Using the long version can make the SAME command more readable and understandable by someone who is not the guru of this command, especially if this command is actually a locally written script as opposed to a well-known command.
You might guess that it is a matter of taste. When typing on the command line a short option might be preferred, especially in the case of run-together-options (e.g. ls -AL
). The long options are better at conveying intent, thus you don't need to consult the man page when you read ls --almost-all --dereference
.
Naturally, as you gain experience, you might learn that both of the -A
and -L
short options are sufficiently well known, and don't require this extra documentation. Especially in a complex command that may combine several commands in interesting ways with evaluation, redirection, etc. In such a case you might prefer brevity over documentation.