Hello, everyone, and welcome to this lesson.
So in this video are going to see some more commands that is helpful in your day to day routine of using
Linux operating system.
So we have these files which have been created over here.
So let me show you how we can use touch command.
So we already know that using touch command we can make empty files.
So let's say I type touch X, Y, Z.
So it is going to create an empty file which is x, y, z.
Now let's suppose I want to make ten empty files.
So for that, I cannot write touch one, touch two, three, four or five.
Well, let's suppose I want to make 100 files.
I cannot every time.
Right.
Touch one, touch to touch three.
Touch 100 to make 100 empty files.
For that, you can simply use the command, touch, curly braces and 1.. ten.
So this will create the ten empty files.
Let me show you our ten files created over here.
And you can see these are the files which have been created over here.
Now, you can see over here it did not create one and two because it is already being taken by these
directories, which is one and two.
So let's do ls hyphen all and you can see over here one is directory, two is directory three, four,
five, six, seven, eight, nine and ten are files.
File one and file two is again file.
And this is a symbolic link which we have created and XYZ it again is a file.
Perfect.
Let me clear the screen.
Now we have already seen how to read a file for that.
We use the command cat and the file name.
So let's read the file which is file two.
And here it says this is file two.
Now if you want to browse through a text file, you can also do that.
Simply use the command less.
So let's type less file two and hit enter.
And you can see this is file two and it is the end of the file.
Perfect.
So let's say if you want to see the first ten lines of a file, so for that you can use the command
head and file two.
Now there is only one line.
That is the reason you are able to see only one line.
So let's quickly create some lines into this file and let's say this is first line enter and let's let's
simply type some random words over here and let's say this is the last line, let's quickly save it.
And now we are going to use the command head file to oops.
Had filed two.
And you can see these are the first ten lines.
This is the first line.
Second, third, fourth, fifth.
This is an empty line, which is sixth.
This is seventh, eight, nine.
And this is the last one, which is the 10th line.
Now, if you want to do this similarly from the bottom, so if you want to read the last ten lines,
you can use the command tail file to hit enter.
And you can see this is the last line, which is the 10th line nine line eight, seven, six, five,
four, three, two, one.
So this way you can read the top of the document as well as the bottom of the document.
In case you want to read more than ten lines.
Simply, you can type, head, hyphen and how many lines you want to read.
So let's say you want to read 12 lines.
So head, hyphen 12 and the file name you can see this, this command was had file two and we could
read the top ten lines and it ended with as F.
So there should be two more lines.
11th and 12th, which is D's and F.
So this way you can specify the number of lines that you want to read with hyphen and the number.
The count over here.
Perfect.
Similarly, you can do this with Taylorsville.
So tail hyphen 15 and the final name.
So the final name is file to hit enter here.
You saw we got an error because we made a space over here.
So let's rectify this.
And here you can see we're able to see the last 15 lines.
Now, if you want to read a document in a PDF document viewer type of mode, simply you can use the
command which is more and the file name here you can see this looks something like this and you are
able to read the file completely over here.
So I hope you guys understood.
Thank you.