By default when you run the ls command, it will show you all the files and directories in the directory you run this command.
If you want to only display the list of all the directories, you can make use of the -d option.
Note it will not work just by using the -d option, you would also need to add */
% ls -d */
/Applications /System /Volumes /cores
/etc /opt /sbin /usr
/Library /Users /bin /dev
/home /private /tmp /var
The * is the wildcard to match any string and / to indicate that only directories should be listed.
If you also want to see hidden files you may add -a flag and -l to display it as a list.
% ls -lad */

Provide Feedback For This Article
We take your feedback seriously and use it to improve our content. Thank you for helping us serve you better!
😊 Thanks for your time, your feedback has been registered!
Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!