1
00:00:00,990 --> 00:00:06,430
So pipes are essential part of the Linux enterprise.

2
00:00:06,450 --> 00:00:11,640
So here, let's dive into building your piping skills with a small set of Linux commands.

3
00:00:11,640 --> 00:00:16,050
So no matter which one you encounter later, you will need to combine them.

4
00:00:16,050 --> 00:00:20,280
So we will learn here the let's actually draw this.

5
00:00:20,280 --> 00:00:21,660
So I will draw this here.

6
00:00:21,660 --> 00:00:26,430
So you will learn about firstly the w oops here.

7
00:00:26,430 --> 00:00:27,000
Yeah.

8
00:00:27,090 --> 00:00:31,020
W c you will learn heat.

9
00:00:35,430 --> 00:00:36,690
You will learn Heath here.

10
00:00:36,690 --> 00:00:38,850
So you will also learn Cut.

11
00:00:40,590 --> 00:00:42,780
You will learn about the grip.

12
00:00:44,010 --> 00:00:44,700
Grab.

13
00:00:47,100 --> 00:00:49,260
You will learn Sword.

14
00:00:49,260 --> 00:00:50,910
And here.

15
00:00:50,910 --> 00:00:51,900
Sword.

16
00:00:53,160 --> 00:00:55,980
One, two, three, four, five.

17
00:00:55,980 --> 00:00:57,690
And unique.

18
00:01:02,960 --> 00:01:05,810
And also, yeah, it's six here.

19
00:01:05,970 --> 00:01:08,410
Yeah, also here.

20
00:01:08,420 --> 00:01:09,680
So let's get started.

21
00:01:09,950 --> 00:01:10,730
So.

22
00:01:11,670 --> 00:01:20,190
These comments have numerous options and modes of operations that will I largely skip for now.

23
00:01:20,250 --> 00:01:22,320
Just now to focus on pipes.

24
00:01:22,320 --> 00:01:33,000
So to learn more about any command random man command, here is why It's like, yeah, run the man command.

25
00:01:33,270 --> 00:01:33,660
Oops.

26
00:01:33,660 --> 00:01:34,140
Yeah.

27
00:01:34,230 --> 00:01:36,690
Run the man command like this.

28
00:01:37,920 --> 00:01:46,560
And for example, if I wanted to get get an information about the LHS, then the man command will give

29
00:01:46,560 --> 00:01:53,490
me a detailed description, the name, synopsis, description and all of the information that I need

30
00:01:53,520 --> 00:01:54,120
here.

31
00:01:54,150 --> 00:02:00,210
Actually, we did learn this in previous lectures, but I just wanted to mention it again.

32
00:02:00,210 --> 00:02:01,500
So here.

33
00:02:02,630 --> 00:02:06,200
Let's get started with the WC command.

34
00:02:06,410 --> 00:02:06,950
It's actually.

35
00:02:06,970 --> 00:02:07,360
Yeah.

36
00:02:07,820 --> 00:02:08,290
Here.

37
00:02:08,300 --> 00:02:08,960
Clear.

38
00:02:08,990 --> 00:02:09,900
WC command.

39
00:02:09,920 --> 00:02:16,570
So the WC command prints the number of lines, words and characters in a file.

40
00:02:16,580 --> 00:02:23,180
So let's actually use the for the for now, let's use the user interface for creating files.

41
00:02:23,180 --> 00:02:29,330
But in next lectures you will also learn how to create, delete and manipulate files from the command

42
00:02:29,330 --> 00:02:29,930
line.

43
00:02:29,930 --> 00:02:38,240
So here, let's create a right click on it, Create document, empty file, and let's name this file

44
00:02:38,780 --> 00:02:39,200
here.

45
00:02:39,200 --> 00:02:39,650
Oxley.

46
00:02:40,160 --> 00:02:41,090
Oxley.

47
00:02:41,120 --> 00:02:42,080
Create.

48
00:02:42,080 --> 00:02:43,430
And here.

49
00:02:44,560 --> 00:02:45,400
Delete this.

50
00:02:45,400 --> 00:02:47,170
Don't save here.

51
00:02:48,670 --> 00:02:52,240
Let's increase the font size a little bit and write something here.

52
00:02:52,240 --> 00:02:52,690
So.

53
00:02:52,720 --> 00:02:53,560
Oxley.

54
00:02:53,590 --> 00:02:55,000
Oxley Academy.

55
00:02:55,030 --> 00:02:57,880
Typhoon Online.

56
00:02:57,880 --> 00:02:59,950
Linux Course.

57
00:03:01,200 --> 00:03:01,980
A YouTube.

58
00:03:02,320 --> 00:03:03,450
YouTube.

59
00:03:03,780 --> 00:03:07,440
We are on YouTube here.

60
00:03:07,980 --> 00:03:08,900
Oxley.

61
00:03:09,090 --> 00:03:09,930
And here.

