List Directories in Unix and Linux Systems

Fig.01: List Directories in Unix and Linux Systems

Fig.01: List Directories in Unix and Linux Systems

Listing only directories in UNIX or Linux systems can be done with any one of the following command:

ls -l | grep '^d'
 
## or ##
ls -d */
ls -d .*/
 
## or ##
find . -type d -maxdepth 1
find /path/to/search/ -type d -maxdepth 1

For a more complete discussion of the ls command, see the online manual pages – ls(1),grep(1),find(1)

Examples and usage: HowTo: Linux / UNIX List Just Directories Or Directory Names