LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   what are the options with double hyphen (https://www.linuxquestions.org/questions/linux-newbie-8/what-are-the-options-with-double-hyphen-934188/)

xombboxer 03-13-2012 04:30 AM

what are the options with double hyphen
 
i have seen if i do man ls i get to see some options with double hyphen (--)

for example

--author

Can anyone elaborate on this

fukawi1 03-13-2012 04:40 AM

They function the same as their shorter counter parts. "cp -r", works the same as "cp --recursive"
you can use them in the same way as you would a normal option. ie:
Code:

$ ls -lha --author --color
They are often multiple words, delimited by a hyphen, ie:
Code:

$ ls -lha --author --color --full-time
They're typically called long options.

Edit: I should also add, their doesnt HAVE to be a short cut for a long option, as is the case with my examples.

xombboxer 03-13-2012 12:36 PM

you mean i can use either way like
ls --l, ls -l, or ls --long
i don't think i can

there must be some specific reason.

you said there is no special meaning to them, in that case why only few option have double hyphen?

chrism01 03-13-2012 07:21 PM

I think you have misunderstood.
Some(!) options to some(!) cmds have '--' versions, but not all.
There's no rule as to which.
In traditional *nix, all tool options were short, but when the GNU toolset came along (ie free toolset), they started adding long versions to make them easier to read.
In fact you may see them referred to as GNU-style options.
You just have to read the man page or eg http://linux.die.net/man/ for a given cmd to see which ones exist.
In some cases a new long option was introduced to a cmd because the obvious one-letter version was already taken, but had a different meaning to the new option.

you may want to read this and the links therein http://stackoverflow.com/questions/4...d-line-options

Satyaveer Arya 03-14-2012 12:36 AM

Quote:

ls --l, ls -l, or ls --long
Wrong! You have misunderstood what fukawi1 has said.
If you see the man page of ls there is only -l, not --l. And for some of the switches there are --(double hyphens) used and -(single hyphen) for shortcut of those --(double hyphens), e.g., '-i' is the shortcut for '--inode', '-a' is the sortcut for '--all'. I again repeat refer to man pages and try to understand those man pages. :)


All times are GMT -5. The time now is 10:35 AM.