WEBVTT

00:00.990 --> 00:06.430
So pipes are essential part of the Linux enterprise.

00:06.450 --> 00:11.640
So here, let's dive into building your piping skills with a small set of Linux commands.

00:11.640 --> 00:16.050
So no matter which one you encounter later, you will need to combine them.

00:16.050 --> 00:20.280
So we will learn here the let's actually draw this.

00:20.280 --> 00:21.660
So I will draw this here.

00:21.660 --> 00:26.430
So you will learn about firstly the w oops here.

00:26.430 --> 00:27.000
Yeah.

00:27.090 --> 00:31.020
W c you will learn heat.

00:35.430 --> 00:36.690
You will learn Heath here.

00:36.690 --> 00:38.850
So you will also learn Cut.

00:40.590 --> 00:42.780
You will learn about the grip.

00:44.010 --> 00:44.700
Grab.

00:47.100 --> 00:49.260
You will learn Sword.

00:49.260 --> 00:50.910
And here.

00:50.910 --> 00:51.900
Sword.

00:53.160 --> 00:55.980
One, two, three, four, five.

00:55.980 --> 00:57.690
And unique.

01:02.960 --> 01:05.810
And also, yeah, it's six here.

01:05.970 --> 01:08.410
Yeah, also here.

01:08.420 --> 01:09.680
So let's get started.

01:09.950 --> 01:10.730
So.

01:11.670 --> 01:20.190
These comments have numerous options and modes of operations that will I largely skip for now.

01:20.250 --> 01:22.320
Just now to focus on pipes.

01:22.320 --> 01:33.000
So to learn more about any command random man command, here is why It's like, yeah, run the man command.

01:33.270 --> 01:33.660
Oops.

01:33.660 --> 01:34.140
Yeah.

01:34.230 --> 01:36.690
Run the man command like this.

01:37.920 --> 01:46.560
And for example, if I wanted to get get an information about the LHS, then the man command will give

01:46.560 --> 01:53.490
me a detailed description, the name, synopsis, description and all of the information that I need

01:53.520 --> 01:54.120
here.

01:54.150 --> 02:00.210
Actually, we did learn this in previous lectures, but I just wanted to mention it again.

02:00.210 --> 02:01.500
So here.

02:02.630 --> 02:06.200
Let's get started with the WC command.

02:06.410 --> 02:06.950
It's actually.

02:06.970 --> 02:07.360
Yeah.

02:07.820 --> 02:08.290
Here.

02:08.300 --> 02:08.960
Clear.

02:08.990 --> 02:09.900
WC command.

02:09.920 --> 02:16.570
So the WC command prints the number of lines, words and characters in a file.

02:16.580 --> 02:23.180
So let's actually use the for the for now, let's use the user interface for creating files.

02:23.180 --> 02:29.330
But in next lectures you will also learn how to create, delete and manipulate files from the command

02:29.330 --> 02:29.930
line.

02:29.930 --> 02:38.240
So here, let's create a right click on it, Create document, empty file, and let's name this file

02:38.780 --> 02:39.200
here.

02:39.200 --> 02:39.650
Oxley.

02:40.160 --> 02:41.090
Oxley.

02:41.120 --> 02:42.080
Create.

02:42.080 --> 02:43.430
And here.

02:44.560 --> 02:45.400
Delete this.

02:45.400 --> 02:47.170
Don't save here.

02:48.670 --> 02:52.240
Let's increase the font size a little bit and write something here.

02:52.240 --> 02:52.690
So.

02:52.720 --> 02:53.560
Oxley.

02:53.590 --> 02:55.000
Oxley Academy.

02:55.030 --> 02:57.880
Typhoon Online.

02:57.880 --> 02:59.950
Linux Course.

03:01.200 --> 03:01.980
A YouTube.

03:02.320 --> 03:03.450
YouTube.

03:03.780 --> 03:07.440
We are on YouTube here.

03:07.980 --> 03:08.900
Oxley.

03:09.090 --> 03:09.930
And here.

03:09.930 --> 03:19.350
This is our text for now and we will use WC animals to print the number of lines, words and characters

03:19.350 --> 03:19.910
in a file.

03:19.920 --> 03:20.760
So.

