12 videos 📅 2025-02-18 09:00:00 Africa/Blantyre
4:47:02
2025-02-19 09:20:08
2:39
2025-02-19 21:55:33
4:40
2025-02-19 22:23:21
2:58
2025-02-19 23:09:29
20:58
2025-02-19 23:48:16
3:00
2025-02-20 05:21:32
2:29
2025-02-20 05:53:02
5:18
2025-02-20 06:35:37
4:07
2025-02-20 07:47:51
1:15:07
2025-02-20 09:31:43
1:28:23
2025-02-20 11:13:37
1:16:38
2025-02-20 13:43:10

Visit the Network Engineers Programme course recordings page

                WEBVTT

00:00:10.460 --> 00:00:11.860
uh...

00:00:28.580 --> 00:00:29.980
uh...

00:00:29.980 --> 00:00:30.020
uh...

00:00:31.000 --> 00:00:31.560
uh...

00:00:31.560 --> 00:00:47.760
back here with you

00:00:49.460 --> 00:00:50.020
now

00:00:50.880 --> 00:00:52.900
uh... hopefully you're still here with me

00:00:52.900 --> 00:00:55.400
so we just made an alias for CP

00:00:56.580 --> 00:00:59.440
uh... what if i want to execute CP

00:00:59.440 --> 00:01:01.580
without the minus i

00:01:01.580 --> 00:01:05.820
right now

00:01:05.820 --> 00:01:08.620
as expected the alias is working

00:01:16.360 --> 00:01:17.460
so right now

00:01:17.460 --> 00:01:19.280
it's a little bit annoying

00:01:20.680 --> 00:01:24.400
i just want to run CP as it originally runs

00:01:24.400 --> 00:01:29.420
not the alias

00:01:32.560 --> 00:01:33.640
what happens

00:01:34.980 --> 00:01:38.740
if i directly refer to that path

00:01:39.800 --> 00:01:41.140
of the executable

00:01:41.140 --> 00:01:44.760
would the temporary alias or the alias set

00:01:45.880 --> 00:01:47.560
still be an effect

00:01:47.560 --> 00:01:50.020
looks like not

00:01:51.520 --> 00:01:53.880
if you directly point

00:01:53.880 --> 00:01:57.200
to the executable

00:01:57.200 --> 00:01:59.900
it ignores your alias

00:02:00.640 --> 00:02:03.000
if you don't

00:02:03.000 --> 00:02:04.600
your alias is an effect

00:02:04.600 --> 00:02:05.660
give it a try

00:02:05.660 --> 00:02:07.860
when it is CP

00:02:07.860 --> 00:02:13.140
you can see CP on its own is replaced with CP minus i so the alias is working

00:02:13.140 --> 00:02:15.600
what if we didn't want to

00:02:15.600 --> 00:02:16.820
run the alias

00:02:16.820 --> 00:02:18.560
run the

00:02:18.560 --> 00:02:20.280
command from the actual path

00:02:22.080 --> 00:02:23.760
and you can set up alias

00:02:24.360 --> 00:02:25.900
just to make your life easier

00:02:25.900 --> 00:02:28.640
you don't have to remember complex commands

00:02:29.360 --> 00:02:31.560
every single time you want to run them

00:02:31.560 --> 00:02:33.180
just a quick alias

00:02:33.180 --> 00:02:35.920
and the software will work for you

00:02:35.920 --> 00:02:37.380
are we ok so far?

00:02:39.520 --> 00:02:40.800
very good

00:02:42.100 --> 00:02:45.960
some other basic tricks onto the command line

00:02:45.960 --> 00:02:47.360
just getting comfortable

00:02:47.880 --> 00:02:50.240
you can execute multiple commands

00:02:51.920 --> 00:02:52.780
together

00:02:54.860 --> 00:02:56.360
simply put

00:02:56.360 --> 00:02:59.620
multiple commands separated by a comma

00:03:01.840 --> 00:03:03.440
a semicolon

00:03:04.580 --> 00:03:07.400
and it can be

00:03:07.400 --> 00:03:10.280
as many commands as you want as long as you separate them

00:03:49.600 --> 00:03:51.360
guess what the sleep command does?

00:03:55.860 --> 00:03:59.360
quite literally puts the terminal to sleep isn't it?

00:04:00.840 --> 00:04:04.640
just introduces a little bit of a delay that's all

00:04:04.640 --> 00:04:08.040
useful in scripting and other scenarios

00:04:10.540 --> 00:04:12.760
now right now

00:04:12.760 --> 00:04:14.760
between these two commands

00:04:14.760 --> 00:04:17.120
or three commands or four commands

00:04:17.120 --> 00:04:19.840
there is no logic between them

00:04:19.840 --> 00:04:22.400
they are simply separate commands being executed

00:04:23.120 --> 00:04:26.440
what if I want to execute the second command

00:04:27.120 --> 00:04:28.840
only if the first command is successful

00:04:28.840 --> 00:04:29.940
or the other way around

00:04:29.940 --> 00:04:32.880
I only want to run the second command

00:04:32.880 --> 00:04:34.620
if the first command fails

00:04:34.620 --> 00:04:36.240
we are going to give this a try

00:04:36.240 --> 00:04:40.120
I am going to create a file x y z

00:04:41.820 --> 00:04:43.720
now you know this from experience

00:04:43.720 --> 00:04:45.560
what would happen if I did this?

00:04:47.120 --> 00:04:48.960
it's not going to let me do it

00:04:48.960 --> 00:04:51.480
because there is a file with the same name

00:04:52.840 --> 00:04:55.560
by the way what happens if you use the command touch

00:04:55.560 --> 00:04:58.440
and the file already exists with date

00:04:58.440 --> 00:05:02.120
it's not going to overwrite the other one

00:05:02.940 --> 00:05:06.420
no it just updates the date and time stamp

00:05:06.420 --> 00:05:08.700
of that file last access

00:05:10.120 --> 00:05:12.600
it's a non-destructive command

00:05:13.600 --> 00:05:15.700
similarly if you say touch for a folder

00:05:15.700 --> 00:05:17.640
all it does is just update the metadata

00:05:17.640 --> 00:05:19.860
it doesn't do anything destructive

00:05:21.000 --> 00:05:23.700
but in this case I have created a file first

00:05:23.700 --> 00:05:26.220
and now I am going to create a folder

00:05:26.220 --> 00:05:31.100
if I do this command now

00:05:31.100 --> 00:05:33.500
cd x y z

00:05:33.500 --> 00:05:36.700
or cb slash hosts

00:05:37.700 --> 00:05:39.700
to x y z

00:05:44.780 --> 00:05:47.000
it just stops me right there

00:05:47.000 --> 00:05:50.640
hey I cannot create a directory

00:05:50.640 --> 00:05:53.080
another example if I do this

00:05:53.080 --> 00:05:57.820
and say create a file a b c

00:05:57.820 --> 00:06:00.980
now we know that the first command is going to fail

00:06:00.980 --> 00:06:04.240
has it created a file a b c?

00:06:04.240 --> 00:06:05.500
what does this prove?

00:06:07.280 --> 00:06:11.460
so it proves that if one command fails

00:06:11.460 --> 00:06:13.200
the other one is going to fail

00:06:13.200 --> 00:06:15.360
no it won't execute

00:06:16.560 --> 00:06:18.500
it's a conditional connection

00:06:19.280 --> 00:06:22.600
between the two different commands

00:06:22.600 --> 00:06:24.840
if I remember correctly

00:06:24.840 --> 00:06:27.620
that's a big F

00:06:29.860 --> 00:06:31.500
is that that?

00:06:32.080 --> 00:06:33.340
let me just check

00:06:34.940 --> 00:06:36.620
b c

00:06:37.920 --> 00:06:39.500
oh I do remember

00:06:40.340 --> 00:06:43.160
if you put two pipes together

00:06:43.160 --> 00:06:45.800
it's the inverse logic

00:06:50.700 --> 00:06:53.340
only if the first command fails

00:06:54.380 --> 00:06:57.400
then execute the second one

00:06:57.400 --> 00:06:59.460
oh ok

00:07:01.160 --> 00:07:03.960
I would request you to please try this out

00:07:03.960 --> 00:07:06.440
continue working on this concept

00:07:06.440 --> 00:07:09.500
of chaining the commands together

00:07:10.920 --> 00:07:13.440
and working with the output of commands

00:07:13.440 --> 00:07:15.700
I will give you a few minutes

00:07:15.700 --> 00:07:17.120
just give this a try

00:07:17.120 --> 00:07:18.800
Ivan you are comfortable with this?

00:07:19.040 --> 00:07:19.260
yeah

00:07:20.220 --> 00:07:20.960
alright

00:07:20.960 --> 00:07:25.140
giving a quick minute for people to try this out

00:07:25.140 --> 00:07:27.400
E2 all good?

00:07:28.100 --> 00:07:29.500
yes all good

00:07:31.860 --> 00:07:34.080
let's continue now

00:07:34.080 --> 00:07:37.160
and look at the idea

00:07:37.160 --> 00:07:39.940
of chaining multiple commands together

00:07:39.940 --> 00:07:43.480
and what I mean by that is taking the output of one command

00:07:43.480 --> 00:07:46.180
and using it as an input

00:07:46.180 --> 00:07:47.900
of the second command

00:07:47.900 --> 00:07:51.880
just a quick reminder we did this command earlier w c

00:07:51.880 --> 00:07:53.780
what is it waiting for?

00:07:54.020 --> 00:07:58.200
this command right now

00:07:58.200 --> 00:08:00.960
maybe for you to terminate

00:08:00.960 --> 00:08:03.580
or you have to write and then terminate

00:08:03.580 --> 00:08:05.680
then it will terminate

00:08:05.680 --> 00:08:10.260
isn't the file that it must wait

00:08:10.260 --> 00:08:11.880
to come from

00:08:11.880 --> 00:08:14.840
so it needs some input

00:08:14.840 --> 00:08:16.460
isn't it simple words

00:08:17.380 --> 00:08:18.920
it needs some input

00:08:23.100 --> 00:08:24.380
and then

00:08:24.380 --> 00:08:25.800
it does what it does

00:08:25.800 --> 00:08:29.100
so to terminate when you type it just

00:08:29.100 --> 00:08:30.920
we have to use what control d

00:08:34.260 --> 00:08:37.460
control c will abort it

00:08:37.460 --> 00:08:40.340
so you come to an empty line

00:08:40.340 --> 00:08:43.080
a blank new line and then do control d

00:08:43.080 --> 00:08:46.460
control d is technically called as end of file

00:08:48.540 --> 00:08:50.340
and the trouble is sometimes

00:08:50.340 --> 00:08:52.220
when you are reading websites or documents

00:08:52.220 --> 00:08:54.540
and they say EOF

00:08:54.540 --> 00:08:57.280
and you are like what is this? what do I do?

00:08:57.320 --> 00:09:00.060
because you literally type EOF

00:09:01.200 --> 00:09:02.780
that's the end of file

00:09:07.140 --> 00:09:08.260
and you are like

00:09:10.100 --> 00:09:12.040
and you are like why is it not working

00:09:12.040 --> 00:09:13.920
I am typing what the guys say

00:09:16.420 --> 00:09:19.000
because there is no way for them to type

00:09:19.000 --> 00:09:20.660
the keystrokes

00:09:21.820 --> 00:09:23.720
so this is how they are represented

