Ls directory only command line option

Is there is command line option for the ls to display only the directories and folders?

Try the following ls command to see only the directories:

ls -l | grep '^d'
ls -ld /path/to/dir/*/
ls -ld /etc/*/

Where,

  • -l : List files in long format
  • -d : List only directories/folder

Using find command to list directory

Try it as follows:

find /path/to/search/ -type d -ls
find /etc/ -type d -ls

See my tutorial
https://www.cyberciti.biz/faq/linux-list-just-directories-or-directory-names/