There are several ways to filter the output from
Method #1 - be explicit
If you know you're looking for a particular version of the library, then just ask
locate for it directly.
$ locate libstdc++-3-libc6.2-2-2.10.0.so
Method #2 - grep
If you're looking for glibc .so libraries then use
grep to find only these results from
$ locate libstdc++ | grep ".so$"
Method #3 - only return the first 10 lines of the result
If you're more interested in finding the first results, then use
head to return only the first few. You can direct
head to return different numbers of results using the
-# switch (shorter but non-standard equivalent of
$ locate glibc | head -8
(note that it returns 8 lines, that's not necessarily the same as file paths as file paths can be made of several lines since the newline character is as valid as any in a file name).