00:09:25.320 --> 00:09:28.440
so here I am going to do this

00:09:28.440 --> 00:09:30.260
ls minus l

00:09:32.920 --> 00:09:33.920
or slash

00:09:35.860 --> 00:09:36.860
let's say

00:09:38.700 --> 00:09:40.260
of my current

00:09:43.460 --> 00:09:44.020
folder

00:09:44.020 --> 00:09:45.920
so I am going to do ls minus l

00:09:45.920 --> 00:09:48.660
what I am going to do now I am going to put a pipe

00:09:49.440 --> 00:09:52.300
and literally the pipe is acting as a pipe

00:09:52.860 --> 00:09:55.160
is going to take this

00:09:55.860 --> 00:09:57.980
output of ls minus l

00:09:57.980 --> 00:10:01.780
and it will pass on that output to the word count

00:10:01.780 --> 00:10:03.020
as an input

00:10:04.640 --> 00:10:07.440
and now word count is counting

00:10:08.100 --> 00:10:10.260
the output of the first command

00:10:10.260 --> 00:10:13.000
it says hey you have 41 lines and so many words

00:10:13.000 --> 00:10:15.240
so this is the idea of piping

00:10:15.240 --> 00:10:17.160
you can carry on piping

00:10:17.160 --> 00:10:21.500
you can take the output of word count and give it to another command

00:10:22.020 --> 00:10:23.940
and you can change them together

00:10:23.940 --> 00:10:26.900
the most common reason

00:10:26.900 --> 00:10:30.260
in the Linux Unix world when we are piping

00:10:30.260 --> 00:10:32.700
is because we want to filter the output

00:10:32.700 --> 00:10:35.400
and we are looking for something specific

00:10:36.260 --> 00:10:38.880
let me explain for example

00:10:38.880 --> 00:10:41.600
let's look at this file

00:10:41.600 --> 00:10:43.000
ETC hosts

00:10:45.260 --> 00:10:48.080
there are many lines in this

00:10:48.080 --> 00:10:50.980
some lines contain the word localhost

00:10:50.980 --> 00:10:52.220
correct?

00:10:58.380 --> 00:11:01.280
what if I wanted to see only those lines

00:11:01.280 --> 00:11:03.600
so typically you can use

00:11:04.220 --> 00:11:05.420
attune grep

00:11:05.420 --> 00:11:09.860
I can say grep I am looking for localhost

00:11:11.460 --> 00:11:12.960
in this file

00:11:14.120 --> 00:11:16.120
I have to say vini and eto

00:11:16.120 --> 00:11:18.780
are the fastest at doing what I am doing

00:11:18.780 --> 00:11:20.260
sometimes I get confused

00:11:20.260 --> 00:11:21.820
am I watching my terminal

00:11:22.740 --> 00:11:23.920
or somebody else

00:11:27.660 --> 00:11:35.440
I look at vini and eto's terminal

00:11:35.440 --> 00:11:37.080
is that me with the delay

00:11:40.220 --> 00:11:42.200
what do we get

00:11:44.140 --> 00:11:45.780
it has kind of filtered out

00:11:47.260 --> 00:11:49.720
all the lines that contain localhost

00:11:49.720 --> 00:11:51.600
is only showing us that

00:11:51.600 --> 00:11:54.280
I can do it the other way round

00:11:54.280 --> 00:11:55.600
inverse

00:11:58.560 --> 00:12:00.000
with a minus v

00:12:00.000 --> 00:12:05.080
I don't want to see any line that contains the word localhost

00:12:05.780 --> 00:12:07.860
goes the other way round

00:12:10.800 --> 00:12:12.120
minus v

00:12:16.680 --> 00:12:17.440
eto

00:12:17.440 --> 00:12:17.820
is

00:12:19.320 --> 00:12:20.780
not the way

00:12:20.780 --> 00:12:21.720
I know

00:12:21.720 --> 00:12:26.120
I use it to

00:12:27.660 --> 00:12:29.700
show when I am running

00:12:29.700 --> 00:12:32.000
maybe I am executing something

00:12:32.000 --> 00:12:34.500
so that it can show me what it is doing

00:12:34.500 --> 00:12:37.220
so be very careful

00:12:38.520 --> 00:12:40.040
options are

00:12:40.040 --> 00:12:42.360
different for different commands

00:12:43.900 --> 00:12:45.340
every command

00:12:45.340 --> 00:12:47.500
has its own options

00:12:47.500 --> 00:12:52.700
so minus v for one command doesn't mean the same as minus v for the other command

00:12:52.700 --> 00:12:53.800
in many

00:12:53.800 --> 00:12:56.780
minus v stands for verbose

00:12:56.780 --> 00:12:59.560
but please don't make that assumption

00:12:59.560 --> 00:13:02.420
every single command has its own options

00:13:02.420 --> 00:13:05.540
you have to read the main page for it

00:13:05.540 --> 00:13:07.880
this is specifically for graph

00:13:08.560 --> 00:13:11.880
now let's combine a few things together

00:13:11.880 --> 00:13:13.440
for example

00:13:13.440 --> 00:13:17.560
ls minus l slash etc

00:13:18.080 --> 00:13:20.000
now this is a big output

00:13:23.600 --> 00:13:26.220
these are all the files in

00:13:26.220 --> 00:13:27.480
etc

00:13:29.540 --> 00:13:32.260
I specifically want to look at

00:13:32.260 --> 00:13:35.160
all the configuration files in

00:13:35.160 --> 00:13:36.060
etc

00:13:38.740 --> 00:13:41.040
I only want to see

00:13:41.040 --> 00:13:44.220
those that were updated let's say in

00:13:44.960 --> 00:13:47.660
February I put a pipe

00:13:47.660 --> 00:13:50.220
grip and give me a quick second

00:13:50.780 --> 00:13:52.600
hang on

00:13:54.680 --> 00:13:55.340
hello

00:13:56.220 --> 00:13:57.540
yes boss

00:13:59.160 --> 00:13:59.820
from

00:14:01.220 --> 00:14:04.280
why are you calling me my friend

00:14:05.400 --> 00:14:07.920
thank you my friend thank you

00:14:08.840 --> 00:14:09.500
sorry

00:14:15.440 --> 00:14:17.060
so I say grip

00:14:17.600 --> 00:14:20.600
I include minus i because I don't care about uppercase and

00:14:20.670 --> 00:14:23.210
I will simply

00:14:25.070 --> 00:14:26.270
say fab

00:14:32.610 --> 00:14:34.530
some kind of filtering out

00:14:35.250 --> 00:14:38.290
and I want to know how many of these are there

00:14:53.310 --> 00:14:55.270
as you can see

00:14:55.270 --> 00:14:58.030
the pipe is one of the most useful

00:14:58.030 --> 00:15:00.850
to allow us to chain multiple commands

00:15:01.650 --> 00:15:02.310
together

00:15:03.510 --> 00:15:06.050
yes I'm familiar with the pipe

00:15:06.050 --> 00:15:08.790
what did you say the semicolon was for again

00:15:08.790 --> 00:15:11.830
just to run multiple commands at the same time

00:15:11.830 --> 00:15:13.690
there is no chaining between them

00:15:13.690 --> 00:15:14.110
okay

00:15:18.850 --> 00:15:19.630
that's fine

00:15:19.630 --> 00:15:21.450
this is the graveyard shift

00:15:25.710 --> 00:15:27.790
it's a happy time for a trainer

00:15:27.790 --> 00:15:31.210
because people have no questions at all and if you are

00:15:31.210 --> 00:15:33.710
doing any workshop in person

00:15:34.690 --> 00:15:37.510
the moment you look at somebody they just shake their head

00:15:37.510 --> 00:15:40.150
in anticipation saying all is well

00:15:40.150 --> 00:15:42.350
don't look at me I have products

00:15:48.150 --> 00:15:51.350
here I can just monitor who's typing and whose terminal

00:15:55.830 --> 00:15:56.470
is blank

00:15:57.830 --> 00:15:59.270
hopefully this is clear

00:16:02.770 --> 00:16:03.950
go ahead

00:16:10.150 --> 00:16:12.530
I like that Akona is the

00:16:12.530 --> 00:16:14.530
translator between me and others

00:16:16.210 --> 00:16:17.850
he's acting as

00:16:17.850 --> 00:16:21.350
I'm not sure if you are acting as a bridge or a switch

00:16:21.350 --> 00:16:23.730
or a router or a gateway or a proxy

00:16:23.730 --> 00:16:26.210
but well done

00:16:28.010 --> 00:16:30.690
it's more like a layer two amplifier to me

00:16:31.790 --> 00:16:34.150
so that's basically the idea of

00:16:34.690 --> 00:16:36.530
connecting and chaining the commands

00:16:36.530 --> 00:16:39.750
together frankly comes in very very handy as well

00:16:39.750 --> 00:16:42.590
and things like graph kind of work as well

00:16:42.590 --> 00:16:44.330
quite well

00:16:45.550 --> 00:16:48.490
talking about connecting commands together

00:16:49.690 --> 00:16:51.530
and working on

00:16:51.530 --> 00:16:54.430
files we saw this earlier when we did

00:16:54.430 --> 00:16:56.210
a little bit of this

00:16:57.090 --> 00:16:58.670
and we did that

00:16:59.470 --> 00:17:03.510
so what does that greater than sign represent

00:17:04.570 --> 00:17:05.970
it says

00:17:06.510 --> 00:17:08.010
it's like redirect

00:17:12.230 --> 00:17:13.630
you are

00:17:13.630 --> 00:17:14.730
you are sending

00:17:14.730 --> 00:17:16.770
these to a file

00:17:18.310 --> 00:17:21.630
my understanding is that you are sending this

00:17:21.630 --> 00:17:24.510
so these that you are going to be writing on the first line

00:17:24.510 --> 00:17:26.810
of the file

00:17:27.510 --> 00:17:29.050
always on the first line

00:17:29.050 --> 00:17:32.210
you are redirecting

00:17:32.210 --> 00:17:33.470
the output

00:17:34.770 --> 00:17:36.770
somewhere to some device

00:17:38.870 --> 00:17:41.270
however let's pay attention to that

00:17:41.270 --> 00:17:44.170
a little bit what happens if I run

00:17:44.170 --> 00:17:47.050
a command like this

00:17:47.590 --> 00:17:49.850
so var is a folder that exists

00:17:49.850 --> 00:17:52.270
so I get some output

00:17:53.050 --> 00:17:56.150
and var one is a folder that does not exist

00:17:56.150 --> 00:17:58.010
and I get some error

00:18:00.390 --> 00:18:02.370
what would happen

00:18:03.090 --> 00:18:05.150
if I did this and the command takes

00:18:05.150 --> 00:18:07.410
multiple arguments what am I going to get

00:18:07.410 --> 00:18:11.150
only the good only the bad the both nothing

00:18:12.810 --> 00:18:14.270
only the good

00:18:14.270 --> 00:18:17.130
that will be very nice very convenient

00:18:17.130 --> 00:18:18.110
I like that

00:18:20.910 --> 00:18:22.410
I get both

00:18:25.550 --> 00:18:27.210
I get the error

00:18:28.990 --> 00:18:29.990
as well as

00:18:29.990 --> 00:18:32.630
what we call as a standard output

00:18:33.150 --> 00:18:35.490
so there is a standard error

