Is there any option with 'ls' command that I see only the directories?

I know there is already a selected answer, but you can get the requested behavior with just ls:

ls -ld -- */

(Note that the '--' marks the end of parameters, preventing folder names beginning with a hyphen from being interpreted as further command options.)

This will list all the non-hidden (unless you configure your shell's globs to expand them) directories in the current working directory where it is run (note that it also includes symbolic links to directories). To get all the subdirectories of some other folder, just try:

ls -ld /path/to/directory/*/

Note that the -l is optional.


No, but a simple find command will do it:

find . -type d -depth 1

or grep

ls -F | grep /

You could then alias either one if necessary.


I like the tree utility to get an overview over the directory structure. It's available in MacPorts and all Linux distributions I've tried.

tree -d -L 2

That would show all directories, two levels deep.

Tags:

Utilities

Ls