Transcript from the "Shell Tools: Find and Grep" Lesson
>> Jem Young: So we learned lots of things. We're onto part three, we learned about server maintenance, updates, security passes, firewalls. Let's talk about shells for a bit. The shell is the thing we're running, this is a shell, we're in a shell right now. Some people think, we're talking directly to our kernel, we're talking directly to our OS.
[00:00:22] Not true, we're talking through a series of other applications that talk to our OS, because humans are not that smart. We just couldn't directly talk to the kernel, we would mess things up very quickly. But before going to shells, I'll cover that a bit later, let's cover some useful command lines tools, like we did last time.
[00:00:41] We learned VI and ping, and traceroute, and nmap, let's cover a few more things, probably the most useful things. I know I've said that for every single command we've ever learned. Because they're all useful, but find and grep are probably the two most useful commands. Because they work on your regular OSX machine, they work on most Linux installations.
[00:01:01] The two ways of finding things are find and grep. Find, it finds file names. Grep is for file contents. Some people get a little mixed up with that, so, find, names, grep, contents. Find, the anatomy of a find command. And you're saying, Jem, you don't lay out any other commands like this, this is because find is that useful.
[00:01:26] It's very fast, if you master find, you will just be like, where is that one file? I can look it up because it has a million options. But the breakdown of a find command is find, the command, the directory you want to look at. The option flags you want to pass, generally name, then the file or folder you want to find.
[00:01:45] Not that tricky, but it's a lot, it's much more than people are used to when they talk about searching things. You just want to search something, find is a little bit more dense because it's very, very powerful. So for instance, if we want to find, well, before we go to find, useful options, right here the option flag.
[00:02:04] There's a lot of options you could find, we could find something by name, we could find files of type. We could find empty files, we could find files by permissions, which is really useful. We could say, these are all the executable files on our file system. We could find all the things that are writeable, as in, these are not just read only, you can write to them too.
[00:02:24] Find is extremely powerful, and if you learn how to use find, you can actually do many, many, many things. And I added a link at the bottom to Lifewire, just a lot of uses of find, because there are many. If you think, I'm just looking for file names, it's way more than that.