00:18:35.490 --> 00:18:38.130
there is a standard out I get them both okay

00:18:38.130 --> 00:18:41.590
what we are going to do now we are going to repeat exactly the same

00:18:41.590 --> 00:18:42.170
command

00:18:44.750 --> 00:18:46.810
and I am going to say this

00:18:49.110 --> 00:18:50.750
what do you expect

00:18:50.750 --> 00:18:53.750
to be captured into that log file

00:18:59.810 --> 00:19:01.950
first we ran the command we saw

00:19:01.950 --> 00:19:03.530
everything on the screen

00:19:04.310 --> 00:19:07.550
on the terminal and now I am saying okay let's run

00:19:07.550 --> 00:19:10.750
exactly the same command again and I want everything to go

00:19:10.750 --> 00:19:12.750
into that log file

00:19:14.470 --> 00:19:16.490
watch what happens

00:19:17.970 --> 00:19:19.530
what do you see on the screen

00:19:19.530 --> 00:19:21.110
this cannot access

00:19:21.110 --> 00:19:25.450
so that's the error correct

00:19:25.450 --> 00:19:28.530
so guess what's in the log file

00:19:29.890 --> 00:19:31.530
only the good news

00:19:32.130 --> 00:19:34.530
oh okay

00:19:37.350 --> 00:19:38.610
not expecting

00:19:38.610 --> 00:19:39.950
sorry

00:19:41.430 --> 00:19:43.670
the output

00:19:43.670 --> 00:19:45.110
of

00:19:45.110 --> 00:19:48.450
that directory that command

00:19:49.470 --> 00:19:50.470
worked

00:19:52.930 --> 00:19:54.890
slash war

00:19:56.390 --> 00:19:58.330
is successful

00:20:00.370 --> 00:20:02.130
so that output

00:20:02.130 --> 00:20:05.110
is saved into the log file

00:20:06.350 --> 00:20:08.090
this is the output

00:20:08.090 --> 00:20:09.490
yeah

00:20:11.510 --> 00:20:14.450
the error is on the

00:20:15.950 --> 00:20:16.550
terminal

00:20:19.710 --> 00:20:20.510
so the

00:20:20.510 --> 00:20:22.690
error is on the terminal

00:20:24.530 --> 00:20:26.250
the good news goes in there

00:20:26.250 --> 00:20:29.210
so watch this now

00:20:30.050 --> 00:20:31.250
same command

00:20:46.790 --> 00:20:48.150
and let's see

00:20:49.270 --> 00:20:51.090
we'll explain in a bit

00:20:51.090 --> 00:20:53.350
but see if you notice any difference

00:20:53.350 --> 00:20:56.190
what's different this time

00:20:56.190 --> 00:20:59.030
here there is one

00:20:59.890 --> 00:21:02.210
there is two

00:21:02.210 --> 00:21:04.710
and what's showing up on the screen

00:21:04.710 --> 00:21:05.910
it looks like

00:21:05.910 --> 00:21:11.150
do you see any errors like you saw last time

00:21:11.150 --> 00:21:12.010
no

00:21:18.750 --> 00:21:22.130
so what does log file 1

00:21:22.130 --> 00:21:23.550
contain

00:21:24.790 --> 00:21:27.650
no log file 1 contains the good output

00:21:27.650 --> 00:21:30.650
yes and you can guess

00:21:41.150 --> 00:21:42.890
log file 1 in the same output

00:21:44.150 --> 00:21:45.790
the second output

00:21:45.790 --> 00:21:48.410
but I think there is a trick in there

00:21:48.410 --> 00:21:50.870
this one

00:21:53.310 --> 00:21:55.670
so it's not the

00:21:55.670 --> 00:21:58.130
first output or the second output

00:21:58.130 --> 00:22:01.350
one is a special number

00:22:01.350 --> 00:22:03.750
which means standard output

00:22:04.770 --> 00:22:08.090
and two is redirecting the

00:22:08.090 --> 00:22:10.730
so one is the code for the good output

00:22:10.730 --> 00:22:13.190
two is the code for errors

00:22:15.210 --> 00:22:16.790
so there's no three

00:22:18.150 --> 00:22:18.750
yes

00:22:31.650 --> 00:22:33.550
so my question

00:22:33.550 --> 00:22:35.750
is that

00:22:37.170 --> 00:22:39.330
so you said

00:22:39.330 --> 00:22:41.550
the AR1

00:22:41.550 --> 00:22:44.490
and then you said

00:22:47.850 --> 00:22:48.630
one

00:22:48.630 --> 00:22:50.450
must redirect to log file 1

00:22:50.450 --> 00:22:52.850
and two must redirect to log file 2

00:22:54.690 --> 00:22:56.430
first and the second

00:22:57.850 --> 00:22:59.990
no it isn't

00:23:01.510 --> 00:23:03.690
but that's not the case

00:23:31.490 --> 00:23:33.130
maybe I type it

00:23:33.990 --> 00:23:36.470
no I can't see your screen

00:23:36.990 --> 00:23:37.670
no no

00:23:40.250 --> 00:23:42.750
I can explain very simply

00:23:42.750 --> 00:23:45.350
if I just say mkdir

00:23:45.350 --> 00:23:46.930
I'm in a current folder

00:23:49.910 --> 00:23:51.650
let's say I make a folder

00:23:51.650 --> 00:23:53.110
called as data100

00:23:54.150 --> 00:23:57.170
what happens if I repeat the same command again

00:23:58.290 --> 00:24:00.730
so that's an example of an error

00:24:01.630 --> 00:24:04.190
so this is what 2 greater than

00:24:04.190 --> 00:24:05.470
simply represents

00:24:07.170 --> 00:24:09.950
any errors are redirected

00:24:10.770 --> 00:24:12.750
in the case of the first one

00:24:12.750 --> 00:24:14.010
was the command successful

00:24:16.090 --> 00:24:18.310
so if I take an example again

00:24:18.310 --> 00:24:21.210
I say make directory 101

00:24:23.870 --> 00:24:25.230
it worked correct

00:24:26.070 --> 00:24:26.810
yes

00:24:26.810 --> 00:24:30.370
what if I say echo

00:24:31.590 --> 00:24:33.250
dollar question mark

00:24:33.250 --> 00:24:34.610
this is a special command

00:24:34.610 --> 00:24:37.470
how did the last command exit

00:24:37.470 --> 00:24:40.170
what was the code exit code

00:24:40.170 --> 00:24:43.510
exit code 0 it exited without any errors

00:24:44.270 --> 00:24:45.610
basic programming

00:24:45.610 --> 00:24:48.230
I run the same command again

00:24:50.470 --> 00:24:52.690
what was the exit code

00:24:52.690 --> 00:24:53.930
of that command

00:24:55.230 --> 00:24:56.750
that's an error

00:24:59.670 --> 00:25:01.070
so anytime

00:25:01.070 --> 00:25:02.870
you are doing redirection

00:25:02.870 --> 00:25:05.670
one greater than simply means

00:25:05.670 --> 00:25:07.630
without errors

00:25:07.630 --> 00:25:10.150
two greater than means any error

00:25:13.110 --> 00:25:15.250
the reason I'm showcasing

00:25:15.250 --> 00:25:16.770
a single command here

00:25:16.770 --> 00:25:19.590
is because I can show both

00:25:19.590 --> 00:25:22.470
good output and an error

00:25:22.470 --> 00:25:24.290
from a single command

00:25:24.290 --> 00:25:27.530
is it always based on the last command

00:25:27.530 --> 00:25:29.370
yes yes yes

00:25:29.370 --> 00:25:32.810
what do you mean 1 and 2 based on the last command

00:25:32.810 --> 00:25:36.330
so you run a command right

00:25:39.390 --> 00:25:42.230
this echo dollar question mark

00:25:42.230 --> 00:25:45.070
is the exit code of the last thing that ran

00:25:45.070 --> 00:25:46.230
in the terminal

00:25:51.070 --> 00:25:53.190
now let's do something interesting

00:25:53.190 --> 00:25:54.850
ls slash var

00:25:54.850 --> 00:25:57.770
which we know will work successfully

00:26:01.310 --> 00:26:02.810
and slash var 1

00:26:02.810 --> 00:26:04.230
as well we are going to do something

00:26:04.230 --> 00:26:07.050
we are going to redirect this to

00:26:14.970 --> 00:26:16.470
I'm going to do something

00:26:17.310 --> 00:26:17.750
here

00:26:28.390 --> 00:26:30.630
what's going to happen here

00:26:32.230 --> 00:26:33.610
we still don't have var 1

00:26:34.290 --> 00:26:36.370
yeah so we will get both

00:26:36.370 --> 00:26:37.030
the output and the

00:26:37.030 --> 00:26:41.050
the good output will go into the good

00:26:41.050 --> 00:26:42.090
log fair enough

00:26:42.970 --> 00:26:44.750
where is the error going

00:26:48.230 --> 00:26:49.710
and dev null

00:26:49.710 --> 00:26:52.390
is a black hole

00:26:53.030 --> 00:26:55.830
in your operating system

00:26:57.710 --> 00:26:58.930
even light

00:26:58.930 --> 00:27:00.910
cannot escape it

00:27:00.910 --> 00:27:04.250
so whatever you throw there never comes out

00:27:04.250 --> 00:27:05.730
it disappears in thin air

00:27:05.730 --> 00:27:10.250
so you can't go to this

00:27:10.870 --> 00:27:12.790
direct and say I'm going to check

00:27:12.790 --> 00:27:15.690
what is inside null file

00:27:16.650 --> 00:27:17.270
nope

00:27:20.110 --> 00:27:22.130
so there you just throw in

00:27:22.130 --> 00:27:22.990
what is garbage

00:27:26.110 --> 00:27:28.650
so I don't see it on the terminal

00:27:28.650 --> 00:27:30.670
it's not recorded into a log file

00:27:30.670 --> 00:27:32.990
in a file system as you said is garbage

00:27:32.990 --> 00:27:34.730
please try this out

00:27:34.730 --> 00:27:39.050
Vinny you are right about being the quietest one

00:27:40.550 --> 00:27:41.390
I know

00:27:42.630 --> 00:27:45.390
I mean in the training session

00:27:45.390 --> 00:27:46.330
not in general

00:27:49.410 --> 00:27:50.530
wrong impressions

00:27:51.370 --> 00:27:54.470
that's what we need today

00:27:55.550 --> 00:27:56.830
that's what we need

00:27:57.850 --> 00:28:00.650
it depends on the situation

00:28:00.650 --> 00:28:01.430
it's an alias

00:28:02.050 --> 00:28:03.830
oh it's because it's not conveyed

00:28:05.210 --> 00:28:06.370
I see

00:28:06.370 --> 00:28:12.270
I don't know what you want to want now

00:28:12.270 --> 00:28:14.410
it's a stranger danger

00:28:14.410 --> 00:28:16.430
I think it's bad as much as people

00:28:18.270 --> 00:28:19.590
it's also a bit quiet

00:28:19.590 --> 00:28:22.730
it doesn't involve cyber security

00:28:22.730 --> 00:28:23.970
type

00:28:32.190 --> 00:28:32.870
type

00:28:34.030 --> 00:28:35.150
just type

00:28:35.150 --> 00:28:37.370
you have a terminal just type

00:28:40.050 --> 00:28:40.730
alright

