How to List only directories in Linux
ls command is used in linux to list the files in current directory or the specified directory. However it doesn’t list the directories only in the given directory. We can use ls with the combination of grep command to list only directories in a given directory. ll is the short form of long listing of directory and is used to show detailed listing of files and directories in the current/specified directory. It can also be used with grep command to list only directories.
Type the following command:
|ls -l | grep ^d|
Another form of this command is:
|ll | grep ^d|
We can also use the following command to list only directories:
|ls -d */|