Let's take a look at OS 10, which has a very unique metadata-based search offering called mdfind. Here I'm in the source directory, which the full path or my system is users noahgift source. This is where I put a lot of source code and change around things with code. What I'm going to start out with is first finding more information about the mdfind command for OS 10. If do man mdfind, I can look at all the different things I can do. What's unique about this is it has things that are available specifically to the OS 10 operating system. You can see here this live allows me to do real-time metadata searches, so it'll update the database. I can count things. I can also specify that I want to search in just a particular directory. Then this is really fascinating, as I can do very complex queries like look at the metadata of files. There's a ton of really powerful things that you can do with mdfind. Once you find yourself using commands like locate or the find command itself, you might also want to take a look at mdfind. Let's go ahead and get a first search here. What I'm going to do is I'm going to run mdfind, and then I'm going to say name. I'm going to look for all the readme files that are only in this current working directory or below. Here we go. You can see that there's a few different readmes that I have in projects that I've been working on. That's pretty neat. But what happens if I go through and I create another readme file? What happens? Well, Spotlight doesn't yet know about this, so it doesn't yet show up until I create that readme file. Now, Spotlight was able to pick it up. Boom. We can also see this immediately. What's neat about this is that by using the metadata search engine, it's able to really quickly pick up new things. Now, I can also do this, which is I could have a live command, which is this. Notice that it's just going to sit here and it's going to wait for files to be created. What I could do is I can open up another tab below here, maybe put this right over here. Then I could cd into the source directory, make this a little bit bigger, cd into the source directory and start seeing if things will show up. Here we go. Let's go-to source, and we'll make another readme file. We'll do this. We'll say readme. Let's first make a directory foo, and then we'll say touch foo/readme.txt. What happens? There we go. Query update six matches, and then we're able to get new information as a result of this. That's what's cool, is that you can also do these real-time style searches by using the mdfind command. Now there's more though that we can do beyond that, and one of the things that we can do is that I can actually look for date ranges as well. Here what I'm going to do is I'm going to say mdfind, look for the name readme.txt, and then I'm going to say only again, looking here. But I want to look for the last 10 years at this date range. What do I see inside of your grade? Notice how the new file that I created doesn't show up or the new directory with the file and it doesn't show up because of the fact that I said only in this particular date range. But if I wanted to change this, I could go through here and I could say 2022, which would be into the future, but it would also look at the stuff that was just created. Now, we can see in fact that this new one I created shows up, and the original one that I created shows up. Lots of very, very powerful things that you can do with mdfind here with dates. Now, a really interesting thing you can do that I think many people aren't aware of is that you can also look for files of a certain size, and this is extremely useful. Let's take a look here if I say on the entire file, not just the source directory because I'm not limiting it, I want to find files that are basically 10 gigs or larger. Well, here we go. We can see here that I have some Xcode files here that I may want to delete off of my system. Look how quick it was. Just instantaneously found this query here on all the different large files that are on my file system. Well, that's somewhat useful. But what if I want to find out exactly how big that file is? Because this just says over that size. Well, we can use xargs here. xargs has the ability to give us command that run against every one of the search results. In this case, I'm going to say du -sh. It show me a human-readable summary of the size of this file. Here we go. In fact, we can see that this project right here is 25 gigabytes, which seems like it's a little bit big. Here's another one that's 12 gigabytes. Here's another one, it's 11 gigabytes. Again, really, really useful command here. In fact, if I wanted to, I could even filter it a little bit more, and I can look for only the things that have the word Xcode in it, like this. Now we've actually got a nice, clean output here that shows us the ability to look for only things that have the word Xcode in it. Perfect. We have 15 gig file, 12 gig file, 11 gig file. There's a ton of really awesome things you can do with this mdfind command. Because it has the real-time metadata search, it allows you to look both inside of files and the metadata, but also look at things in real-time.