Hi Eric, thanks for the quick response and clarification. I wasn't completely clear what -d was supposed to do exactly. The man pages define ls -d as:
"list directory entries instead of contents".
The files in the target directory are contents of that directory, but they get listed anyway! I still think ls -d is not accurate. Here are some examples:
% \ls -d f1
f1
(but f1 is not a "directory entry" so this output is not consistent with the definition above.)
If:
% \ls /tmp/mydir
d1/ d2/ f1 f2
% \ls -d .
.
(but where are the rest of the directories?)
% \ls -d /tmp/mydir
/tmp/mydir
(Same thing, no listing of directory entries in that directory as the definition says)
The behavior I'm seeing is: list directory entries instead of contents, but not including the parent directory (or the directory specified as argument). I guess that's where the confusion is. IMHO, the directory that the user specifies should be the first to follow the rule, because that's what the user is concerned about the most.
% \ls -d *
can be accomplished by a simple:
% \ls
% \ls -d <directory I'm concerned about)
just does a pwd!
Thanks for the find command. That's what most of us have been doing, but I feel that listing directories/files/links should be an ls function more so than a find's, and it should be a simple command rather than a long one. If it were up to me, this is what I would do:
% ls -f (list files)
% ls -l (list links)
% ls -d (list directories)
This is more intuitive and useful, at least to me.
The man pages for ls -f say: "do not sort" I'm not sure how -f was derived from that.
Since these switches are already taken to do other things, what do you think about this:
% ls -fo (list files only)
% ls -lo (list links only)
% ls -do (list directories only)
For now, I like your solution: ls -d */ which I'll be using instead of the find command. I'll have to "tolerate" the extra slash at the end, but I like this better than other options. Thanks again.
Eddie