00:28:40.730 --> 00:28:42.330
hopefully you can try this out

00:28:42.330 --> 00:28:45.550
hoping that this makes sense as well

00:28:45.550 --> 00:28:49.030
as to how do we redirect the output

00:28:49.030 --> 00:28:50.850
and in this case

00:28:50.850 --> 00:28:54.070
sending some part of it

00:28:54.070 --> 00:28:55.770
to them now

00:28:55.770 --> 00:28:57.910
please tell me one thing

00:28:58.750 --> 00:29:01.190
so if you're saying

00:29:04.030 --> 00:29:05.770
the code output must go to code log

00:29:05.770 --> 00:29:09.030
don't need to have created code log

00:29:09.030 --> 00:29:10.330
as a file format

00:29:11.630 --> 00:29:15.110
only one thing to note

00:29:15.110 --> 00:29:18.110
and that thing to note is

00:29:21.110 --> 00:29:23.270
if you keep doing this

00:29:23.270 --> 00:29:27.110
you will overwrite that file

00:29:28.050 --> 00:29:29.630
if you keep doing what?

00:29:30.730 --> 00:29:31.470
redirection

00:29:33.730 --> 00:29:36.530
unless you do

00:29:37.550 --> 00:29:38.290
that

00:29:38.290 --> 00:29:41.290
this is going to append at the end of the file

00:29:41.290 --> 00:29:44.330
yeah, I wanted to ask if it

00:29:44.330 --> 00:29:47.290
applies here as well

00:29:49.530 --> 00:29:52.110
be careful with that

00:29:52.110 --> 00:29:53.290
append otherwise

00:29:55.950 --> 00:29:57.750
you're going to overwrite

00:29:57.750 --> 00:29:59.270
that can happen

00:29:59.270 --> 00:30:01.950
you can accidentally just use the redirect again

00:30:01.950 --> 00:30:04.570
and then you look at the file and you're like

00:30:04.570 --> 00:30:06.650
where is everything? you just wiped it clean

00:30:06.650 --> 00:30:08.590
so just be careful with that

00:30:08.590 --> 00:30:12.650
I'll give you the opportunity of course to try everything out

00:30:13.330 --> 00:30:16.010
that was the intent today to keep it as a workshop

00:30:16.010 --> 00:30:18.970
and obviously you need to spend some time

00:30:18.970 --> 00:30:20.430
with the OS yourself

00:30:21.970 --> 00:30:24.650
most many networking devices and systems

00:30:25.270 --> 00:30:26.670
have underlying Linux

00:30:26.670 --> 00:30:30.510
minimum you want to go there, look at some log files and stuff like that

00:30:30.510 --> 00:30:32.430
so hopefully you feel more comfortable doing that

00:30:32.430 --> 00:30:35.610
when I started with my life in IT

00:30:35.610 --> 00:30:38.230
back in those days

00:30:38.230 --> 00:30:40.710
there were only three options

00:30:40.710 --> 00:30:43.910
that people understood related to IT

00:30:44.430 --> 00:30:46.390
either it was hardware

00:30:47.430 --> 00:30:48.510
or software

00:30:48.510 --> 00:30:52.190
or multimedia and I had a hard time telling people

00:30:52.190 --> 00:30:54.150
I'm a network engineer, nobody understood

00:30:54.150 --> 00:30:56.050
I'll tell them I'm from the network

00:30:56.050 --> 00:30:57.390
and they're saying yeah so which one?

00:30:57.390 --> 00:30:59.050
hardware, software or multimedia?

00:31:00.710 --> 00:31:03.530
you had to put yourself in one of the buckets

00:31:03.530 --> 00:31:08.210
scroll up

00:31:08.210 --> 00:31:09.710
scroll up

00:31:10.570 --> 00:31:12.630
I think that's all there is

00:31:12.630 --> 00:31:17.250
are you happy to show me the history?

00:31:18.790 --> 00:31:20.250
you can try this out

00:31:20.250 --> 00:31:22.590
this is for everybody, just run the command

00:31:25.130 --> 00:31:26.130
lso lso

00:31:28.470 --> 00:31:31.110
and any command you want to execute

00:31:31.110 --> 00:31:32.990
just put exclamation mark

00:31:32.990 --> 00:31:35.210
and put the command number

00:31:38.050 --> 00:31:40.450
oh you can do that

00:31:40.450 --> 00:31:41.590
as you can

00:31:46.550 --> 00:31:47.050
yeah

00:31:47.050 --> 00:31:47.850
so what can you do?

00:31:48.090 --> 00:31:48.790
so what can you do?

00:31:49.850 --> 00:31:52.730
oh you can run the command

00:31:52.730 --> 00:31:53.730
and the history

00:31:53.730 --> 00:31:54.830
using the number

00:32:07.790 --> 00:32:10.530
I thought I know Linux

00:32:12.610 --> 00:32:13.730
that's fair

00:32:16.830 --> 00:32:18.710
I mean you would always assume

00:32:18.710 --> 00:32:21.290
that since you are comfortable with it

00:32:21.290 --> 00:32:22.530
you can get certain things done

00:32:23.310 --> 00:32:25.530
I can understand why you would say that

00:32:26.610 --> 00:32:28.750
the commands you know are enough

00:32:28.750 --> 00:32:30.490
for the work that you do

00:32:31.570 --> 00:32:32.690
specific tasks

00:32:34.950 --> 00:32:36.890
nothing wrong with that

00:32:36.890 --> 00:32:39.830
yeah but I was using the wrong commands

00:32:39.830 --> 00:32:42.750
to do certain things

00:32:42.750 --> 00:32:45.610
in fact I was just doing

00:32:45.610 --> 00:32:46.750
five steps

00:32:46.750 --> 00:32:49.690
and then I'm done

00:32:53.770 --> 00:32:55.750
so hopefully that works out

00:32:55.750 --> 00:32:57.850
we can see the append

00:32:57.850 --> 00:33:01.210
with the greater science twice

00:33:01.210 --> 00:33:03.630
a quick look at the history

00:33:03.630 --> 00:33:06.630
and then executing the commands

00:33:06.630 --> 00:33:07.810
in the history

00:33:07.810 --> 00:33:11.750
so there are lots of tricks

00:33:11.750 --> 00:33:14.290
on the shell

00:33:19.310 --> 00:33:21.710
and that's kind of what we are

00:33:21.710 --> 00:33:22.970
aiming for here

00:33:22.970 --> 00:33:27.530
knowing how to get certain things done

00:33:27.530 --> 00:33:30.330
or maybe understanding how things happen

00:33:31.330 --> 00:33:35.410
and then these could be very handy as well

00:33:37.210 --> 00:33:38.210
so this works

00:33:38.210 --> 00:33:40.810
now as you are working with the log files

00:33:40.810 --> 00:33:42.370
and the file system

00:33:42.370 --> 00:33:44.890
and we are looking at how to append

00:33:46.850 --> 00:33:48.930
one thing just comes to mind

00:33:48.930 --> 00:33:51.130
and that is when you are

00:33:51.130 --> 00:33:54.030
specifically if you are working with log files

00:33:54.030 --> 00:33:56.590
and reading some log files

00:33:56.590 --> 00:33:58.710
what comes in kind of handy

00:33:58.710 --> 00:34:00.050
let's have a look

00:34:00.050 --> 00:34:04.650
I'm in the same folder just to make my life easier

00:34:14.970 --> 00:34:18.070
so if I have a log file

00:34:18.070 --> 00:34:21.950
and we have seen a couple of log files

00:34:21.950 --> 00:34:24.770
like here is the good log file

00:34:24.770 --> 00:34:27.770
and we saw that we could add something

00:34:30.310 --> 00:34:32.110
into the log file

00:34:34.150 --> 00:34:36.370
if I cat or more

00:34:36.370 --> 00:34:38.990
I will see that happening

00:34:39.770 --> 00:34:42.910
but I can actually watch a file live

00:34:42.910 --> 00:34:45.490
I can keep the file open

00:34:45.490 --> 00:34:47.330
text file open

00:34:47.330 --> 00:34:51.210
and what tail is going to do is show me as new entries

00:34:51.210 --> 00:34:52.650
come into that log file

00:34:52.650 --> 00:34:55.450
so very handy if new messages are getting recorded

00:34:55.450 --> 00:34:58.190
so I keep tail minus F

00:34:58.190 --> 00:35:01.570
you can see here it's keeping the terminal open

00:35:04.150 --> 00:35:06.370
this command I can tell you

00:35:07.290 --> 00:35:07.890
here

00:35:09.190 --> 00:35:11.070
all of us

00:35:11.070 --> 00:35:13.970
we use it in telephases

00:35:13.970 --> 00:35:16.170
you are masters of this

00:35:16.170 --> 00:35:18.890
that's only, I'm sure, not true

00:35:22.030 --> 00:35:24.830
I'm sure with all these tricks

00:35:24.830 --> 00:35:26.950
maybe it's something

00:35:28.610 --> 00:35:30.750
because already I'm seeing the number of lines

00:35:30.750 --> 00:35:34.190
1, 2, 3, 4, 5, white has always written 5

00:35:34.190 --> 00:35:37.130
is that the default? can we change the number of files?

00:35:37.690 --> 00:35:40.390
but it's doing echo there

00:35:41.410 --> 00:35:43.070
redirecting to good log

00:35:44.330 --> 00:35:46.230
I'm just adding more

00:35:46.230 --> 00:35:49.430
into the file

00:35:54.090 --> 00:35:56.190
it's just watching the file

00:35:56.190 --> 00:35:57.290
live

00:36:01.250 --> 00:36:02.090
okay

00:36:02.090 --> 00:36:03.510
that's one

00:36:03.510 --> 00:36:07.310
you can always control C out of it

00:36:08.070 --> 00:36:09.710
there are a few other things

00:36:09.710 --> 00:36:12.990
frankly I haven't tried them on Ubuntu

00:36:12.990 --> 00:36:15.450
is there a command watch? oh yeah there is

00:36:15.450 --> 00:36:16.970
very nice

00:36:16.970 --> 00:36:21.130
that should work

00:36:21.710 --> 00:36:22.230
so

00:36:25.630 --> 00:36:26.470
watch

00:36:27.770 --> 00:36:30.070
2 minus A

00:36:31.550 --> 00:36:34.250
it's actually repeating the command

00:36:34.250 --> 00:36:36.770
every 2 seconds

00:36:36.770 --> 00:36:38.130
then showing me the output

00:36:38.130 --> 00:36:42.410
so tail was showing you a file

00:36:42.410 --> 00:36:45.130
as data enters into that file

00:36:45.770 --> 00:36:47.910
who is just repeating the command

00:36:47.910 --> 00:36:49.570
over and over and over again

00:36:49.570 --> 00:36:53.810
so if I open a new terminal

00:37:03.450 --> 00:37:05.850
another terminal

00:37:13.810 --> 00:37:16.810
number of terminals incrementing

00:37:17.590 --> 00:37:19.470
let me just

00:37:19.470 --> 00:37:20.890
arrange this a bit

00:37:27.870 --> 00:37:28.750
that's

00:37:28.750 --> 00:37:30.790
number 6

00:37:31.870 --> 00:37:33.650
I wonder why not

00:37:40.550 --> 00:37:42.890
I just need to

00:37:47.030 --> 00:37:48.450
I'm not sure

00:37:48.450 --> 00:37:49.550
my other terminals

