how to list only directories in linux code example
Example 1: list only directories
# List directories under the current working directory.
ls -l | grep "^d"
# List directories under the current working directory and
# include hidden folders
ls -la | grep "^d"
Example 2: how to filter directory in linux
#directory structure:
- G10
- G11
- G12
- thisDir
#command to enter to filter for all the G?? directories:
ls -d G??
#entering this will return:
- G10
- G11
- G12