62
00:03:09,930 --> 00:03:19,350
This is our text for now and we will use WC animals to print the number of lines, words and characters

63
00:03:19,350 --> 00:03:19,910
in a file.

64
00:03:19,920 --> 00:03:20,760
So.

65
00:03:21,830 --> 00:03:23,690
It's going to be like Oxley.

66
00:03:24,020 --> 00:03:32,240
OXLEY And here, as you can see here, we have five lines here and 83 characters.

67
00:03:32,240 --> 00:03:36,590
And we also have five words in this file lines here.

68
00:03:36,590 --> 00:03:39,110
So let's open what we have as a word.

69
00:03:39,110 --> 00:03:42,980
As you can see here, these all of them, it counts as a word here.

70
00:03:42,980 --> 00:03:47,210
So let's add something with a space here and run this command.

71
00:03:47,210 --> 00:03:54,920
Again, as you can see here, we got 96 characters, six lines, six words and five lines here.

72
00:03:54,920 --> 00:04:03,710
So WC reports that our Oxley has five lines, six words, 96 characters.

73
00:04:03,710 --> 00:04:13,400
So if you count the characters by eye, including here spaces, types and new lines, you will find

74
00:04:13,430 --> 00:04:15,110
96 characters.

75
00:04:15,110 --> 00:04:15,500
So.

76
00:04:15,500 --> 00:04:22,260
But WC also includes the invisible New Line character that ends each line.

77
00:04:22,260 --> 00: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,

78
00:04:33,630 --> 00:04:37,470
words and characters respectively here if I wanted to.

79
00:04:37,500 --> 00:04:44,850
For example, l wc l Oxley and here, as you can see here, we have file five here.

80
00:04:44,850 --> 00:04:45,480
So.

81
00:04:45,780 --> 00:04:47,640
So we printed the lines here.

82
00:04:47,640 --> 00: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

83
00:05:00,720 --> 00:05:02,400
and wc.

84
00:05:04,360 --> 00:05:05,920
C as a parameter.

85
00:05:05,920 --> 00:05:08,470
We will print the characters as a c.

86
00:05:08,620 --> 00:05:13,270
For characters W for words and L for lines.

87
00:05:13,270 --> 00:05:22,600
So containing is such a useful general purpose task that the authors of WC designed the command to work

88
00:05:22,600 --> 00:05:23,320
with pipes.

89
00:05:23,320 --> 00:05:26,170
So it reads from the stdin.

90
00:05:26,200 --> 00: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

91
00:05:35,320 --> 00:05:39,130
current directory and pipe them to wc to count lines.

92
00:05:39,130 --> 00:05:45,370
So the pipeline answers the question how many lines are visible in my current directory here?

93
00:05:45,370 --> 00:05:49,630
And for example, ls l here or LZ one?

94
00:05:49,630 --> 00:05:53,890
And as you can see, we have these files and folders in our directory.

95
00:05:53,890 --> 00: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

96
00:06:05,180 --> 00:06:06,320
will get ten.

97
00:06:06,320 --> 00:06:08,090
So let's count here.

98
00:06:08,120 --> 00:06:15,020
One, two, three, four, five, six, seven, eight, ten, 11.

99
00:06:15,590 --> 00:06:19,490
One, two, three, four, five, six, seven, ten, 11.

100
00:06:19,520 --> 00:06:20,060
Oops.

101
00:06:20,210 --> 00:06:25,130
One, two, three, four, five, six, seven, ten, 11, 12.

102
00:06:25,130 --> 00:06:27,620
So we have 12 files here.

103
00:06:28,130 --> 00:06:29,840
12 lines here.

104
00:06:30,630 --> 00:06:31,890
As you can see here.

105
00:06:31,890 --> 00:06:33,360
Let's delete all of them.

106
00:06:34,840 --> 00:06:39,450
So that's because we have, uh, the LZ.

107
00:06:39,460 --> 00:06:42,130
We counted the L with LZ one.

108
00:06:42,130 --> 00:06:45,010
We counted all of these folders here.

109
00:06:45,250 --> 00:06:46,510
That's clear here.

110
00:06:46,600 --> 00:06:47,950
So now.

111
00:06:50,550 --> 00:06:52,890
Now let's actually write something.

112
00:06:56,020 --> 00:06:58,230
So let's see.

113
00:06:58,270 --> 00:06:59,740
WC is the first command.

114
00:06:59,770 --> 00:07:04,990
You have seen in this lecture, so you are a bit limited in what you can do with pipes.

115
00:07:04,990 --> 00:07:09,610
So just for fun, the pipe, the output of WC itself.

116
00:07:09,610 --> 00:07:14,530
So demonstrating that the same command can appear more than once in a pipeline.

117
00:07:14,530 --> 00:07:20,740
So this combines command reports that a number of words in the output of VC is a four.

118
00:07:20,740 --> 00:07:21,310
So.

119
00:07:22,700 --> 00:07:24,930
Let's make this like that here.

