LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-13-2012, 05:30 AM   #1
xombboxer
Member
 
Registered: Apr 2011
Posts: 63

Rep: Reputation: 0
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

Last edited by xombboxer; 03-13-2012 at 05:33 AM.
 
Old 03-13-2012, 05:40 AM   #2
fukawi1
Member
 
Registered: Apr 2009
Location: Melbourne
Distribution: Fedora & CentOS
Posts: 854

Rep: Reputation: 193Reputation: 193
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.

Last edited by fukawi1; 03-13-2012 at 05:41 AM. Reason: Additional Info
 
Old 03-13-2012, 01:36 PM   #3
xombboxer
Member
 
Registered: Apr 2011
Posts: 63

Original Poster
Rep: Reputation: 0
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?
 
Old 03-13-2012, 08:21 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,407

Rep: Reputation: 2783Reputation: 2783Reputation: 2783Reputation: 2783Reputation: 2783Reputation: 2783Reputation: 2783Reputation: 2783Reputation: 2783Reputation: 2783Reputation: 2783
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
 
1 members found this post helpful.
Old 03-14-2012, 01:36 AM   #5
Satyaveer Arya
Senior Member
 
Registered: May 2010
Location: Palm Island
Distribution: RHEL, CentOS, Debian, Oracle Solaris 10
Posts: 1,420

Rep: Reputation: 305Reputation: 305Reputation: 305Reputation: 305
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
tar options, hyphen? heyduke25 Linux - Software 6 08-05-2009 04:03 PM
what does the hyphen mean? linuxtyh Linux - General 3 12-10-2008 06:46 AM
How to cd into dir starting with hyphen? JussiKp Linux - Newbie 2 11-05-2006 09:59 PM
perl: what does the hyphen in function call params mean? johnMG Programming 2 08-19-2005 05:17 PM
What are those double-dash (--) options in man? Utah Linux - Newbie 4 06-04-2004 11:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration