Your usage of ls and grep is correct, that will find any results in the ls output containing 'stomething'. Note that looks at the whole line, not just the filename (mostly applicable when using certain flags with ls, such as ls -l etc).
Finding directories, you're better off using find and wc (wordcount):
find /home/mydir -maxdepth 1 -mindepth 1 -type d | wc -l
Explanation:
- maxdepth 1, count to a maximum depth in the tree of 1 (eg only dirs, not subdirs in this case)
- mindepth 1, basically used in that example to make sure find doesn't find "." also.
- type d, look for directories (-type f will find files, l will find soft links etc)
- wc -l, count the lines returned
If you run that without the pipe to wc you'll get a list of all the results. Find is a pretty handy command to be familiar with.