What's the difference between one-dash and two-dashes for command prompt parameters?

Just do ls --help and look at the options and then it will be clearer.

It has nothing to do with parameters at all. Many options have a short form and a long form, and many have one and not the other.

And also, regarding parameters, it's simply that in the long form when they take a parameter it looks like it's always with an equals. But obviously short ones can take parameters just as much; just they don't use an equals.

Here is an extract from ls --help (man ls gives equivalent information). Notice how some have a long form without a short form (--author, --block-size), some have a short form without a long form (-c, -f, -g), and some have both a long form and a short form (-A/--almost-all, -b/--escape).

 -a, --all                  do not ignore entries starting with .
 -A, --almost-all           do not list implied . and ..
     --author               with -l, print the author of each file
 -b, --escape               print octal escapes for nongraphic characters
     --block-size=SIZE      use SIZE-byte blocks
 -B, --ignore-backups       do not list implied entries ending with ~
 -c                         with -lt: sort by, and show, ctime (time of last
                              modification of file status information)
                              with -l: show ctime and sort by name
                              otherwise: sort by ctime
 -C                         list entries by columns
     --color[=WHEN]         control whether color is used to distinguish file
                              types.  WHEN may be `never', `always', or `auto'

There is no widespread standard. There's some consistency e.g. in GNU programs, but you need to check each program's documentation.

Quoting Wikipedia, emphasis mine:

In Unix-like systems, the ASCII hyphen–minus is commonly used to specify options. The character is usually followed by one or more letters. An argument that is a single hyphen–minus by itself without any letters usually specifies that a program should handle data coming from the standard input or send data to the standard output. Two hyphen–minus characters ( -- ) are used on some programs to specify "long options" where more descriptive option names are used. This is a common feature of GNU software.

Usually, hyphens indicate a predefined argument. I think it's used to differentiate them from e.g. file names or other labels you might use as arguments. That's not always the case, though (see below).


You'll often find the same argument available both as short and long option, as e.g. in ls.

Some programs use a single hyphen for one-character options, and two hyphens for multi-character options, but not all (GNU find comes to mind). Some programs have optional hyphens or skip them altogether (tar or BSD ps come to mind).

Sometimes long options (--foo) require arguments, while short options (-f) don't (or at least imply a specific default argument).

Short options (e.g. cut -d ' ') can have arguments , while long options (e.g. ls --all) don't necessarily have them.

To set a particular behavior of a program, you sometimes need to use a short option, for others you need to use a long option, and for some you have a choice.

On a related note, some programs can handle no whitespace between an option and its argument, while others can't.

As I wrote at the beginning, there just is no common behavior or standard. Often you can trace similar behavior to the same library used for argument parsing, but you probably don't want to read the sources to find this out.

You really cannot infer one program's argument syntax from another's.


If you also consider Windows, it gets even worse: While the Windows command line calls traditionally use /f (at least most of the time, single characters) for options, with : as the separator between options and their value (see e.g. here); cross-platform utilities are widespread (such as those you mention) and bring along the more common hyphen syntax for arguments, with all the inconsistencies mentioned above.


This is a convention coming from *nix. Double hyphen precedes options when they are written in full, , while single hyphen precedes options when they are written in short form. For example ls --all --l, can be shortened to ls -al. As it is seen, not all options have their single letter equivalents, although more used ones usually do.

Whether the option takes an argument doesn't really make a difference - it can either take them, or not take them, regardless of the way you enter the option.

When writing them for one time usage, it doesn't really matter, but when writing commands for example in .alias files, it is customary to use the full-form. Purely for the ease of reading for the next person.