Hello, everyone.
In this video, I'll show you how to use the head, tail and sword commands.
So in many cases, you might only be interested to display the first fuel line for file.
And for that case, you can use the head command.
For example, if I run the command head slash Etsy slash path, W.D., it will show me the first few
lines of the file.
Slash Etsy is less path W.D..
In fact, they had command displays the first 10 lines by default.
All right.
They had command can accept more than one file at an argument.
For example, the fire on the command had slashed ceaseless path.
W.D. Slash at this large group.
It will show you the first 10 lines of both failed here.
Okay, so you can pass multiple files at an argument to the head command and you can see the feresten
lines of the slash at six large group file.
And the first 10 lines of the slash etsi slash path W.D. file.
You might be wondering what if I want to view the first three lines of her file.
In that case, you can use the dash and option or pass the dash and option followed by the number of
lines followed by your file.
So here I am showing the first three lines of the file slash etsi slash path W.D..
And here I'm going to show the first seven lines because they're like the number seven.
It's my lucky number.
So here I show the first seven lines of my files last at this large group.
OK.
Amazing.
Now, what about the opposite case?
What about if you want to see or display the last few lines of a file?
In that case, you can use the tail command.
Makes sense.
The opposite of head is still so tail slash at Sizzlers Pass.
W.D. will show you the last 10 lines by default of a file.
And in a similar fashion, you can use multiple files here.
Let's see the different file slash Etsy slash services.
It's a very
nice file here.
It shows you all the different Linux services and the port.
No, the use and the protocol as well.
OK.
So here I see the last 10 lines of the file slash Etsy slash services.
And the last 10 lines of the file slash Etsy is less path W.D..
And the tell command also except the dash and option.
So let's see the last three services and let's see the last seven lines of the five slash exit slash
group.
Okay.
Amazing stuff.
Now, the only remaining command that I will discuss in this video is the thought command.
And as you may have expected, the thought command simply sort of failed.
To demonstrate, I created two files.
One called the fruit that the equity and one called.
Number two to 60.
The fruit, two to 60 contains all the fruit I like.
And I really want to get a kiwi right now.
And the number that takes to contain the numbers from one to turn in a random order.
As you can see here.
Now, what if I want to sort the fine fruit?
The texta alphabetically.
I can run the command sort.
Fruit.
The next day, as you can see now, my favorite foods are sorted alphabetically.
Apple, banana, berry.
Kiwi, mango, orange, strawberry.
OK.
What if I do the same thing on the number that 60.
Mm hmm.
Wait a minute.
They are not sorted.
Definitely to change something here.
But they are not sorted.
That's because if you want to sort numbers, you have to pass the dash and option to the sort command.
To 60, as you can see here, my file is sorted.
So here's again, if I see the file.
Now, if I run the dash and.
And you can see it displays the output in a sorted way.
All right.
So this takes us to the end of this video.
I hope you guys enjoyed it.
Chao.