Silly problem with "ls Command"

Hello folk,
I am new to LINUX environment.
my problem is to listing only ‘directories’ not the files in a given Dir.

I did “ls” , so its listed all the files and directories within that Dir.( I need only directories)

I Did
" ls -l | grep ^d "
its solving my purpose
BUT “ls -d” is not listing the dirs.

I need only list of dirs ( not the user:group etc as appear in long listing)

I need help

Thanks
Shariq

ls -d doesn’t mean list only directories, it means that if the argument happens to be a directory, then don’t list its contents but just itself.

To get a list of directories just under the current directory (that are not hidden), try

find * -maxdepth 0 -type d

Thanks ken_yap,
Its solved my problem.
“find is really a powerful Command”

Hi
Use;


ls -d */

or

ls -d */| cut -f1 -d /


Cheers Malcolm °¿° (Linux Counter #276890)
SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 2.6.27.45-0.1-default
up 19 days 0:44, 4 users, load average: 0.10, 0.19, 0.30
GPU GeForce 8600 GTS Silent - CUDA Driver Version: 195.36.15

On Tue, 2010-05-04 at 13:06 +0000, ken yap wrote:
> ls -d doesn’t mean list only directories, it means that if the argument
> happens to be a directory, then don’t list its contents but just itself.
>
> To get a list of directories just under the current directory (that are
> not hidden), try
>
> find * -maxdepth 0 -type d
>
>

find . -maxdepth 1 -mindepth 1 -type d

This won’t blow up your command line length and will include the hidden
dirs as well below the current dir.