April 1st, 2007

ADD Soup

linux 'ls' question

so, let's say I want to see only the directories, not files, in the current directory. only the names, not their contents.

is there an option to 'ls' for that? I can't seem to come up with one.

Bonus: Also, don't show me any of the hidden (beginning with a dot) folders.

This would work, except that I want the output in the normal-looking ls - C style columns:
ls -F | grep /

This is what I came up with (in bash), but there must be a better way:
find -maxdepth 1 -type d -name '[!.]*' -printf '%f ' | xargs ls -d 2>/dev/null