So pipes are essential part of the Linux enterprise.
So here, let's dive into building your piping skills with a small set of Linux commands.
So no matter which one you encounter later, you will need to combine them.
So we will learn here the let's actually draw this.
So I will draw this here.
So you will learn about firstly the w oops here.
Yeah.
W c you will learn heat.
You will learn Heath here.
So you will also learn Cut.
You will learn about the grip.
Grab.
You will learn Sword.
And here.
Sword.
One, two, three, four, five.
And unique.
And also, yeah, it's six here.
Yeah, also here.
So let's get started.
So.
These comments have numerous options and modes of operations that will I largely skip for now.
Just now to focus on pipes.
So to learn more about any command random man command, here is why It's like, yeah, run the man command.
Oops.
Yeah.
Run the man command like this.
And for example, if I wanted to get get an information about the LHS, then the man command will give
me a detailed description, the name, synopsis, description and all of the information that I need
here.
Actually, we did learn this in previous lectures, but I just wanted to mention it again.
So here.
Let's get started with the WC command.
It's actually.
Yeah.
Here.
Clear.
WC command.
So the WC command prints the number of lines, words and characters in a file.
So let's actually use the for the for now, let's use the user interface for creating files.
But in next lectures you will also learn how to create, delete and manipulate files from the command
line.
So here, let's create a right click on it, Create document, empty file, and let's name this file
here.
Oxley.
Create.
And here.
Delete this.
Don't save here.
Let's increase the font size a little bit and write something here.
So.
Oxley.
Oxley Academy.
Typhoon Online.
Linux Course.
A YouTube.
YouTube.
We are on YouTube here.
Oxley.
And here.
This is our text for now and we will use WC animals to print the number of lines, words and characters
in a file.
So.
It's going to be like Oxley.
OXLEY And here, as you can see here, we have five lines here and 83 characters.
And we also have five words in this file lines here.
So let's open what we have as a word.
As you can see here, these all of them, it counts as a word here.
So let's add something with a space here and run this command.
Again, as you can see here, we got 96 characters, six lines, six words and five lines here.
So WC reports that our Oxley has five lines, six words, 96 characters.
So if you count the characters by eye, including here spaces, types and new lines, you will find
96 characters.
So.
But WC also includes the invisible New Line character that ends each line.
So the option here wc here, for example, wc l, w and C instructs wc to print only the number of lines,
words and characters respectively here if I wanted to.
For example, l wc l Oxley and here, as you can see here, we have file five here.
So.
So we printed the lines here.
So if we write it like this wc c as a parameter or Yeah w as a parameter, we will print the words here
and wc.
C as a parameter.
We will print the characters as a c.
For characters W for words and L for lines.
So containing is such a useful general purpose task that the authors of WC designed the command to work
with pipes.
So it reads from the stdin.
If you omit the file name and it writes to the stdout so let's use the less and less contents of the
current directory and pipe them to wc to count lines.
So the pipeline answers the question how many lines are visible in my current directory here?
And for example, ls l here or LZ one?
And as you can see, we have these files and folders in our directory.
So if you write like that here, so LZ one and LZ one and we are using Pipeline WC one or L here, we
will get ten.
So let's count here.
One, two, three, four, five, six, seven, eight, ten, 11.
One, two, three, four, five, six, seven, ten, 11.
Oops.
One, two, three, four, five, six, seven, ten, 11, 12.
So we have 12 files here.
12 lines here.
As you can see here.
Let's delete all of them.
So that's because we have, uh, the LZ.
We counted the L with LZ one.
We counted all of these folders here.
That's clear here.
So now.
Now let's actually write something.
So let's see.
WC is the first command.
You have seen in this lecture, so you are a bit limited in what you can do with pipes.
So just for fun, the pipe, the output of WC itself.
So demonstrating that the same command can appear more than once in a pipeline.
So this combines command reports that a number of words in the output of VC is a four.
So.
Let's make this like that here.
So we're going to use the WC or Oxalaia here.
Oxalaia.
And the.
Why?
Yeah.
Why?
No, there's no such.
Yes.
We gone here.
LZ here.
LZ.
Yeah.
Oxley here.
So WC Oxley.
And here we have this here.
So if we write it like that WC and or Oxley.
Oxley and WC w again.
And as you can see here, we got four here because we are printed here.
So let's actually what that this is interesting here.
So.
This was our output, right?
So our output was five.
Oops.
Actually, it's here.
Yeah.
Our output was five, six, 96.
And Oxley.
Yeah.
Oxley.
Oops.
Yeah.
Oxley.
So here, let's count this.
So this is our first word.
Two, three.
And for so as you can see here with this command, we get the four words and we gave this command to.
WC w here.
That's so as you know, we are getting with WCW, we are getting words here.
So we got four and not six here.
So that's an interesting type with the Linux commands here.
And let's actually do one more example.
Why stop here?
Right?
So let's add a third command to the pipeline of the count lines, words and characters in the output
form.
So in order to do that, we will hear.
Oops.
Why are you doing this yet?
Clear.
So our output was Oxley here.
WC And as you can see, we got a four in previous code command.
So WC Oxley and here.
WC w and we are using again here, so we're going to use the WC here.
So here the output indicates one line containing the number four, uh, one word containing the number
four itself and two characters here.
And as you can see here, one, one, two.
So here, here.
For here.
The four ends with an invisible new line character here.
So for ends with an invisible new line character.
That's why we got this output here.
So that's enough with the silly pipelines with WQ.
As you gain more commands, the pipelines will become more practical.
So see you in next lecture.