Find a File by Filename in Mac OSX Terminal

findmacosterminal

I want to find a file on my Macbook with the filename: abc.dmg. I've tried to use spotlight, but it doesn't find it. When I tried find, and used: find -name abc.dmg -path /, I got errors back.

What is the proper syntax to find a file by filename with the find command on a Mac OSX terminal?

Best Answer

In its simplest form, find takes one parameter: the path. In its actually useful form, it takes the path followed by narrowing criteria.

Thus, you want:

  • find (the program)
  • / (the path), and
  • -name abc.dmg (the criteria).
find / -name abc.dmg
Related Question