120
00:07:24,950 --> 00:07:29,590
So we're going to use the WC or Oxalaia here.

121
00:07:29,600 --> 00:07:30,380
Oxalaia.

122
00:07:31,640 --> 00:07:31,970
And the.

123
00:07:33,970 --> 00:07:34,630
Why?

124
00:07:34,990 --> 00:07:35,610
Yeah.

125
00:07:35,620 --> 00:07:36,160
Why?

126
00:07:36,220 --> 00:07:37,270
No, there's no such.

127
00:07:38,590 --> 00:07:39,280
Yes.

128
00:07:39,280 --> 00:07:40,270
We gone here.

129
00:07:40,300 --> 00:07:41,860
LZ here.

130
00:07:41,890 --> 00:07:42,610
LZ.

131
00:07:42,730 --> 00:07:43,480
Yeah.

132
00:07:43,600 --> 00:07:44,440
Oxley here.

133
00:07:44,440 --> 00:07:47,170
So WC Oxley.

134
00:07:47,470 --> 00:07:50,410
And here we have this here.

135
00:07:50,410 --> 00:07:54,170
So if we write it like that WC and or Oxley.

136
00:07:54,190 --> 00:07:58,960
Oxley and WC w again.

137
00:07:58,960 --> 00:08:03,580
And as you can see here, we got four here because we are printed here.

138
00:08:03,580 --> 00:08:06,460
So let's actually what that this is interesting here.

139
00:08:06,580 --> 00:08:07,480
So.

140
00:08:08,320 --> 00:08:10,180
This was our output, right?

141
00:08:10,540 --> 00:08:13,120
So our output was five.

142
00:08:13,150 --> 00:08:13,380
Oops.

143
00:08:13,390 --> 00:08:15,160
Actually, it's here.

144
00:08:15,160 --> 00:08:15,640
Yeah.

145
00:08:15,790 --> 00:08:21,550
Our output was five, 696.

146
00:08:23,110 --> 00:08:24,010
And Oxley.

147
00:08:24,010 --> 00:08:24,550
Yeah.

148
00:08:25,120 --> 00:08:26,270
Oxley.

149
00:08:26,290 --> 00:08:26,590
Oops.

150
00:08:26,650 --> 00:08:27,130
Yeah.

151
00:08:27,160 --> 00:08:27,970
Oxley.

152
00:08:30,670 --> 00:08:32,830
So here, let's count it.

153
00:08:32,860 --> 00:08:35,860
So this is our first word.

154
00:08:35,890 --> 00:08:37,600
Two, three.

155
00:08:38,360 --> 00: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.

156
00:08:50,050 --> 00:08:51,730
WC w here.

157
00:08:51,730 --> 00:08:57,700
That's so as you know, we are getting with WCW, we are getting words here.

158
00:08:57,700 --> 00:09:02,140
So we got four and not six here.

159
00:09:02,140 --> 00:09:08,560
So that's an interesting type with the Linux commands here.

160
00:09:11,530 --> 00:09:15,160
And let's actually do one more example.

161
00:09:15,310 --> 00:09:15,880
Why stop here?

162
00:09:15,880 --> 00:09:16,390
Right?

163
00:09:16,510 --> 00:09:26,950
So let's add a third command to the pipeline of the count lines, words and characters in the output

164
00:09:26,950 --> 00:09:27,250
form.

165
00:09:28,060 --> 00:09:31,930
So in order to do that, we will hear.

166
00:09:32,860 --> 00:09:33,130
Oops.

167
00:09:33,130 --> 00:09:34,060
Why are you doing this yet?

168
00:09:34,300 --> 00:09:35,200
Clear.

169
00:09:35,500 --> 00:09:39,130
So our output was Oxley here.

170
00:09:39,160 --> 00:09:44,170
WC And as you can see, we got a four in previous code command.

171
00:09:44,500 --> 00:09:48,640
So WC Oxley and here.

172
00:09:48,670 --> 00:09:54,370
WC w and we are using again here, so we're going to use the WC here.

173
00:09:54,370 --> 00:10:04,550
So here the output indicates one line containing the number four, uh, one word containing the number

174
00:10:04,600 --> 00:10:07,390
four itself and two characters here.

175
00:10:07,390 --> 00:10:09,940
And as you can see here, one, one, two.

176
00:10:10,060 --> 00:10:13,780
So here, here.

177
00:10:15,370 --> 00:10:16,540
For here.

178
00:10:16,540 --> 00:10:21,100
The four ends with an invisible new line character here.

179
00:10:21,100 --> 00:10:25,300
So for ends with an invisible new line character.

180
00:10:25,300 --> 00:10:28,150
That's why we got this output here.

181
00:10:28,150 --> 00:10:32,090
So that's enough with the silly pipelines with WQ.

182
00:10:32,200 --> 00:10:37,600
As you gain more commands, the pipelines will become more practical.

183
00:10:37,600 --> 00:10:39,490
So see you in next lecture.
