The Unix mdfind utility lets you search files using the Spotlight index from the Terminal. This is a great tool, but it doesn't quite replace find, which makes it very easy to search the current directory.

So here's a shell alias for a new spot command line tool which performs a Spotlight search only within the current directory:

The -onlyin parameter of mdfind does not obey the usual conventions for Unix commands. For example, you can't write mdfind -onlyin . to search the current directory. You can also specify non-existent directories and still get output (try it). The man page doesn't mention any of this.

actually, you want the single ticks for bash so that $PWD does *not* evaluate in the alias command. by using the double ticks ("), $PWD is evaluated once and not when you are using it later (most likely in a different directory). all of this is said using bash in 10.4 btw.