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
#Search for text in files mac command line how to#
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.