list directory with ls command in linux/unix
September 10, 2020
In Linux/unix, the ls command is used to list files and directories in a directory.
So can we use the ls command to list only directories? of course can.
With the ls -d option, you can only list the directories of the current directory, not recursively.
Open the terminal and type the following command:
➜ ~ ls -d */

In addition to the most direct methods above, we can also use the grep command and the find command.
Use ls command and grep command
➜ ~ ls -l | grep '^d'

Use find command
➜ ~ find . -type d -maxdepth 1 ! -name ".*"
