5 hours 21 minutes
Hello and welcome to command line basics. This bottle will cover Common that. Lennox Tools. I'm Christopher Handler, and let's get started.
So are lending objectives for this module is we're gonna learn how to read files. We're gonna learn howto copy files, understand how to delete files and understand how to search their files. So these are gonna be very common task. You're going to be able, Teoh, uh, you're gonna have to be able to do unlimited if you are pursuing a career
in computer science
in penetration, testing in ethical hacking. So it's very important that you understand these concepts and know how to apply them.
All right. Pre assessment. Which command is the best to search through text?
Is it a strings?
Be text? See grip
D n grip.
If he said see grip, you're correct. So the grip command, As I've stated earlier in this course, it is a regular expression searching tool, and it is very powerful and very effective.
The strings command. While it will bring up a text file, it searches through, ask e strings in a hex file, and it's not exactly very search oriented as much as printing. Uh,
you know different characters out.
The text file is not for searching, and the angry file is for network grip, and it is searching through a packet capture file.
So not exactly for a text file.
All right, so we're gonna learn how to read a text file. We get a few different options. We have the cat command. And now this is a very common command that you're gonna use a lot in your Atlantic's career, and it actually stands for contaminate. And what it is, is it spits out all of the text of a file,
and you can actually use it on two or three files at once.
And it will automatically add those files together and split them all out as one contiguous set of text
on. We also have the more command,
which is similar to can't accept. You can't really combine different text files together. It will just spit out a, uh,
text of a text file and then you have the less command.
Now, this is kind of a play on words where less is more. Ah, the less command is much more useful than the more command because you can actually scroll up and down instead of just moving screen by screen by with the more command.
So let's give you a demonstration of these tools real quick.
So I am in my home director right now as displayed by the till day here.
So I'm going to use the L s command
and see what is in my folder here.
So get desktop documents, downloads wanting to my desktop. So C, D
and Capital D
E. I'm gonna push the tab key, and it's gonna fill that out for me. All right, Now let's see what's in our desktop,
and I want to get into documents. So seedy Capital D
documents. And now, if you don't know already, Lennox is case sensitive. So if I were to do a lower case D
and then pushed have
nothing would come up because there are no matches.
However, with the capital D,
it finds it
eyes. We're gonna go in there, and l s
all right. So now I have to text files in here, and I'm going to do cat on words.
All right, So I had a bunch of different Latin words here,
and now I can swirl up because I have this scroll bar on my terminal here. If I didn't have this crowbar or if I was in a seal, I only Lennox distribution. Then I wouldn't be able to see past this top row here.
And it can be difficult to do that if, ah, you know you can't screw.
So the cat command is great for spitting out information and let me demonstrate really quick how we can combine two files together. So many do words, not text and then longer file dot text
enter. All right, so check it out.
These are both of the text files just spitting out one after another contaminated.
All right, now, like I was saying, if I have a seal, I only distribution
than what I could do is theme or command and then
And as you can see in the bottom left right here, it tells us how far we are in the file, and it lets us to read from the first line of here.
So in order to move and read more of it, weaken
pushed the anarchy. And that will go down one line at a time.
Or if we push the space bar, it'll go down a full page at a time
so we can take our time reading through everything. And we're not gonna miss anything
The kind of limitation with more is that as soon as you go down a line, you can't go back up.
So this is where less is more comes in.
So now we can go down.
I'm pushing the down arrow key right now and go back up. I am pushing the up a rookie,
and some distributions allow you to school with your school bar on your mouth.
And as soon as you're done, you just push this little key button here
and we are done so very useful to keep the mind.
moving on. So we got a copy and move files. So for copying, we have CP Command and we can also use theater Tak are or excuse me, Dash are for recursive lee copying
and then move is M V Command. And we can also use this to rename files in there in a special way.
So let me take you a quick demonstration of that.
So let's take a look in our folder. We have words here. I'm going to do C p words
and I want to put it into my desktop folder.
And if you leave, the blanket will just can't be the existing file name and place it into that directory.
And now we can see here I have the words file that was copied into this directory.
No, delete it. I don't want it there.
All right, Now for the move Command,
I'm going to do the same command here,
there we go. We have the words command back on my desktop.
And if we look in here in the documents folder, the words is no longer in there.
It's gone because it was moved. So I want to move
this back. I can just drag and drop
and check it out. We're back. And what's neat about the move commanders? We can also kind of rename files by moving them. Uh, since it
doesn't keep a copy of the foot, the existing file.
So let's take a look. Move words. And I'm going to rename it too. New
name that T X T.
And let's do a listing and checking out our We have our new name dot t X t file here.
All right, so these are very useful commands.
And now the leading files. So, uh, the R M command. This is used for removing files. And if you are logged in as the route user
and you used the dash f for forcing it, it will not ask you twice. It will start the leading, and it won't look back. So you have to be very careful.
So let me give you a quick demonstration of this. I'm going to copy our new name
dot t x t file and
give it forwards. That t x t
Now check it that we have both for our files. They are the same. So let's say I want to remove new
name that t X t
listing, and it's gone
And now, searching through text, we have the direct command, So graft is one of the most powerful tools we can use. It is pattern based search, and it works well. One type, the other commands.
So inside of this longer file, I have a secret word in there.
So in order to find it, it's used grip
secret, because this is what we're searching for and then into longer file dot t x t.
And there we go. It's highlighted. That's our secret.
Here is the secret.
So it very useful will search through a large amount of text. It's very fast of what it does to
all right. Post assessment. Is it possible to concoct innate multiple files?
No, only one file at a time, Yes, but only two files. No, you need to use the more command or yes, there is no limit to the amount of files.
The answer is D Yes, There is no limit to the amount of files. So was great about the cat command is that you can combine a whole bunch of different files together. That way you can pipe them into rep and search through.
It's very useful. So, yeah, you become more comfortable with that as he's the command line.
All right, so in this video we learned how to read files how to copy files, understand how to delete files and understood how to search through files with grab that. I hope to see you in the next video
SOC Analyst Assessment Level 1
Cydefe's SOC Analyst Assessment, Level 1, Capture-the-Flag (CTF) Assessment
How to Use GDB (BSWJ)
The GNU Debugger (GDB) is one of the most commonly-used debugging tools in the world. ...
Certificate of Completion Offered