Hello and welcome to command line Basics. This is Lennox. File commands three. I'm Christopher Howler. Let's begin.
So are learning objectives for this video. We're gonna learn about the fine command line, the grip command, and understand how to pipe into crept from the command line and these air very important as well. So we're gonna be able to search through items and find things that were interested in and, you know, pipes and through command so we can look for him.
All right. Pre assessment. What is true about the correct command? Is it a It cannot search, case and sensitive
be It can be used to search him by never files or see it cannot use regular expressions.
The answer is B. It can be used to search in binary files. This is very useful fact with the grip command where we could search their execute a bles thes binary files and search for strings that are inside of So we're gonna have to specify that very specifically in order to search through.
But that's something we can learn and look inside of help or the manual for ***. In order to be able to do that
grip can search case and sensitive. That's the dash I switch, and it can use regular expressions. That's the AR E. He's a regular expression for grab.
All right, so for the fine command, this is supplier to locate. Except there's no database, there's no index for fine to use. So it's ah, it's a lot slower because it has to actually go through everything inside the system instead of referencing that database. But it is much more robust than locate because it is
searching through everything at the time you entered the command
instead of just relying on a preemie index database. So while this may take longer, it will search through everything and you know that it looked through every part of the system.
And, uh, the fine is a little different because when it's I find and then the path you want to look in and then the final name and you need to make sure that you used the dash name and then the name of the file you're looking for, otherwise it won't be able to find it very easily.
So let's take a look at an example.
let's say I want to find the microgram file, but I don't know where it is. So we're gonna start at the root of the operating system and it's I find
and then slash for the route,
and I'm gonna do dash name
So this will look starting at the root of the operating system for any file that has tthe e name my program.
And as you can see, it took a little longer than the locate command.
And it did find the file in the folder we're in right now, and they're also found it in the Dragon Drop folder. So we had another programme labelled my program as well, and you could see we had permission denied entering this other folder as well. And if you find yourself getting a lot of permission denied running, find it, just go ahead, type pseudo
and run that same command under pseudo soon as route,
and then you shouldn't have that problem.
All right now we have grab. So grip is very important to understand, because it is so useful to be able to search through files and folders and either find files or look through and get these matches for things you need to find. It's very extensive, and it uses pattern based searching. That is what the
the new regular expression grab stands for,
and so regular expression is very kind of tricky and difficult to understand. But when you get to a point where you're using the shell to search for patterns and you know exactly what you need to find highly recommend understanding and taking the time to learn regular expressions
so you could become much more effective at at the show.
So this also works really well. One pipe to other commands because grab takes that standard input, and it can use it very fluidly in order to give you your output.
So Grip is very useful command that need to be very familiar with in order to search through and find things that you're going to use
and never to learn how to pipe integrate. So just like we're learning, grip is such a useful commander surged through things, and we can use the Pipe Command, which refused a handful of times already in this course, and take that output and push it straight into the grip command so we can look into exactly what we need
And then on top of that,
we can take the output from the command piped into ***
and run that into another pipe into the less. That way, if we get a lot of output from the grip, come and we can take our time's rolling up and scrolling down in the output so we can see exactly what we have on our terminal and take our time reading through.
And if you haven't figured out already, there are countless ways to pipe multiple commands together, so it's important to feel comfortable with using all these commands at once so you can create a very effective ah flow at the commandment. So let's show a quick demonstration of that.
So I am inside of my Lennox machine.
And let's say I want to go into these Frankenstein folder on a new CD, Capital F, because it is case sensitive Tab enter
and that will have this Frankenstein died t x t fa. So I'm going to Cat
Frankenstein because this will put it out into the terminal. The terminal we'll know all once. So I want to grip for Frankenstein itself.
You make sure hi, spell this correctly.
you can enter, We'll see. Didn't find anything. This is because in the text file, Frankenstein is always capitalized.
Now, if we take a look at the help
or rip dash dash, help
just what we should be using when we use the command so we could take our time. Learn about it.
You can see that the dash. I
ignores the case. So is case insensitive?
So let's say Let's bring this back And I'd say, We want to look through and find Frankenstein
so we're gonna do Dash I
and check it out. We have all sorts of different Frankenstein's because they're all capitalized. It was ignoring case with the dash. I now there was a lot of text put out at once, so it's used up a rocky bring our freeze command back, and we'll add another pipe and add less.
And as you could see we have, it's starting at the top,
and we could take our time going down,
going back up and find all of the output that we got. So this is very useful, and you should be able to be very comfortable with it at the command line.
All right, post assessment which switch is used to search their binary files is a dash A B dash, B C dash C or D dash dash binary.
The answer is a dash A. This is used to search through binary files with grip. And even though we didn't demonstrate it, it's very useful technique that you need to be able to use in order to search through these files and try and find keywords.
So the dash B dash C, dash, dash, binary or not valid switches for searching through binary files,
and I highly recommend looking through the manual or looking through the help for grab because it is such an important command feel comfortable with.
All right, So in this video we're learning Fine Command learned the great command, and then we understood at a pipe into *** and then pipe out of our grip results as well. So I hope to see you in the next video