WEBVTT

00:01.990 --> 00:06.820
In Lennox, nearly everything you deal with directly is a file.

00:07.270 --> 00:12.970
So and most often these will be text files, for instance, our configuration files.

00:13.270 --> 00:16.580
Um, in Lennox are text file senior.

00:17.280 --> 00:24.850
And so to reconfigure an application, you simply open the configuration file, change the text and

00:24.850 --> 00:27.400
save the file and then restart the application.

00:27.580 --> 00:32.080
So your reconfiguration is complete here.

00:32.320 --> 00:40.540
So now, with so many text files, manipulating text becomes circular in managing Linux and Linux applications.

00:40.840 --> 00:49.180
So in this lecture, actually in this field a several lectures here, you will use several common commands

00:49.180 --> 00:52.990
and techniques for manipulating text in Linux.

00:53.500 --> 01:03.280
For illustrative purposes, I will use files from the world's best network institution detection system

01:03.280 --> 01:04.240
and D.

01:04.240 --> 01:11.410
S Snored, which was first developed by Martin Rules, and it's now owned by Cisco.

01:11.860 --> 01:19.000
So NYDFS are commonly used to detect intrusions by hackers.

01:19.150 --> 01:22.900
So if you want to be a successful hacker, you must be familiar with.

01:23.230 --> 01:34.480
Our ways in I.T. is can um, detect detect attacks and the ways can abuse them to avoid detection.

01:35.200 --> 01:42.490
So let's now I will, uh, learn about, uh, you learn you, uh, the beeping fire.

01:42.510 --> 01:47.980
So, uh, the most basic text this will air command is probably kept here.

01:49.240 --> 02:01.450
So Cat is, uh, to let's use cats to, uh, display this not config file from snort dot con fear,

02:01.450 --> 02:02.650
as you can see here.

02:03.040 --> 02:13.510
So let's in order to open up this file that's right here, cats slash eight CC small snore.

02:13.540 --> 02:17.050
Start Quan Quan, OK.

02:21.020 --> 02:21.530
Actually.

02:29.810 --> 02:32.900
Actually, let's show and them bitcoin for cash.

02:43.500 --> 02:44.510
So you can see this.

02:44.960 --> 02:52.880
Now we printed our this file here, so, um, news can and should be like this here.

02:53.300 --> 03:01.520
So in the following two elections, I will show you an election and next, uh, the next, uh, lecture

03:01.520 --> 03:09.260
to I will show you to hear the detail and heat until, uh, comments, which are two methods for displaying

03:09.260 --> 03:15.230
just part of the finest content in order to, uh, more easily with the key content.

03:15.620 --> 03:17.300
So let's uh, right here.

03:17.510 --> 03:18.870
Heat here.

03:19.640 --> 03:25.880
Uh, it is the SNP s and P that can trigger action here.

03:25.880 --> 03:31.490
As you can see now we are simply looking at heat here and.

03:33.230 --> 03:34.460
Uh, we have.

03:40.670 --> 03:42.680
So now if you.

03:44.380 --> 03:48.130
And I just want to view the beginning of the file here.

03:48.490 --> 03:54.070
You can use the heat command as I used it here, but by default is common.

03:54.070 --> 04:03.070
This is the first ten lines of a fire, so one two three four five six seven eight nine 10 here.

04:03.820 --> 04:06.100
So the, uh, command, for instance.

04:06.910 --> 04:07.810
Uh, here.

04:10.230 --> 04:18.780
For example, just if you want to see the first five lines here, uh, just minus finds the five here.

04:19.140 --> 04:21.990
And then write your file here.

04:22.000 --> 04:26.790
So note in my case is not here, but you can do it in file.

04:28.710 --> 04:29.610
Actually, it's not.

04:30.760 --> 04:31.200
And.

04:32.570 --> 04:36.500
Actually, not as intense as an MP.

04:37.760 --> 04:45.890
As an MP, that can as you can see here, we pour into the first five lines here one two three four

04:45.890 --> 04:46.490
five.