00:38:07.470 --> 00:38:08.870
let's

00:38:08.870 --> 00:38:09.050
let's

00:38:09.050 --> 00:38:10.870
let's try something very simple

00:38:12.370 --> 00:38:13.770
ls

00:38:13.770 --> 00:38:15.810
slash temp

00:38:19.750 --> 00:38:20.650
and let's

00:38:20.650 --> 00:38:21.390
just create

00:38:21.390 --> 00:38:22.770
a file

00:38:30.150 --> 00:38:31.550
typically it works

00:38:31.550 --> 00:38:33.610
I will just check some options

00:38:34.270 --> 00:38:36.810
I can see the file x show up now

00:38:39.110 --> 00:38:39.990
let me

00:38:39.990 --> 00:38:41.810
create another file y

00:38:41.810 --> 00:38:44.810
that shows up there as well

00:38:51.010 --> 00:38:53.810
takes 2 seconds but it shows up

00:38:54.590 --> 00:38:56.630
I wish this was there back in the day

00:38:56.630 --> 00:38:58.430
in the Unix world but yeah here we go

00:38:58.430 --> 00:39:02.450
you have a command that watches other commands

00:39:02.450 --> 00:39:05.730
execute and update that might be handy

00:39:06.630 --> 00:39:08.850
instead of you manually running the command

00:39:08.850 --> 00:39:09.670
every time

00:39:19.090 --> 00:39:21.850
no tail is watching a file

00:39:23.350 --> 00:39:25.190
showing your data coming

00:39:25.190 --> 00:39:27.850
into the file watch is running a command

00:39:30.990 --> 00:39:31.790
repetitively

00:39:31.790 --> 00:39:33.290
any command

00:39:33.850 --> 00:39:34.730
that's fine

00:39:37.090 --> 00:39:38.230
you mean the

00:39:38.230 --> 00:39:38.970
interval

00:39:55.230 --> 00:39:57.730
don't look at the command ls

00:39:57.730 --> 00:39:59.830
watch can be just used for anything

00:39:59.830 --> 00:40:00.730
watch the date

00:40:04.850 --> 00:40:07.310
about 2 seconds of the time changes

00:40:09.510 --> 00:40:10.830
don't equate watch

00:40:10.830 --> 00:40:13.610
with files watch is simply a way to repeat command

00:40:13.610 --> 00:40:15.870
and watch them execute

00:40:21.990 --> 00:40:24.090
control c just works

00:40:26.170 --> 00:40:27.990
control c is your best friend

00:40:27.990 --> 00:40:30.070
on the Unix command line

00:40:30.790 --> 00:40:33.650
when in doubt control c

00:40:34.470 --> 00:40:36.630
except to the e or f

00:40:49.090 --> 00:40:51.650
sleep for one second

00:40:53.870 --> 00:40:55.770
give me the list of

00:40:56.850 --> 00:40:57.550
clear

00:41:07.830 --> 00:41:09.270
just simply

00:41:09.270 --> 00:41:11.250
works very handy

00:41:11.250 --> 00:41:14.130
keep looking at my IP addresses

00:41:14.130 --> 00:41:16.710
see if anything changes a new IP gets

00:41:16.710 --> 00:41:18.890
created whatever

00:41:18.890 --> 00:41:21.650
what is your friend helps in many cases

00:41:23.550 --> 00:41:25.270
so that you don't have to repeat

00:41:25.270 --> 00:41:27.650
so watch

00:41:29.810 --> 00:41:30.650
can only

00:41:32.430 --> 00:41:33.890
show if this

00:41:34.610 --> 00:41:36.690
changes or just show

00:41:36.690 --> 00:41:40.210
it just yeah exactly it just repeats the command

00:41:40.210 --> 00:41:41.110
iteratively

00:41:42.890 --> 00:41:45.330
not like it's waiting for anything

00:41:45.890 --> 00:41:47.910
no no no

00:41:48.890 --> 00:41:51.230
simply it's a recurring

00:41:51.890 --> 00:41:54.910
demon just repeats the command over and over

00:41:54.910 --> 00:41:55.630
again

00:41:55.630 --> 00:41:56.750
and it doesn't

00:41:58.330 --> 00:42:00.470
it's not recording anything

00:42:03.590 --> 00:42:04.710
that's why we just

00:42:04.710 --> 00:42:07.670
did this one right ls minus l

00:42:07.670 --> 00:42:10.190
slash temp I just want to see

00:42:10.190 --> 00:42:13.410
what files are there I can then say hey I want to

00:42:13.410 --> 00:42:14.950
keep watching

00:42:21.910 --> 00:42:22.910
this folder

00:42:25.430 --> 00:42:27.110
it'll just keep watching that

00:42:27.110 --> 00:42:28.490
folder it just repeats the command

00:42:28.490 --> 00:42:32.910
as always there might be

00:42:33.650 --> 00:42:35.910
quite a few number of options

00:42:45.470 --> 00:42:47.110
this one's for you

00:42:55.530 --> 00:42:56.090
minus

00:42:56.090 --> 00:42:58.830
d for differences you can specify

00:42:58.830 --> 00:43:01.950
the interval you don't have to do it

00:43:01.950 --> 00:43:04.910
every two seconds

00:43:14.570 --> 00:43:16.790
okay so minus d might be interesting

00:43:16.790 --> 00:43:19.070
if we said watch

00:43:20.130 --> 00:43:21.430
the date

00:43:23.510 --> 00:43:24.950
nice right

00:43:26.170 --> 00:43:28.170
so that's nice it's a nice option

00:43:28.170 --> 00:43:32.570
I can just see the differences which are there

00:43:32.570 --> 00:43:33.310
very handy

00:43:37.110 --> 00:43:40.250
and I think all of this at the end

00:43:40.250 --> 00:43:43.230
kind of culminates into writing a script

00:43:44.370 --> 00:43:46.290
that can automate some of

00:43:46.290 --> 00:43:49.330
the work we're not getting into scripting here but the point

00:43:49.330 --> 00:43:52.510
of learning all of these different commands is at the end

00:43:52.510 --> 00:43:53.910
making your own recipe

00:43:55.290 --> 00:43:57.910
I log in I perform some routine tasks

00:43:57.910 --> 00:44:01.270
maybe a simple script can accelerate

00:44:01.270 --> 00:44:03.270
that workflow for me

00:44:03.270 --> 00:44:06.410
that's where that kind of comes in

00:44:06.410 --> 00:44:08.390
just putting it all together

00:44:09.310 --> 00:44:12.470
the life ends with a nice script

00:44:13.470 --> 00:44:15.970
just talking about

00:44:15.970 --> 00:44:17.290
creating scripts

00:44:18.470 --> 00:44:20.210
we can start by just creating

00:44:20.990 --> 00:44:23.190
a simple text file

00:44:23.190 --> 00:44:25.550
which contains some commands

00:44:33.470 --> 00:44:35.870
just creating a simple text file

00:44:36.950 --> 00:44:39.410
of course there's a whole syntax on it

00:44:39.410 --> 00:44:42.570
but let's do that I'm going to create a script

00:44:46.130 --> 00:44:47.990
I was going to do the

00:44:47.990 --> 00:44:51.670
vi escape dd then I realized this is not vi

00:45:13.410 --> 00:45:14.970
nothing very special

00:45:17.830 --> 00:45:21.390
just a bunch of commands right now

00:45:21.390 --> 00:45:23.570
I'll end with some special characters

00:45:23.570 --> 00:45:26.510
so we understand how these characters could be used

00:45:26.510 --> 00:45:29.570
alright here we go I save this

00:45:29.570 --> 00:45:32.610
so here I have

00:45:32.610 --> 00:45:34.010
my script

00:45:36.210 --> 00:45:38.710
how do I make this

00:45:38.710 --> 00:45:41.690
as a script how do I execute it

00:45:41.690 --> 00:45:44.050
right now it's just a text file

00:45:44.050 --> 00:45:47.710
if I just type this

00:45:56.810 --> 00:46:00.070
do I have to make it an executable file

00:46:00.070 --> 00:46:03.670
what if I just mention it's exact location

00:46:03.670 --> 00:46:05.770
I'll wait for Vinny

00:46:05.770 --> 00:46:08.630
I know you were just typing something in

00:46:13.050 --> 00:46:19.310
what happens if I do this

00:46:19.310 --> 00:46:21.010
like we did with the binaries

00:46:21.650 --> 00:46:27.070
slash user vin cp what if I just mention the exact path

00:46:29.930 --> 00:46:31.430
don't look at that because

00:46:31.430 --> 00:46:33.130
I need to create a new script

00:46:35.770 --> 00:46:38.530
that file is already done

00:46:38.530 --> 00:46:41.090
so let me just create a quick new script

00:46:43.410 --> 00:46:46.570
and it doesn't do anything special

00:46:53.770 --> 00:46:55.950
I am fine with it

00:46:59.170 --> 00:47:01.710
so let me mention the full path

00:47:23.490 --> 00:47:24.890
here

00:47:25.770 --> 00:47:28.790
let's mention the full location

00:47:28.790 --> 00:47:32.090
slash new

00:47:32.090 --> 00:47:33.930
slash new script

00:47:38.090 --> 00:47:41.130
doesn't like it

00:47:42.110 --> 00:47:45.330
it's saying as a file you are not

00:47:45.330 --> 00:47:47.250
executive permission is denied

00:47:47.770 --> 00:47:50.950
yeah Vinny give it a try just put the full path

00:47:50.950 --> 00:47:54.550
of the file you can see E2 is trying as well

00:47:54.550 --> 00:47:56.830
careful with the file path

00:47:56.830 --> 00:47:59.550
Vinny make sure that that location is correct

00:47:59.550 --> 00:48:03.510
slash home slash student slash new script

00:48:03.510 --> 00:48:06.850
just careful with what you are writing

00:48:12.030 --> 00:48:14.270
try again it should work

00:48:14.270 --> 00:48:16.490
it will work with an error

00:48:16.490 --> 00:48:20.550
like what you see in my case you are going to get this permission deny

00:48:20.550 --> 00:48:22.650
sorry can't execute

00:48:24.390 --> 00:48:25.790
what if

00:48:26.790 --> 00:48:28.770
I do it the other way

00:48:29.510 --> 00:48:33.010
I execute by running

00:48:33.010 --> 00:48:33.970
the shell

00:48:36.010 --> 00:48:37.470
and then I mention the path

00:48:39.010 --> 00:48:41.670
would this make any difference I am loading a new shell

00:48:41.670 --> 00:48:45.010
environment spawning a shell so to speak

00:48:45.970 --> 00:48:47.870
hello that works

00:48:47.870 --> 00:48:51.130
as you can see if I manually load a shell

00:48:51.130 --> 00:48:53.550
spawn the shell mention that file

00:48:53.550 --> 00:48:57.030
the shell executes and it runs that script

00:48:57.030 --> 00:49:00.150
the commands you mentioned probably are not

00:49:00.150 --> 00:49:03.090
there in the file just taking a closer look

00:49:03.090 --> 00:49:04.310
at

00:49:06.610 --> 00:49:08.710
okay Vinny just take

00:49:09.430 --> 00:49:11.830
a list first just do an

00:49:12.850 --> 00:49:14.870
ls minus l

00:49:14.870 --> 00:49:18.150
ls minus l in present let's just see everything we have got

