Linux – How to only list directories in an LS Command?

Linux, LS Command, How to only list directories in an LS Command

Linux, LS Command

Occasionally, there is a need to view only a list of directories.  This is relatively easy, depending on your need.  Here are a couple of commands to pull a list of only the directories in the current folder.

LS Command for Directory list, which provides details

List approach give the list of classic details of the ls command, but only returns directories in the list.

ls -l | grep “^d”


LS Command for Directory list with no extras

This approach can be useful, when needing a list without unnecessary content for scripts.

ls -d */

Related References