04:47.970 --> 04:57.720
So you should look like that, you see and the article like that, if you if I know right here eight

04:57.720 --> 04:59.070
lines of actual.

05:00.840 --> 05:02.400
Here it lines.

05:05.620 --> 05:06.040
Here.

05:07.450 --> 05:07.730
Oops!

05:10.890 --> 05:12.570
It's an excellent yes.

05:13.930 --> 05:20.430
Hate crimes, for example, as you can see here, I printed eight lines of our.

05:22.000 --> 05:25.540
Configuration file here and here.

05:27.510 --> 05:28.100
I'm sorry.

05:31.350 --> 05:33.240
Let's change this resolution here.

05:33.450 --> 05:36.540
A resolution here.

05:40.830 --> 05:41.250
Yes.

05:42.930 --> 05:44.340
This configuration here.

05:48.770 --> 05:49.130
So.

05:50.530 --> 05:53.050
Notice here we have.

05:54.120 --> 05:54.770
Tatel.

05:56.070 --> 05:59.400
Uh, come on the spill tail, commander spill here.

05:59.640 --> 06:03.330
So the tail command is similar to the hit command.

06:04.850 --> 06:05.390
But.

06:08.820 --> 06:12.270
But it's used to weave the last lines of a file.

06:12.840 --> 06:17.340
So let's use this tail comb one this well here again.

06:18.040 --> 06:18.660
Uh, here.

06:20.720 --> 06:21.410
Tell.

06:22.570 --> 06:24.040
Here it is.

06:24.310 --> 06:27.940
It's an empire, it's MP that configuration here.

06:28.460 --> 06:33.460
Uh, but uh, so for example, it's as you can see, we're, uh, printed.

06:33.820 --> 06:39.970
These are all files here because we don't mentioned any, um, any.

06:43.810 --> 06:52.420
Last lions here, for example, if they try like that, for example, uh, minus five, this tail command

06:52.430 --> 07:02.860
will show us the last file of last five lines of our, uh, configuration file or any text file here.

07:03.880 --> 07:08.630
So, uh, we have then numbering the lines call months as well.

07:08.650 --> 07:15.190
So sometimes, especially with very long files, we may want the file to display line or line numbers

07:15.790 --> 07:16.300
signs.

07:16.600 --> 07:21.700
This is an empty configuration, has not many lines here.

07:22.060 --> 07:25.270
I will try another file here.

07:25.270 --> 07:31.540
For example, it's found in the file um, file, for example.

07:32.020 --> 07:33.400
Let's use.

07:35.090 --> 07:37.050
Somebody here, some.

07:38.810 --> 07:42.650
And SMB dot com, I think this moment, OK?

07:42.740 --> 07:46.670
As you can see, there is a swarming alliance, so.

07:48.260 --> 07:49.050
Mm hmm.

07:50.070 --> 07:58.530
We may want to file display and nine line numbers because it's so many lines here with some configuration

07:58.530 --> 07:59.220
file here.

07:59.790 --> 08:01.110
So let's.

08:03.030 --> 08:10.000
So this makes it easier to arrest and change and come back to the same place within the file, so to

08:10.020 --> 08:12.630
display a file with nine numbers.

08:13.380 --> 08:21.390
We chose the NFL, yes and l, uh, comments or simply enter the A comment here, et cetera.

08:22.260 --> 08:23.630
It is here.

08:23.640 --> 08:26.040
Um uh, what it was.

08:26.040 --> 08:27.150
It was humble, right?

08:29.360 --> 08:32.050
Yes, Samba Samba SMB configuration.

08:32.900 --> 08:35.190
Uh, Samba SMB.

08:35.480 --> 08:39.080
Com Fair, as you can see here, we printed a line like that.

08:39.620 --> 08:44.540
Uh, line last line is one hundred eight and nine line here.

08:45.080 --> 08:50.490
And as you can see here, we have so many lines here.

08:56.650 --> 08:56.980
Yes.

09:06.830 --> 09:10.220
So let's filter our files with.

