How to list folders using bash commands?

You can use:

ls -d -- */

Since all directories end in /, this lists only the directories in the current path. The -d option ensures that only the directory names are printed, not their contents.


Stephen Martin's response gave a warning, and listed the current folder as well, so I'd suggest

find . -mindepth 1 -maxdepth 1 -type d

(This is on Linux; I could not find -maxdepth and -mindepth in the POSIX man page for find)


find . -maxdepth 1 -type d

Will list just folders. And as Teddy pointed out you'll need -maxdepth to stop it recusrsing into sub dirs