Most people don’t know you can do Spotlight searches from the command line. Why remember all the arcane find and grep options and what not when you can let Spotlight do the work for you. The command line interface to Spotlight is called mdfind. It has all the same power as the GUI Spotlight search and more because it is scriptable at the command line!
If you want to find all the files on your computer that have something to do with Erlang for example you can use the following command line:
If you wanted to find only the files with Erlang in the name you would use the following:
If you wanted to find only the Erlang source files you would use the following:
If you wanted to find all the header files in your Erlang projects src dir, assuming you are in the src dir you would use the following:
One caveat the
-name option only appears to work in Snow Leopard ( 10.6.x ).
I usually create some aliases to mdfind with common options like the following:
So the next time you go to do a
find and a
grep for some contents of a file or a files name try