How to list All Sub Directories in a Directory
Author: Venkata Sudhakar
We can list only sub directories in a given directory using ls command with -d flag and matching sub directory (*/) regex. Basically the regex filters sub directories in the directory and -d flag forces ls command to show only directories by hiding file names under the sub-directories in the output.
-d, --directory list directories themselves, not their contents
The below command lists all subdirectories under bethecoder folder
ls -d /home/ec2-user/bethecoder/*/