From: aioe on
Is there some way to use the ls command that is equivalent to
"find . -type d" ? If not, what is the -d option good for?
From: pk on
aioe wrote:

> Is there some way to use the ls command that is equivalent to
> "find . -type d" ? If not, what is the -d option good for?

It's good for when you want to look at the directory's properties (owner,
permissions etc.) rather than what's in it, since if you do "ls directory"
that shows you the directory's contents rather than the directory itself.

So, "ls -l directory" shows the files in the directory; "ls -ld directory"
shows the properties of the directory itself.
From: Bill Marcum on
On 2010-03-31, aioe <worKEEPSPAMOUTwor(a)bellsouth.net> wrote:
> Is there some way to use the ls command that is equivalent to
> "find . -type d" ? If not, what is the -d option good for?

If you want to see directory permissions and timestamps, with GNU find you
can use "find . -type d -ls". Or you can type "ls -ld */ " but that will
only show directories within the current directory.


--
THEY'RE IN UR BED, EATING UR DREAMZ
From: aioe on
On 3/31/2010 7:56 AM, pk wrote:

> So, "ls -l directory" shows the files in the directory; "ls -ld directory"
> shows the properties of the directory itself.

For that, I just invoke ls -l from one level higher in the directory
tree, but I suppose -d might be useful in scripts.

From: aioe on
On 3/31/2010 9:43 AM, Bill Marcum wrote:

> If you want to see directory permissions and timestamps, with GNU find you
> can use "find . -type d -ls". Or you can type "ls -ld */ " but that will
> only show directories within the current directory.

Usually I simply want to see the directory structure. du is the
shortest command to type, but it is slow if there are a lot of files.
find -type d is fast and does the job, but ls -dR would be easier to
type, if only it worked as I would expect. This has bothered me for
years, so I thought to ask.