Time
5 hours 21 minutes
Difficulty
Beginner
CEU/CPE
6

Video Transcription

00:00
Hello and welcome to command line Basics. This is Lennox. File commands three. I'm Christopher Howler. Let's begin.
00:07
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.
00:26
All right. Pre assessment. What is true about the correct command? Is it a It cannot search, case and sensitive
00:33
be It can be used to search him by never files or see it cannot use regular expressions.
00:41
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.
01:00
But that's something we can learn and look inside of help or the manual for ***. In order to be able to do that
01:07
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.
01:21
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
01:41
searching through everything at the time you entered the command
01:44
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.
01:56
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.
02:13
So let's take a look at an example.
02:15
Now
02:16
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
02:25
and then slash for the route,
02:29
and I'm gonna do dash name
02:31
and my program.
02:34
So this will look starting at the root of the operating system for any file that has tthe e name my program.
02:43
And as you can see, it took a little longer than the locate command.
02:46
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
03:07
and run that same command under pseudo soon as route,
03:10
and then you shouldn't have that problem.
03:15
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
03:34
the new regular expression grab stands for,
03:37
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
03:53
so you could become much more effective at at the show.
03:58
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.
04:09
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
04:18
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
04:36
And then on top of that,
04:39
we can take the output from the command piped into ***
04:43
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.
04:58
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.
05:15
So I am inside of my Lennox machine.
05:18
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
05:28
and that will have this Frankenstein died t x t fa. So I'm going to Cat
05:34
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.
05:46
You make sure hi, spell this correctly.
05:50
All right,
05:51
you can enter, We'll see. Didn't find anything. This is because in the text file, Frankenstein is always capitalized.
06:00
Now, if we take a look at the help
06:02
or rip dash dash, help
06:05
just what we should be using when we use the command so we could take our time. Learn about it.
06:11
You can see that the dash. I
06:14
ignores the case. So is case insensitive?
06:18
So let's say Let's bring this back And I'd say, We want to look through and find Frankenstein
06:24
so we're gonna do Dash I
06:27
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.
06:46
And as you could see we have, it's starting at the top,
06:49
and we could take our time going down,
06:53
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.
07:03
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.
07:17
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.
07:33
So the dash B dash C, dash, dash, binary or not valid switches for searching through binary files,
07:40
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.
07:48
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

Up Next

Command Line Basics

In this course you will learn the fundamentals of Command Line basics, a fundamental tool for any user of Windows and Linux machines. Command line allows developers to manipulate files easily and quickly, Learning command line saves developers time and resources.

Instructed By

Instructor Profile Image
Christopher Haller
Senior Intelligence Operations Analyst at Centripetal
Instructor