Finding files from the OS X command line

As I get more and more involved with the terminal, it’s becoming surprisingly annoying to have to stop and mouse around in the Finder.

One situation where this happens often is when I can’t remember (or don’t know) what directory a file is in.

Now I’m trying out the commands to search for files from the command line: find and mdfind.

find will search all files in the directory you give it, and takes a few seconds to complete for directories with a lot of files.

find ~/Music/ "Madvillain-Accordion.mp3"

mdfind is Spotlight’s terminal interface, and results are returned instantly.

mdfind -name selector.js

There’s an explanation of the basics at OS X Daily.