albert
albert

Reputation: 123

Bash - Listing directories only

I can't list directories only with the command:

ls -d

It shows me only the current directory ., but there are a lot more than that.

I'm using a Linux Mint 18 Sarah.

Upvotes: 1

Views: 4454

Answers (2)

albert
albert

Reputation: 123

The command ls -d */ does the trick!

Upvotes: 3

rsm
rsm

Reputation: 2560

Yes, -d option is strange. I was dissapointed by ls many times, so I learnt find. To list non-recursively (-maxdepth 1) local (.) directories (-type d):

find . -type d -maxdepth 1

Upvotes: 1

Related Questions