Panasonic Youth

Comand Line Tip: How to List Only Directories

Finding this took over three tries with Google, which means it took too long and that I’ll forget as soon as I need to do it again.

To list only directories in the current directory, this does the trick:

ls -d */

Though it doesn’t make since to me, because the -d option for ls says:

-d Directories are listed as plain files (not searched recursively).

And “ls -d” alone doesn’t do anything for me…but whatever.

There are some other ways discussed here at the Ubuntu log.