May 10, 2012
tom

What’s the difference betwen the single dash and double dash flags on shell commands?

Question

I’m new to working in the shell and the usage of these commands seems arbitrary. Is there a reason one flag has a single dash and another might have a double dash?

Asked by kylex

Answer

A single dash can be followed by multiple single character flags. A double dash prefixes a single, multicharacter option. For example:

tar -czf

That is three different options: c, z, and f. Compared to:

tar --exclude

The double dash makes disambiguates whether it is “exclude” or e, x, c, l, u, d, e combined.

Answered by psusi

No related posts.

Leave a comment