$ man ls
...
-d, --directory
list directories themselves, not their contents
The current directory is represented as .
so that's what ls -d
is listing.
The directories inside the current directory are contents of the directory, and are therefore not shown with this option.
I use the -d
option in an alias to display hidden files and directories
alias l.='ls -dC .* --color'
Without -d
, this will list out the contents of the hidden directories too, which isn't what I want.
Another use for it is when I want to see metadata of a directory using the -l
option, not its contents:
$ ls -ld playground
drwxr-xr-x 72 zanna zanna 12288 Mar 1 23:10 playground
If you want a list of directories in the current directory you can use
ls -d */