Ls directory only command line option

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

1 Like

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

1 Like

Linux sysadmin blog - Linux/Unix Howtos and Tutorials - Linux bash shell scripting wiki