00:49:19.890 --> 00:49:21.710
there is a my script

00:49:21.710 --> 00:49:24.250
new file and there is a new script

00:49:24.250 --> 00:49:25.570
new script

00:49:28.210 --> 00:49:28.950
so now

00:49:28.950 --> 00:49:31.290
one day it cannot find that file maybe you can

00:49:31.290 --> 00:49:34.150
rename it with mv new script

00:49:34.150 --> 00:49:36.410
use the tab I think it should auto complete

00:49:37.490 --> 00:49:39.890
is there a new script also

00:49:40.570 --> 00:49:43.270
it is a my script and then there is

00:49:43.270 --> 00:49:46.990
another file that is new script new script

00:49:49.710 --> 00:49:52.390
yeah just backspace

00:49:53.270 --> 00:49:55.390
put the full file name again please

00:49:58.110 --> 00:49:58.770
yes

00:49:58.770 --> 00:50:01.390
now just write new script alright

00:50:02.130 --> 00:50:04.390
that should do the trick

00:50:11.030 --> 00:50:12.190
thank you

00:50:14.730 --> 00:50:17.390
so as you can see in my case if I

00:50:17.950 --> 00:50:20.150
kind of spawn the shell it works

00:50:20.990 --> 00:50:23.470
but on its own it doesn't work like an

00:50:23.470 --> 00:50:27.090
executable let's take a look

00:50:27.090 --> 00:50:29.410
at this file

00:50:29.410 --> 00:50:31.290
that I have created

00:50:32.670 --> 00:50:35.090
and what we are going to do is use a very simple

00:50:35.930 --> 00:50:36.490
trick

00:50:41.030 --> 00:50:43.350
that many of us know

00:50:43.350 --> 00:50:46.430
chmod is the command used to manipulate file

00:50:46.430 --> 00:50:49.350
permissions I wonder what is happening there

00:50:49.350 --> 00:50:52.710
let me just take a closer look bash space

00:50:52.710 --> 00:50:55.310
I think inside that file

00:50:55.310 --> 00:50:58.210
you have written certain things can you edit that file

00:50:58.210 --> 00:51:01.430
again the new script file just do nano

00:51:01.430 --> 00:51:04.430
because in the script on the third line

00:51:04.430 --> 00:51:07.110
all you have written is the name of the script

00:51:07.110 --> 00:51:08.930
we need some commands here

00:51:10.150 --> 00:51:13.250
you can just delete everything here

00:51:15.330 --> 00:51:16.410
and then type

00:51:16.410 --> 00:51:19.490
some commands you can just do uname minus a or

00:51:19.490 --> 00:51:22.250
hostname or echo something

00:51:22.250 --> 00:51:24.650
yeah hostname

00:51:24.650 --> 00:51:26.330
for good measure

00:51:28.410 --> 00:51:29.790
alright that's it save your file

00:51:29.790 --> 00:51:33.930
we get it we get it a couple of commands are good

00:51:36.230 --> 00:51:38.530
let's save this file

00:51:38.530 --> 00:51:42.230
as it is run that again

00:51:42.230 --> 00:51:43.490
thank you

00:51:43.490 --> 00:51:47.830
so here I say chmod

00:51:47.830 --> 00:51:50.350
let's make this executable

00:51:50.350 --> 00:51:53.090
what changes in the permissions

00:51:57.630 --> 00:52:00.650
I get a little x

00:52:01.470 --> 00:52:03.490
in the permissions of the owner

00:52:04.050 --> 00:52:06.950
the group everybody else anyone and everyone

00:52:06.950 --> 00:52:09.490
should be able to execute it now

00:52:10.650 --> 00:52:12.730
one way of doing that either I

00:52:12.730 --> 00:52:15.110
mention the full path

00:52:17.730 --> 00:52:18.630
if you see

00:52:18.630 --> 00:52:20.450
last time that didn't work

00:52:22.070 --> 00:52:24.510
I have made it executable now

00:52:24.510 --> 00:52:27.150
it works now if I mention the full location

00:52:27.150 --> 00:52:31.070
or just like this because it's in the current location

00:52:32.530 --> 00:52:33.730
remember dot

00:52:34.710 --> 00:52:37.090
is your current directory

00:52:39.370 --> 00:52:41.330
lucky you're trying things

00:52:41.330 --> 00:52:42.530
already comfortable

00:52:55.910 --> 00:52:59.550
maybe these are things you're already used to at the moment

00:53:02.650 --> 00:53:03.330
let's see

00:53:03.330 --> 00:53:04.510
after dot give a space

00:53:04.510 --> 00:53:06.690
cases and cases very important

00:53:07.510 --> 00:53:09.550
how about you all well

00:53:09.550 --> 00:53:11.830
shut down already

00:53:11.830 --> 00:53:14.550
no no everything is fine

00:53:15.770 --> 00:53:19.490
I think if we run the top command it might show a different output

00:53:19.490 --> 00:53:21.430
if I run the

00:53:21.430 --> 00:53:26.570
I said if we ran the top command on you we might see a different

00:53:26.570 --> 00:53:26.710
command

00:53:30.430 --> 00:53:31.670
system utilization

00:53:31.670 --> 00:53:33.030
is very high

00:53:35.230 --> 00:53:38.150
I want to tell you a story about the top command

00:53:39.210 --> 00:53:40.630
this is like

00:53:40.630 --> 00:53:43.110
maybe 15 years ago this was for one of the clients

00:53:43.830 --> 00:53:47.130
we were looking at the total CP utilization

00:53:47.130 --> 00:53:48.330
was very high

00:53:49.670 --> 00:53:52.610
80 percent 90 percent but when we

00:53:52.610 --> 00:53:55.530
looked at individual applications and we

00:53:55.530 --> 00:53:59.150
added it together it was just 10 15 percent

00:54:00.790 --> 00:54:03.230
so this output here

00:54:03.230 --> 00:54:05.950
of individual process

00:54:05.950 --> 00:54:08.970
CP utilization did not add up

00:54:08.970 --> 00:54:11.410
to the total utilization that we were seeing

00:54:12.150 --> 00:54:15.050
and we were just scratching our head

00:54:15.050 --> 00:54:17.510
saying what's going on

00:54:18.150 --> 00:54:20.810
the system utilization is definitely high

00:54:20.810 --> 00:54:23.650
but we can't see any process

00:54:23.650 --> 00:54:25.990
which is using that

00:54:25.990 --> 00:54:28.950
and after a bit of low level

00:54:28.950 --> 00:54:30.810
message kernel debugging

00:54:30.810 --> 00:54:35.170
what we realized was that one command

00:54:35.170 --> 00:54:38.090
was creating or one process

00:54:38.090 --> 00:54:40.510
was creating other processes

00:54:40.510 --> 00:54:44.270
thousands of processes every second

00:54:44.270 --> 00:54:46.870
and all these processes

00:54:46.870 --> 00:54:48.890
were instantly dying

00:54:50.030 --> 00:54:53.150
so the system was creating processes

00:54:53.150 --> 00:54:55.910
and killing them so fast that they were not even

00:54:55.910 --> 00:54:58.770
showing up in the output on top

00:55:01.110 --> 00:55:02.210
so we didn't

00:55:02.210 --> 00:55:04.750
see those thousand processes here

00:55:04.750 --> 00:55:07.290
but it was adding up to the total

00:55:10.370 --> 00:55:13.590
it was a brilliant low level debugging

00:55:14.230 --> 00:55:16.890
of an exercise where the client says

00:55:16.890 --> 00:55:19.330
something weird is going on in my machine

00:55:20.090 --> 00:55:22.110
something is eating the utilization

00:55:22.110 --> 00:55:23.910
I just don't know what

00:55:25.450 --> 00:55:28.610
and of course here if you press

00:55:28.610 --> 00:55:31.390
H in the top command there are plenty of

00:55:31.390 --> 00:55:32.950
things you can see and do

00:55:34.070 --> 00:55:35.390
it's a brilliant command

00:55:42.050 --> 00:55:43.390
that's a little bit about

00:55:43.390 --> 00:55:46.330
the final piece which is you know just kind of

00:55:46.330 --> 00:55:48.070
putting it all together

00:55:49.130 --> 00:55:52.130
and creating potentially certain scripts

00:55:52.130 --> 00:55:54.750
I think that's the natural

00:55:55.330 --> 00:55:57.750
I would say destination I do not have many commands

00:55:58.690 --> 00:56:01.610
it kind of does what you do

00:56:01.610 --> 00:56:04.270
alright quick one any questions

00:56:04.270 --> 00:56:05.450
from anyone

00:56:09.270 --> 00:56:10.590
there's a lot

00:56:10.590 --> 00:56:11.810
we have seen

00:56:13.490 --> 00:56:15.230
so far so good

00:56:15.810 --> 00:56:18.750
so this is a very good session

00:56:18.750 --> 00:56:21.490
any unresolved queries or questions

00:56:21.490 --> 00:56:23.330
curiosities things

00:56:24.110 --> 00:56:27.710
that this session might have made you think ah I wonder how

00:56:27.710 --> 00:56:30.650
that works or I wonder how to do something

00:56:30.650 --> 00:56:33.810
it's just only one thing for me

00:56:34.350 --> 00:56:35.210
to search

00:56:37.050 --> 00:56:37.690
yeah

00:56:37.690 --> 00:56:38.810
yeah

00:56:41.490 --> 00:56:43.890
so if you are talking about finding

00:56:43.890 --> 00:56:46.870
a file in the file system we are typically

00:56:46.870 --> 00:56:49.630
looking at the command find has two core

00:56:49.630 --> 00:56:52.970
arguments one is where to start looking

00:56:52.970 --> 00:56:55.730
from and what to look for

00:56:56.810 --> 00:56:58.910
if you don't know where to start from

00:56:58.910 --> 00:57:01.970
you can always start from the root but do keep in mind

00:57:01.970 --> 00:57:04.890
it can slow things down a little bit specially

00:57:04.890 --> 00:57:07.270
on systems which have a large file system

00:57:07.890 --> 00:57:10.870
if you kind of know where it might be

00:57:10.870 --> 00:57:13.970
it's always a good idea to

00:57:13.970 --> 00:57:16.090
filter limit and scope

00:57:16.810 --> 00:57:19.730
and say hey I'm looking for files

00:57:19.730 --> 00:57:22.910
starting from where it's a good start

00:57:23.610 --> 00:57:24.650
now comes

00:57:24.650 --> 00:57:27.250
sorry go ahead Akrana

00:57:27.250 --> 00:57:30.490
the type as well there's a type option

00:57:30.490 --> 00:57:33.010
no so now after this

00:57:33.010 --> 00:57:35.570
comes what do you know about that file

00:57:35.570 --> 00:57:38.830
so the first is start looking from where

00:57:39.490 --> 00:57:42.210
and the second is one or more attributes

00:57:42.210 --> 00:57:44.830
is it a file is it a folder

00:57:45.650 --> 00:57:48.370
do you know the name part of the name

00:57:48.370 --> 00:57:51.150
do you know when it was last modified

00:57:51.150 --> 00:57:54.370
last accessed all of those parameters

00:57:55.010 --> 00:57:57.790
I can start with the simplest of the things

00:57:57.790 --> 00:57:59.950
I think I know

00:58:00.790 --> 00:58:03.830
that somewhere in the name is

00:58:03.830 --> 00:58:04.410
conf

