Prev: commenting all lines with a particular substring
Next: [announcement] runawk-0.21.0 -- yet another power tool to program in shell
From: aioe on 31 Mar 2010 09:53 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 31 Mar 2010 09:56 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 31 Mar 2010 11:43 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 31 Mar 2010 11:53 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 31 Mar 2010 12:05
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. |