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 */
- Linux – What is yum?
- Linux – how to display file system disk space statistics
- Linux – How to compress an entire directory