00:58:11.330 --> 00:58:13.790
and then it kind of punches out

00:58:15.050 --> 00:58:16.850
everything there

00:58:20.090 --> 00:58:22.330
ok these are all the files

00:58:22.330 --> 00:58:25.470
I have found so in this case

00:58:25.470 --> 00:58:29.010
dash name is literally the name

00:58:29.010 --> 00:58:31.350
if you look at the main page

00:58:31.350 --> 00:58:34.470
the manual page for this command

00:58:37.490 --> 00:58:40.470
you might see that it supports many expressions

00:58:47.090 --> 00:58:49.330
and you will see some examples

00:58:49.330 --> 00:58:52.670
here of the expressions

00:59:00.350 --> 00:59:01.430
some of these are

00:59:01.430 --> 00:59:03.970
really quite long

00:59:03.970 --> 00:59:05.590
but let's try out what we can see

00:59:15.230 --> 00:59:17.270
you almost feel like you're reading a book

00:59:17.270 --> 00:59:19.350
isn't it

00:59:22.090 --> 00:59:24.330
I understand that's why we end up

00:59:24.330 --> 00:59:26.250
googling for it

00:59:26.890 --> 00:59:30.170
because it might be a bit faster

00:59:31.810 --> 00:59:33.330
but obviously this is the

00:59:33.330 --> 00:59:34.970
full system help

00:59:37.470 --> 00:59:38.870
and you're like never mind

00:59:38.870 --> 00:59:41.950
I don't need to find it

00:59:41.950 --> 00:59:45.250
is this the manual for the find command

00:59:46.930 --> 00:59:47.490
yes

00:59:51.330 --> 00:59:52.450
oh ok

00:59:56.030 --> 00:59:56.870
so

00:59:56.870 --> 01:00:00.590
last modified less than

01:00:02.910 --> 01:00:05.190
what we saw right now was

01:00:05.190 --> 01:00:07.070
dash name

01:00:09.190 --> 01:00:10.810
that's a better

01:00:12.170 --> 01:00:14.690
but I can use many of these

01:00:14.690 --> 01:00:17.810
combinations it's in which paths

01:00:17.810 --> 01:00:20.170
what are its permissions

01:00:20.170 --> 01:00:23.250
so classic example is we will look for file

01:00:23.250 --> 01:00:25.810
especially if you're doing system hardening

01:00:25.810 --> 01:00:27.650
or we are auditing a system

01:00:27.650 --> 01:00:31.310
we will look for files with certain kind of permissions

01:00:31.310 --> 01:00:35.090
in the wrong place that could indicate as a compromise of a system

01:00:35.090 --> 01:00:38.590
but you might have your own reasons why you're looking for files

01:00:43.650 --> 01:00:45.250
and this is very useful

01:00:45.250 --> 01:00:48.570
for example what if I'm only looking for directories

01:00:48.570 --> 01:00:51.570
this is very handy I'm only looking for directories

01:00:56.070 --> 01:00:58.550
this is also nice all the files

01:00:58.550 --> 01:01:01.050
owned by a specific user

01:01:02.290 --> 01:01:04.430
the last time the file was used

01:01:04.430 --> 01:01:07.870
good if you're trying to do a backup or an archive

01:01:07.870 --> 01:01:10.570
Econa likes this one

01:01:12.590 --> 01:01:13.950
very small

01:01:17.110 --> 01:01:19.270
oh by the way you can do

01:01:19.270 --> 01:01:21.770
a lot more with the find command

01:01:22.670 --> 01:01:25.250
every file which is found you can

01:01:25.250 --> 01:01:28.150
execute something on it

01:01:28.950 --> 01:01:31.650
what if I say find all the files

01:01:31.650 --> 01:01:34.390
owned by this user not

01:01:34.390 --> 01:01:36.630
accessed in last 30 days

01:01:36.630 --> 01:01:39.630
and move them to an archive location

01:01:40.590 --> 01:01:42.850
so find normally doesn't take an action

01:01:42.850 --> 01:01:44.850
but be careful with this one

01:01:44.850 --> 01:01:48.010
but you can not just see the files

01:01:48.010 --> 01:01:51.990
you can directly take action on them

01:01:51.990 --> 01:01:54.570
maybe I can remove certain files which are less than

01:01:54.570 --> 01:01:57.710
certain size last accessed more than

01:01:57.710 --> 01:02:00.590
five years ago owned by a certain user

01:02:00.590 --> 01:02:03.310
I can just do this dash execute

01:02:03.310 --> 01:02:06.370
put the command and the parenthesis kind of acts

01:02:06.370 --> 01:02:09.310
like a placeholder every file

01:02:09.310 --> 01:02:11.730
which is found it's like a loop

01:02:16.170 --> 01:02:19.670
so there are other ways to expand on it

01:02:20.450 --> 01:02:21.930
that means you

01:02:21.930 --> 01:02:24.030
and if you don't want it to execute

01:02:24.030 --> 01:02:26.710
without asking you you can say dash ok

01:02:26.710 --> 01:02:28.650
ask me one by one

01:02:29.890 --> 01:02:32.830
if you trust your command close your eye

01:02:32.830 --> 01:02:35.170
no need for dash ok go

01:02:35.170 --> 01:02:38.650
you find thousand files that match this

01:02:39.830 --> 01:02:42.130
fine execute something on them

01:02:42.130 --> 01:02:44.330
copy them move them remove them whatever

01:02:44.330 --> 01:02:47.790
please be careful with these the potential for messing things up

01:02:47.790 --> 01:02:48.570
is high

01:02:50.850 --> 01:02:53.670
but the wonderful things you discover if you read

01:02:53.670 --> 01:02:56.650
the man page

01:02:57.630 --> 01:02:59.850
big man page right

01:02:59.850 --> 01:03:00.910
it's just one

01:03:06.190 --> 01:03:07.030
book

01:03:17.850 --> 01:03:20.650
hopefully that answers the query

01:03:26.650 --> 01:03:29.990
around the find and how to find what you're looking for

01:03:29.990 --> 01:03:32.630
so look for those expressions a time

01:03:32.630 --> 01:03:35.530
m time dash user

01:03:35.530 --> 01:03:38.650
all of that should do it

01:03:39.850 --> 01:03:41.910
any other question from anyone

01:03:44.710 --> 01:03:45.390
else

01:03:47.870 --> 01:03:50.530
how to get something specific done

01:03:50.530 --> 01:03:51.750
or any curiosity

01:03:53.170 --> 01:03:54.870
yes there's another

01:03:54.870 --> 01:03:57.890
I don't know if I'm mistaken

01:03:57.890 --> 01:03:59.930
there's a command called locate

01:04:00.750 --> 01:04:02.990
does it work

01:04:02.990 --> 01:04:06.750
same as

01:04:08.730 --> 01:04:09.390
find

01:04:10.290 --> 01:04:13.490
depends on the distribution that you're working on

01:04:13.490 --> 01:04:14.930
as well

01:04:15.750 --> 01:04:18.990
so I think not every distribution

01:04:18.990 --> 01:04:20.850
will have locate

01:04:21.870 --> 01:04:24.310
let me just check

01:04:24.990 --> 01:04:27.390
right now

01:04:29.390 --> 01:04:31.610
because the idea is that we might

01:04:31.610 --> 01:04:35.170
things might be a little bit faster if there is like an index

01:04:35.170 --> 01:04:36.970
of sort

01:04:38.230 --> 01:04:40.570
let me just check which distributions

01:04:41.310 --> 01:04:42.030
supported

01:04:44.190 --> 01:04:46.610
because it may not be

01:04:46.610 --> 01:04:47.870
for

01:04:49.270 --> 01:04:51.990
every distro as well

01:04:55.210 --> 01:04:55.930
as

01:04:55.930 --> 01:04:58.590
you can see here as well

01:04:58.590 --> 01:05:01.150
it's not built in as a package

01:05:02.670 --> 01:05:05.010
you'll have to install that

01:05:05.010 --> 01:05:07.530
tool again if you don't have administrative

01:05:07.530 --> 01:05:10.910
rights you may struggle to do that

01:05:10.910 --> 01:05:13.330
but if I'm not wrong

01:05:14.130 --> 01:05:16.310
I believe it's something that creates

01:05:16.310 --> 01:05:17.230
kind of an index

01:05:18.170 --> 01:05:21.750
so it runs in the background like every

01:05:22.330 --> 01:05:24.390
day I think once 24 hours

01:05:24.390 --> 01:05:28.030
and then it kind of builds an index so that is a lot faster

01:05:28.030 --> 01:05:31.090
find command is literally going through

01:05:31.090 --> 01:05:33.310
the entire file system tree

01:05:34.110 --> 01:05:37.030
so in large file systems you could be sitting there

01:05:37.030 --> 01:05:40.470
for a very long time and other tools like locate

01:05:40.470 --> 01:05:43.730
and what they do is they kind of offload this a little bit

01:05:43.730 --> 01:05:46.530
by automatically building indexes like indexing

01:05:46.530 --> 01:05:47.410
service in Windows

01:05:48.630 --> 01:05:52.170
making it a lot faster because it maintains a database

01:05:52.170 --> 01:05:53.870
of what's where with the metadata

01:05:56.590 --> 01:05:58.610
yeah so that's the reason we don't see

01:05:58.610 --> 01:06:01.290
it here it might be there on the systems that we're working on

01:06:01.290 --> 01:06:02.930
so find is literally

01:06:02.930 --> 01:06:06.270
sifting through the file system

01:06:06.270 --> 01:06:09.330
locate builds an index

01:06:09.330 --> 01:06:12.530
there are similar packages across

01:06:12.530 --> 01:06:14.510
different distributions hopefully that helps

01:06:15.270 --> 01:06:18.110
there is also something

01:06:18.110 --> 01:06:21.510
I just saw it somewhere called inodes

01:06:21.510 --> 01:06:24.610
we saw when we did the

01:06:24.610 --> 01:06:26.130
hard links

01:06:28.370 --> 01:06:30.270
inodes I think it's inodes

01:06:31.070 --> 01:06:32.610
and you

01:06:34.830 --> 01:06:36.030
here here

01:06:36.610 --> 01:06:39.190
this is the inode number the door

01:06:39.190 --> 01:06:41.050
and the room

01:06:42.130 --> 01:06:42.730
oh

01:06:44.350 --> 01:06:46.790
inode is the room number

01:06:46.790 --> 01:06:51.250
all of this sounds like mumbo jumbo right when the context is not

01:06:51.250 --> 01:06:52.070
very clear

01:06:53.150 --> 01:06:56.210
and now you're like ah so that's what it is

01:06:56.210 --> 01:06:59.010
it's just the identifier of the actual resource

01:06:59.010 --> 01:07:01.950
so what did you see when I create that link with the red file

01:07:01.950 --> 01:07:04.810
and the blue file and the pink file that they were all pointing

01:07:04.810 --> 01:07:07.630
to the same inode

01:07:07.630 --> 01:07:10.690
yes yes yes pointing to the same resource

01:07:12.330 --> 01:07:13.290
anything else

01:07:14.130 --> 01:07:15.870
any questions from anyone else?

01:07:17.470 --> 01:07:18.150
E2 winning

01:07:18.870 --> 01:07:19.430
corner

01:07:29.850 --> 01:07:32.250
E2 that I am good really sounded

