Sometimes when using locate, my search string will (either incidentally or intentionally) match a portion of a directory. This causes everything below that point in the directory to be printed. For example:
$ locate lib
/home/myname/libImWorkingOn/libImWorkingOn.so
/lib/
/lib/modules/
/lib/firmware/
.... etc
This quickly gets out of hand and makes it difficult to search.
Is there a way to prevent this? For example, have it print:
$locate lib
/home/myname/libImWorkingOn/libImWorkingOn.so
/lib/
And nothing more?
Additionally, is it possible to look for a directory and have locate pick up just the directories?
For example (looking for qemu base folder)
Actual:
$locate qemu
home/myname/qemu
home/myname/qemu/.svn
home/myname/qemu/.svn/.....
home/myname/qemu/Makefile
.....
usr/bin/qemu
.....
Desired:
$locate (option) qemu
/home/myname/qemu
/usr/bin/qemu