09:11.840 --> 09:12.950
Com month here.

09:13.490 --> 09:21.710
So the command and grip is probably the most widely used takes manipulation command, so it lets you

09:21.710 --> 09:24.380
filter the content of a file for display.

09:25.250 --> 09:33.830
If, for instance, you want to see all lines that include word, for example, read on here or parts

09:33.830 --> 09:34.220
here.

09:35.440 --> 09:37.600
Uh, like that path here.

09:38.260 --> 09:38.860
Um.

09:41.790 --> 09:49.380
Uh, in your, uh, this SMB file configuration file, you called use camp and asked to display only

09:49.710 --> 10:00.240
to files like that, for example, cat ethicists, some with some assembly that configuration and one

10:00.390 --> 10:07.440
line pipe here and then grab, uh, grippier read uh, what it was.

10:07.440 --> 10:10.530
Uh, read only use it.

10:10.620 --> 10:12.450
Only read.

10:13.540 --> 10:18.880
As you can see here, we printed out all our red files here.

10:19.300 --> 10:31.690
So this command will first be, um, assembly configuration file and then using the pipe here to send

10:31.690 --> 10:35.800
it to grab, and which we will take the file as an input.

10:36.220 --> 10:40.600
So now look for license plate occurrences of the word read.

10:41.590 --> 10:45.430
And display only to lions here, as you can see here.

10:46.330 --> 10:54.520
So the grape command is very powerful and essential command for working in Linux because it can save

10:54.520 --> 11:00.190
you hearts of searching for every occurrence of a volt or command in file.

11:01.360 --> 11:01.780
So.

11:05.540 --> 11:14.180
Well, let's say you want to display the fine lines immediately before a line that says Step six to

11:14.180 --> 11:18.230
configure polygons using the LEDs for comment you just earned.

11:18.560 --> 11:21.080
So how have you how will you do it?

11:23.050 --> 11:23.470
So.

11:25.260 --> 11:25.820
And.

11:30.050 --> 11:37.760
So there are many options to this commander to, as we have discussed, so you can learn more commands

11:37.760 --> 11:48.230
by using the built in Linux men, for example, mentale here will show the health file of tail comb

11:48.290 --> 11:54.980
mounted as you can see here, or, uh, just press X and then enter to quit here.

11:56.960 --> 11:57.410
Yeah.

11:58.810 --> 12:02.920
Uh, our uh, you can press Q Command to create here.

12:03.250 --> 12:10.360
What example, man can't, as you can see here, we're showing, uh, health file of cat combattere

12:10.360 --> 12:12.220
or non amputee.

12:12.460 --> 12:15.940
So a man is, uh, helpful comment here.

12:16.000 --> 12:23.980
Uh, actually actually, it's application here, so it will help you to show the health files of, uh,

12:24.070 --> 12:24.550
your.

12:26.460 --> 12:27.600
Application of common.

12:27.990 --> 12:34.950
So there are many ways to solve this challenge, and he and I show you each line stretching to do it

12:34.950 --> 12:44.580
in one way and your find another method here so we can do it like that and how it is there some bar

12:45.200 --> 12:54.140
assembly that can fish and pipe here and grip right here.

12:54.210 --> 13:00.570
As you can see here, we bring that this here which so we can see that the line here in the.

13:04.870 --> 13:08.380
We pretend like that here, as you can see, or with lines.

13:09.780 --> 13:10.470
No.

13:11.950 --> 13:20.240
So as you can see here, we have, um, challenges done with Intel and grab command.

13:20.260 --> 13:27.580
As you can see here we have um, we used nail command, which is similar to Cat, but it solves the

13:27.580 --> 13:35.260
lines of numbers or in one hundred eighty two, uh, line we have read only yes, one hundred seventy

13:35.260 --> 13:35.710
four.

13:35.710 --> 13:39.160
We have read only here, as you can see here.

13:39.460 --> 13:42.860
So I will of, uh, video here and I'm waiting.

13:42.860 --> 13:43.840
Go in next picture.
