On 2/22/07, Eur Ing Chris Green cl@isbd.net wrote:
While the 'locate' command is very useful at times, especially if you have lost a specific file it's much less useful when looking for, for example, a directory which has a rather common name.
E.g. I was just trying to find where I have bits of vmware installed, doing a 'locate vmware' just produces zillions of lines of output. I don't (in this case) want to know all the files which are located somewhere below a 'vmware' directory, I just want to know the location of the directory.
If you find and locate are too scary, how about du and grep?
"du / | grep dir" will produce a tree list of all the directories on your filesystem and their sizes (not a good idea if you remote filesystems mounted) and then searches it for 'dir'.
"du -a /" does the same, but lists all files too and their block sizes.
Yeah, it's a big hack, but it searches the live filesystem rather the locate database.
Hope this helps! Tim.