LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Reading '--help' in Linux (https://www.linuxquestions.org/questions/linux-newbie-8/reading-help-in-linux-730987/)

yanghwanim 06-05-2009 02:45 PM

Reading '--help' in Linux
 
I am confused on something. Lets say that I enter a command of # ls --help

and it echos out this:

sean@thebrains:~$ ls --help
Usage: ls [OPTION]... [FILE]...
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort.

Mandatory arguments to long options are mandatory for short options too.
-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'

-------------------------
Now if you look at the top argument ' -a --all' does the --all mean that, that is the long way to write the argument? Also '-A --almost-all, and the --author, what does that imply, that I need to use:'ls -A --almost-all --author' ??

Sorry for being a complete dumba**....

pkraus109 06-05-2009 02:48 PM

-a, --all do not ignore entries starting with .

-a and --all are the same command just two different methods of writing it. The more common practice now adays is to use the "long format" or the --all.

-A, --almost-all do not list implied . and ..
These two statements are also the same see explaniation above HOWEVER they are not the same as "-a --all" I suggest you run the two to see the difference.


ls --all
ls --almost-all

HTH,
Paul

CSIG 06-05-2009 02:50 PM

If you have difficulties with the built-in help response, then try 'man ls' or 'info ls'. Maybe these will be more readable to you.

colucix 06-05-2009 02:53 PM

Quote:

-A, --almost-all do not list implied . and ..
You have to read this statement literally: "do not list implied dot and dot dot". This means it does not list the shortcut of the current directory (dot) and the shortcut for the upper level directory (dot dot).

David the H. 06-05-2009 03:02 PM

AIUI, the long forms of options are designed mostly for use inside of scripts, where readability (i.e. quickly understanding what the command is doing) is important, and the effort of typing the full string only has to be done once.

For regular command line use, the short forms are more natural.

The "--help" option is usually only used as a quick reference. As mentioned above, read the man or info pages for detailed usage information.

noctilucent 06-05-2009 03:19 PM

Quote:

Originally Posted by pkraus109 (Post 3564530)
The more common practice now adays is to use the "long format"

Is it? How do you know this? And do you happen to know why 'generally' long options are preferred?

yanghwanim 06-05-2009 05:42 PM

I always assumed the short way was more popular, however the long way is easier to humanly understand.


All times are GMT -5. The time now is 12:50 AM.