Time
5 hours 21 minutes
Difficulty
Beginner
CEU/CPE
6

Video Transcription

00:00
Hello and welcome to command line basics. This bottle will cover Common that. Lennox Tools. I'm Christopher Handler, and let's get started.
00:09
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
00:28
in computer science
00:29
in penetration, testing in ethical hacking. So it's very important that you understand these concepts and know how to apply them.
00:38
All right. Pre assessment. Which command is the best to search through text?
00:43
Is it a strings?
00:45
Be text? See grip
00:49
D n grip.
00:51
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.
01:06
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,
01:23
you know different characters out.
01:25
The text file is not for searching, and the angry file is for network grip, and it is searching through a packet capture file.
01:34
So not exactly for a text file.
01:38
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,
01:57
and you can actually use it on two or three files at once.
02:00
And it will automatically add those files together and split them all out as one contiguous set of text
02:08
on. We also have the more command,
02:10
which is similar to can't accept. You can't really combine different text files together. It will just spit out a, uh,
02:20
text of a text file and then you have the less command.
02:24
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.
02:40
So let's give you a demonstration of these tools real quick.
02:46
So I am in my home director right now as displayed by the till day here.
02:51
So I'm going to use the L s command
02:53
and see what is in my folder here.
02:57
So get desktop documents, downloads wanting to my desktop. So C, D
03:01
and Capital D
03:05
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,
03:13
and I want to get into documents. So seedy Capital D
03:19
documents. And now, if you don't know already, Lennox is case sensitive. So if I were to do a lower case D
03:29
and then pushed have
03:30
nothing would come up because there are no matches.
03:34
However, with the capital D,
03:36
it finds it
03:37
eyes. We're gonna go in there, and l s
03:39
all right. So now I have to text files in here, and I'm going to do cat on words.
03:47
All right, So I had a bunch of different Latin words here,
03:53
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.
04:06
And it can be difficult to do that if, ah, you know you can't screw.
04:13
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
04:27
enter. All right, so check it out.
04:30
These are both of the text files just spitting out one after another contaminated.
04:38
All right, now, like I was saying, if I have a seal, I only distribution
04:43
than what I could do is theme or command and then
04:47
longer file.
04:48
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.
04:58
So in order to move and read more of it, weaken
05:01
pushed the anarchy. And that will go down one line at a time.
05:05
Or if we push the space bar, it'll go down a full page at a time
05:12
so we can take our time reading through everything. And we're not gonna miss anything
05:15
now.
05:17
The kind of limitation with more is that as soon as you go down a line, you can't go back up.
05:24
So this is where less is more comes in.
05:29
So now we can go down.
05:30
I'm pushing the down arrow key right now and go back up. I am pushing the up a rookie,
05:36
and some distributions allow you to school with your school bar on your mouth.
05:41
And as soon as you're done, you just push this little key button here
05:46
and we are done so very useful to keep the mind.
05:49
All right,
05:51
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
06:02
and then move is M V Command. And we can also use this to rename files in there in a special way.
06:11
So let me take you a quick demonstration of that.
06:15
So let's take a look in our folder. We have words here. I'm going to do C p words
06:21
and I want to put it into my desktop folder.
06:28
And if you leave, the blanket will just can't be the existing file name and place it into that directory.
06:33
And now we can see here I have the words file that was copied into this directory.
06:40
No, delete it. I don't want it there.
06:43
All right, Now for the move Command,
06:46
I'm going to do the same command here,
06:48
slash desktop
06:53
And
06:54
there we go. We have the words command back on my desktop.
06:58
And if we look in here in the documents folder, the words is no longer in there.
07:04
It's gone because it was moved. So I want to move
07:09
this back. I can just drag and drop
07:15
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
07:25
doesn't keep a copy of the foot, the existing file.
07:29
So let's take a look. Move words. And I'm going to rename it too. New
07:34
name that T X T.
07:39
And let's do a listing and checking out our We have our new name dot t X t file here.
07:46
All right, so these are very useful commands.
07:48
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
07:58
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.
08:09
So let me give you a quick demonstration of this. I'm going to copy our new name
08:16
dot t x t file and
08:18
give it forwards. That t x t
08:22
l s.
08:22
Now check it that we have both for our files. They are the same. So let's say I want to remove new
08:31
name that t X t
08:33
listing, and it's gone
08:35
good.
08:39
All right.
08:39
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.
08:52
So inside of this longer file, I have a secret word in there.
08:58
So in order to find it, it's used grip
09:01
secret, because this is what we're searching for and then into longer file dot t x t.
09:09
And there we go. It's highlighted. That's our secret.
09:11
Here is the secret.
09:13
So it very useful will search through a large amount of text. It's very fast of what it does to
09:20
all right. Post assessment. Is it possible to concoct innate multiple files?
09:26
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.
09:37
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.
09:52
It's very useful. So, yeah, you become more comfortable with that as he's the command line.
09:58
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

Up Next

Command Line Basics

In this course you will learn the fundamentals of Command Line, 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