03:21.830 --> 03:23.690
It's going to be like Oxley.

03:24.020 --> 03:32.240
OXLEY And here, as you can see here, we have five lines here and 83 characters.

03:32.240 --> 03:36.590
And we also have five words in this file lines here.

03:36.590 --> 03:39.110
So let's open what we have as a word.

03:39.110 --> 03:42.980
As you can see here, these all of them, it counts as a word here.

03:42.980 --> 03:47.210
So let's add something with a space here and run this command.

03:47.210 --> 03:54.920
Again, as you can see here, we got 96 characters, six lines, six words and five lines here.

03:54.920 --> 04:03.710
So WC reports that our Oxley has five lines, six words, 96 characters.

04:03.710 --> 04:13.400
So if you count the characters by eye, including here spaces, types and new lines, you will find

04:13.430 --> 04:15.110
96 characters.

04:15.110 --> 04:15.500
So.

04:15.500 --> 04:22.260
But WC also includes the invisible New Line character that ends each line.

04:22.260 --> 04:33.630
So the option here wc here, for example, wc l, w and C instructs wc to print only the number of lines,

04:33.630 --> 04:37.470
words and characters respectively here if I wanted to.

04:37.500 --> 04:44.850
For example, l wc l Oxley and here, as you can see here, we have file five here.

04:44.850 --> 04:45.480
So.

04:45.780 --> 04:47.640
So we printed the lines here.

04:47.640 --> 05:00.330
So if we write it like this wc c as a parameter or Yeah w as a parameter, we will print the words here

05:00.720 --> 05:02.400
and wc.

05:04.360 --> 05:05.920
C as a parameter.

05:05.920 --> 05:08.470
We will print the characters as a c.

05:08.620 --> 05:13.270
For characters W for words and L for lines.

05:13.270 --> 05:22.600
So containing is such a useful general purpose task that the authors of WC designed the command to work

05:22.600 --> 05:23.320
with pipes.

05:23.320 --> 05:26.170
So it reads from the stdin.

05:26.200 --> 05:35.320
If you omit the file name and it writes to the stdout so let's use the less and less contents of the

05:35.320 --> 05:39.130
current directory and pipe them to wc to count lines.

05:39.130 --> 05:45.370
So the pipeline answers the question how many lines are visible in my current directory here?

05:45.370 --> 05:49.630
And for example, ls l here or LZ one?

05:49.630 --> 05:53.890
And as you can see, we have these files and folders in our directory.

05:53.890 --> 06:05.180
So if you write like that here, so LZ one and LZ one and we are using Pipeline WC one or L here, we

06:05.180 --> 06:06.320
will get ten.

06:06.320 --> 06:08.090
So let's count here.

06:08.120 --> 06:15.020
One, two, three, four, five, six, seven, eight, ten, 11.

06:15.590 --> 06:19.490
One, two, three, four, five, six, seven, ten, 11.

06:19.520 --> 06:20.060
Oops.

06:20.210 --> 06:25.130
One, two, three, four, five, six, seven, ten, 11, 12.

06:25.130 --> 06:27.620
So we have 12 files here.

06:28.130 --> 06:29.840
12 lines here.

06:30.630 --> 06:31.890
As you can see here.

06:31.890 --> 06:33.360
Let's delete all of them.

06:34.840 --> 06:39.450
So that's because we have, uh, the LZ.

06:39.460 --> 06:42.130
We counted the L with LZ one.

06:42.130 --> 06:45.010
We counted all of these folders here.

06:45.250 --> 06:46.510
That's clear here.

06:46.600 --> 06:47.950
So now.

06:50.550 --> 06:52.890
Now let's actually write something.

06:56.020 --> 06:58.230
So let's see.

06:58.270 --> 06:59.740
WC is the first command.

06:59.770 --> 07:04.990
You have seen in this lecture, so you are a bit limited in what you can do with pipes.

07:04.990 --> 07:09.610
So just for fun, the pipe, the output of WC itself.

07:09.610 --> 07:14.530
So demonstrating that the same command can appear more than once in a pipeline.

07:14.530 --> 07:20.740
So this combines command reports that a number of words in the output of VC is a four.

