ls and its parameters

I just need syntax for ls whereby I get a list of subdirectories also but without the files existing in it!!
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

As far as I know there's not any universal way to list only directories with "ls". It can be done easily, however, with "find". The command that you'd use would be "find path -type d -print". Most implementations of "find" allow you to leave off the "-print", that being the default. behaviour. By default "find" recursively descends into directory trees. On implementations that support it (GNU find for one), you can get a behaviour more like "ls" by using "find path -type f -maxdepth 1 -print". For more information, see the man pages for "find".

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial

   # ls -Rd  

   I'm not sure how the output looks like.

  Why don't you try the du command

   # du .   <- this will give you a listing of directories within current dir along with the total size for each.  and a cummulative at the end of the listing.

   If you want just the dirname and not the figures, pipe the command to a "cut"  

   # du . | cut -d" " -f1

I hope this helps,

evansnfAuthor Commented:
Samri.... I used du.... it's what I reqd.... Thanx
try this
ls -Rl|egrep "^d"
this will look for a d in the first char, which all dirs have
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.