01:07:32.250 --> 01:07:35.150
like the system shutting down

01:07:41.450 --> 01:07:44.450
I like the analogy of network people

01:07:44.450 --> 01:07:46.330
saying it sounds like a dial-up connection

01:07:48.750 --> 01:07:50.650
I remember back in the day

01:07:50.650 --> 01:07:53.390
when we were hooking up to service provider networks

01:07:53.390 --> 01:07:55.790
through slip before PPP

01:07:56.450 --> 01:07:59.070
you had to type in your own IP address

01:07:59.070 --> 01:08:00.970
once you dialed in

01:08:02.610 --> 01:08:05.670
you dial into the ISP and the ISP is like

01:08:05.670 --> 01:08:07.030
so what's your IP address

01:08:08.410 --> 01:08:11.590
so this is before PPP and

01:08:11.590 --> 01:08:15.170
I remember like wow the IP comes from the provider

01:08:15.170 --> 01:08:16.170
that's amazing

01:08:17.470 --> 01:08:20.710
hey I've connected quick give me the IP address

01:08:20.710 --> 01:08:21.810
that we have

01:08:24.230 --> 01:08:26.650
alright that pretty much is the end

01:08:26.650 --> 01:08:29.690
as I said small document with some of these

01:08:29.690 --> 01:08:32.630
and the deck I'll just make sure it has that on the

01:08:32.630 --> 01:08:35.590
cloud storage you can always have that

01:08:36.130 --> 01:08:38.610
as a reference hopefully now

01:08:38.610 --> 01:08:40.410
again with the mission that we had

01:08:40.410 --> 01:08:43.690
to get more comfortable with the command line

01:08:44.390 --> 01:08:46.190
hopefully we have made progress there

01:08:46.190 --> 01:08:48.030
E2 go ahead please

01:08:48.030 --> 01:08:51.090
how do you use the

01:08:51.090 --> 01:08:51.350
the no

01:08:54.390 --> 01:08:56.830
the idea is that if you are running

01:08:56.830 --> 01:09:00.670
so when you say no hang up typically the idea is

01:09:00.670 --> 01:09:04.530
if you are remotely hooked up to a system

01:09:04.530 --> 01:09:06.850
telnet SSH whatever

01:09:07.530 --> 01:09:10.370
we don't want the process to die

01:09:10.370 --> 01:09:12.790
if the shell dies

01:09:13.530 --> 01:09:16.670
and that kind of makes sense if I log out then my login

01:09:16.670 --> 01:09:19.790
shell is gone and the process

01:09:19.790 --> 01:09:22.230
that I have started is often

01:09:23.430 --> 01:09:25.830
typically you kind of do this

01:09:25.830 --> 01:09:28.010
at the end of command

01:09:31.550 --> 01:09:32.890
what that

01:09:32.890 --> 01:09:35.330
literally does is it changes the

01:09:35.330 --> 01:09:38.090
parent process of that process

01:09:38.090 --> 01:09:41.010
and the parent of that process

01:09:41.010 --> 01:09:44.190
is like maybe the inet demon basically like the core

01:09:44.190 --> 01:09:47.010
of the system so now it no longer matters

01:09:47.530 --> 01:09:50.270
if this shell that I am in dies

01:09:50.270 --> 01:09:53.210
who cares my child

01:09:53.210 --> 01:09:55.070
process will survive

01:09:56.270 --> 01:09:58.030
so typically you do this

01:09:58.030 --> 01:10:00.310
if you are doing patching or some other work

01:10:01.290 --> 01:10:04.350
I remember setting in front

01:10:04.350 --> 01:10:08.130
of a system for 6 hours

01:10:08.130 --> 01:10:10.210
making sure the terminal doesn't

01:10:10.210 --> 01:10:13.070
close till somebody showed me that

01:10:16.290 --> 01:10:19.510
but GP now there is the screen command

01:10:20.470 --> 01:10:22.210
yeah there are again

01:10:22.210 --> 01:10:25.690
see as you go from the

01:10:25.690 --> 01:10:28.130
archaic historic Unix environment

01:10:28.130 --> 01:10:30.950
the more you go towards the Linux

01:10:30.950 --> 01:10:34.930
what has fundamentally changed is all of this

01:10:34.930 --> 01:10:37.550
and now for the last

01:10:37.550 --> 01:10:40.030
10 years Unix is borrowing from Linux

01:10:40.030 --> 01:10:42.910
they are saying you know what people want these capabilities

01:10:42.910 --> 01:10:46.030
and they want these features and then

01:10:46.030 --> 01:10:49.250
some Unix if not all they have started to adopt

01:10:49.250 --> 01:10:52.210
look the fact is in the enterprise world Unix

01:10:52.210 --> 01:10:53.610
adoption is done

01:10:53.610 --> 01:10:58.590
so I noticed in your list when we started you didn't have

01:10:58.590 --> 01:10:59.990
sent us

01:11:00.850 --> 01:11:04.530
no no it's just I mean we can't list every distro

01:11:04.530 --> 01:11:06.550
out there there are thousands of them now

01:11:07.250 --> 01:11:10.270
I think new ones pop up every day and then everybody

01:11:10.270 --> 01:11:14.690
everyone has their own favorite ones and they swear by it

01:11:14.690 --> 01:11:16.050
so I have

01:11:16.050 --> 01:11:17.790
personally worked

01:11:19.090 --> 01:11:22.170
I'm not going to say on all but everything which is on

01:11:22.170 --> 01:11:25.190
the enterprise side I've worked on

01:11:25.190 --> 01:11:28.050
your Suses your Red Hat and everything else

01:11:29.250 --> 01:11:31.050
HP UX your Solaris

01:11:31.570 --> 01:11:34.050
Co all different systems

01:11:34.870 --> 01:11:37.430
in the Linux world yes new distros come up all the time

01:11:37.430 --> 01:11:40.350
you pick the one that works for you and

01:11:40.350 --> 01:11:42.910
frankly it's more of an enterprise decision

01:11:43.810 --> 01:11:44.530
yeah

01:11:44.530 --> 01:11:48.710
and then the reality is comfort

01:11:48.710 --> 01:11:51.990
of sysadmins is the last consideration

01:11:51.990 --> 01:11:54.690
if ever in choosing a platform

01:11:54.690 --> 01:11:57.530
it's the overall productivity stability

01:11:57.530 --> 01:12:00.890
how it matches the ecosystem that you currently have

01:12:00.890 --> 01:12:03.790
and in the long run what the direction

01:12:03.790 --> 01:12:06.630
your infrastructure was the long term goals of the enterprise

01:12:06.630 --> 01:12:09.910
kind of goes in there so

01:12:09.910 --> 01:12:12.710
no right no wrong it's what works

01:12:12.710 --> 01:12:14.230
obviously

01:12:15.850 --> 01:12:18.690
everyone has their own favorite I like this one

01:12:20.610 --> 01:12:22.210
so that's your

01:12:22.210 --> 01:12:24.130
no hang up

01:12:24.910 --> 01:12:26.910
anything else from anyone

01:12:26.910 --> 01:12:28.670
questions doubts thoughts

01:12:30.750 --> 01:12:32.030
you're welcome

01:12:32.030 --> 01:12:35.570
anything else from anyone before we wind up

01:12:35.570 --> 01:12:37.490
no no all good on my side

01:12:38.230 --> 01:12:41.770
I appreciate that ito thanks guys thanks for being

01:12:41.770 --> 01:12:44.870
here spending a day with me on

01:12:44.870 --> 01:12:47.750
Linux fundamentals hopefully you were a bit

01:12:47.750 --> 01:12:50.710
more comfortable on the

01:12:50.710 --> 01:12:53.630
terminal the next time you are there and

01:12:53.630 --> 01:12:56.570
more adventurous as well trying new things out

01:12:59.210 --> 01:13:00.370
thank you

01:13:04.390 --> 01:13:05.550
thank you

01:13:14.510 --> 01:13:15.150
yeah

01:13:15.150 --> 01:13:15.230
yeah

01:13:15.230 --> 01:13:15.490
it's

01:13:15.490 --> 01:13:17.450
yeah it's fun it's pretty close

01:13:17.450 --> 01:13:20.130
thank you very much

01:13:23.350 --> 01:13:23.990
yeah

01:13:23.990 --> 01:13:24.790
yeah

01:13:27.030 --> 01:13:29.270
alright see you guys take care

01:13:29.270 --> 01:13:30.210
okay

01:13:30.210 --> 01:13:30.590
yeah

01:13:30.590 --> 01:13:31.230
yeah

01:13:34.310 --> 01:13:35.670
yeah

01:13:43.670 --> 01:13:45.030
yeah

01:13:45.030 --> 01:13:45.210
yeah

01:13:46.610 --> 01:13:47.470
yeah

01:13:47.470 --> 01:13:52.430
I don't want to have a conversation

01:13:52.430 --> 01:13:53.590
a conversation

01:13:54.210 --> 01:13:55.890
with the people

01:13:55.890 --> 01:13:58.890
Runaway, Runaway, Runaway

01:14:03.630 --> 01:14:04.610
Brother

01:14:09.030 --> 01:14:10.010
Hello

01:14:10.890 --> 01:14:11.890
My brother

01:14:12.410 --> 01:14:13.950
What happened?

01:14:14.330 --> 01:14:15.690
My brother had some problem

01:14:15.690 --> 01:14:17.490
Who was he talking to?

01:14:17.690 --> 01:14:19.190
Who was he talking to?

01:14:19.630 --> 01:14:20.670
Haseed brother

01:14:20.670 --> 01:14:21.470
Where is my brother?

01:14:21.470 --> 01:14:24.310
There is a certain credit card

01:14:25.730 --> 01:14:28.170
Number of people wasting time

01:14:28.170 --> 01:14:29.470
It's just crazy on the phone

01:14:30.110 --> 01:14:31.590
Thank God I don't have WhatsApp

01:14:31.590 --> 01:14:33.730
Imagine the number of people who get your number

01:14:40.290 --> 01:14:43.470
What are you wearing in this skirt?

01:14:51.470 --> 01:14:53.470
And what's this?

01:14:59.070 --> 01:15:05.910
He might be out there in the marriage

01:15:07.310 --> 01:15:09.150
Haseed brother, it's 7pm

01:15:09.150 --> 01:15:10.010
He is wasting time

01:15:10.910 --> 01:15:12.970
He will not answer the phone

01:15:12.970 --> 01:15:14.170
He will not come

01:15:15.910 --> 01:15:18.230
I am searching for something for tomorrow

01:15:18.230 --> 01:15:20.050
I am not interested

01:15:22.270 --> 01:15:24.170
I am not interested

01:15:24.170 --> 01:15:26.250
I am not interested

01:15:26.250 --> 01:15:26.550
I am having a problem

01:15:26.550 --> 01:15:28.750
I am not interested

01:15:28.750 --> 01:15:29.910
Please

01:15:30.630 --> 01:15:31.910
Get up

01:15:32.490 --> 01:15:34.410
You haven't showered go

01:15:34.410 --> 01:15:36.170
I don't like to shower

01:15:36.170 --> 01:15:37.870
I don't know how I am going to get up

01:15:37.870 --> 01:15:39.590
I just want you to shower

01:15:39.590 --> 01:15:40.770
Don't even talk

01:15:46.690 --> 01:15:49.490
You have to say hello to our neighbor