07:20.740 --> 07:21.310
So.

07:22.700 --> 07:24.930
Let's make this like that here.

07:24.950 --> 07:29.590
So we're going to use the WC or Oxalaia here.

07:29.600 --> 07:30.380
Oxalaia.

07:31.640 --> 07:31.970
And the.

07:33.970 --> 07:34.630
Why?

07:34.990 --> 07:35.610
Yeah.

07:35.620 --> 07:36.160
Why?

07:36.220 --> 07:37.270
No, there's no such.

07:38.590 --> 07:39.280
Yes.

07:39.280 --> 07:40.270
We gone here.

07:40.300 --> 07:41.860
LZ here.

07:41.890 --> 07:42.610
LZ.

07:42.730 --> 07:43.480
Yeah.

07:43.600 --> 07:44.440
Oxley here.

07:44.440 --> 07:47.170
So WC Oxley.

07:47.470 --> 07:50.410
And here we have this here.

07:50.410 --> 07:54.170
So if we write it like that WC and or Oxley.

07:54.190 --> 07:58.960
Oxley and WC w again.

07:58.960 --> 08:03.580
And as you can see here, we got four here because we are printed here.

08:03.580 --> 08:06.460
So let's actually what that this is interesting here.

08:06.580 --> 08:07.480
So.

08:08.320 --> 08:10.180
This was our output, right?

08:10.540 --> 08:13.120
So our output was five.

08:13.150 --> 08:13.380
Oops.

08:13.390 --> 08:15.160
Actually, it's here.

08:15.160 --> 08:15.640
Yeah.

08:15.790 --> 08:21.550
Our output was five, 696.

08:23.110 --> 08:24.010
And Oxley.

08:24.010 --> 08:24.550
Yeah.

08:25.120 --> 08:26.270
Oxley.

08:26.290 --> 08:26.590
Oops.

08:26.650 --> 08:27.130
Yeah.

08:27.160 --> 08:27.970
Oxley.

08:30.670 --> 08:32.830
So here, let's count it.

08:32.860 --> 08:35.860
So this is our first word.

08:35.890 --> 08:37.600
Two, three.

08:38.360 --> 08:49.340
And for so as you can see here with this command, we get the four words and we gave this command to.

08:50.050 --> 08:51.730
WC w here.

08:51.730 --> 08:57.700
That's so as you know, we are getting with WCW, we are getting words here.

08:57.700 --> 09:02.140
So we got four and not six here.

09:02.140 --> 09:08.560
So that's an interesting type with the Linux commands here.

09:11.530 --> 09:15.160
And let's actually do one more example.

09:15.310 --> 09:15.880
Why stop here?

09:15.880 --> 09:16.390
Right?

09:16.510 --> 09:26.950
So let's add a third command to the pipeline of the count lines, words and characters in the output

09:26.950 --> 09:27.250
form.

09:28.060 --> 09:31.930
So in order to do that, we will hear.

09:32.860 --> 09:33.130
Oops.

09:33.130 --> 09:34.060
Why are you doing this yet?

09:34.300 --> 09:35.200
Clear.

09:35.500 --> 09:39.130
So our output was Oxley here.

09:39.160 --> 09:44.170
WC And as you can see, we got a four in previous code command.

09:44.500 --> 09:48.640
So WC Oxley and here.

09:48.670 --> 09:54.370
WC w and we are using again here, so we're going to use the WC here.

09:54.370 --> 10:04.550
So here the output indicates one line containing the number four, uh, one word containing the number

10:04.600 --> 10:07.390
four itself and two characters here.

10:07.390 --> 10:09.940
And as you can see here, one, one, two.

10:10.060 --> 10:13.780
So here, here.

10:15.370 --> 10:16.540
For here.

10:16.540 --> 10:21.100
The four ends with an invisible new line character here.

10:21.100 --> 10:25.300
So for ends with an invisible new line character.

10:25.300 --> 10:28.150
That's why we got this output here.

10:28.150 --> 10:32.090
So that's enough with the silly pipelines with WQ.

10:32.200 --> 10:37.600
As you gain more commands, the pipelines will become more practical.

10:37.600 --> 10:39.490
So see you in next lecture.
