To find all documents containing someones name could be done as follows: Assuming Spotlight is working as intended though, mdfind is very fast, efficient, and a bit more user friendly.Īt it’s most basic level, mdfind is used as follows:įor example, to find all appearances of “Photo 1.PNG” the command would be:īecause mdfind is like Spotlight, it can also be used to search the content of files and folders for a specific file. Mdfind is Spotlight’s terminal interface, meaning it won’t work if Spotlight itself is disabled, not functioning for another reason, or rebuilding it’s index. Searching for Files at the Command Line with mdfind find also supports expressions, allowing you to search for very specific matches, wildcards, sequences, and other advanced options.įind is very powerful but it’s power quickly brings with it some complexity, as a result the classic mdfind command is probably better for more novice command line users. You will need to prefix find with ‘sudo’ to search root directories and outside of the current user privileges. For example, looking in the user library folder for a specific plist file:įind ~/Library/ -iname "" Of course you can also find specific files that are buried somewhere in a directory. You may want to pipe the results to more if you’re expecting a large return, like so: If you’re looking to learn things that are consistent across platforms, find is a good choice.Īt it’s most basic, find can be used like so:įor example, you can locate anything within the user home directory containing “screen” in it’s name with the following: The find command is very fast and easy to use, it’s straight from the unix world and as such works in Linux as well as Mac OS X. Searching For Files from Command Line with find Let’s read on and learn how to use these great abilities. The first method is operating system agnostic, meaning you’ll be able to use the search function with Mac OS X, Linux, BSD, and many other unix variations, whereas the second trick for searching utilizes a Mac-only model of finding files from the command line. You’re in luck, we’ll show you how to find files and folders directly from the command line using two different tricks.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |