Hello everybody and welcome back to the Linux Part 2 tutorial.
Well Linux commands part tutorial.
Now as you may see right here I have two terminals open one.
I will just write the comments as we do them.
And in the other one I will put them in a text file.
So just I will open this comment that texting you have to open this file.
This is just for me so I know which commands I covered in which I didn't.
And the other one we will just test the commands in this one.
So before we begin I just want to mention the command that we did in the previous video which is the
city command.
Now you know that you now know that it stands for change directory and basically just change the directory
to another directory from this terminal.
Now for example let's say we want to go to document directory.
We could just have here see these documents.
But the question now is if for example if you wanted to go one directory back how do you do that.
Well there comes the simple command which also starts with C D but instead of typing here a directory
you can just use Type 2 dots which will basically lead you one directory back.
So if I present right here let me back the previous directory to the root directory.
As you can see right here print working directory we are again in the root.
And if we type Ellis to list the current folders and files in this directory we will once again see
the documents right here
basically just wanted to mention that that you can change directory with a document with the city command
and you can also go on directory back.
So for example if you wanted if you had let's say a directory
in the documents directory I just created it with M K Kadir command we also cover that in the previous
video stands for make directory.
You can see that now in documents directory we have a number one another directory which I basically
called just directory and also let's go to that directory and you can see that our current path right
now is slash documents slash directory now in order to go back to directories.
You can just type here two times.
And then two dots and then see these then two dots.
And now we are going to be back once again in the root directory.
So now that we got that out of the way I will just type it right here so I know I cover that command
and we will clear the screen for the next command.
Now this one is a simple command.
For example if you wanted to check out on which account are you currently which most likely will be
on the root account.
You can just type here command which basically does what it says it's who am I.
The command basically just asks Who is the current user of this terminal.
And right now as we can see it is rude you can just read from here.
If you if you don't need to even write this command you can just read it from this first word right
here which will most likely be rude unless you have another account which will cover in some next videos
how to make another account which could be useful because we do not want to run all our programs as
a route user.
It can be dangerous.
So in another radio we will cover how to make another user which you could use for some potentially
dangerous programs.
So now I will just write it right here.
This is not really that useful comment but in case you forget or in case a user is named something differently
than rude you can just check here with who am I.
Comment now there is a comment that I used in the previous videos but never really explained what it
does.
And right now we will cover it.
It's a it's an important comment especially if you're running some of the programs or downloading the
programs which are not executable.
And you for example want to make them and executable so you can run them in your terminal.
Now in order to demonstrate this command I would just go and make folder code programs because we can
see it is right here and I will change my directory into that program right now.
I will basically just create a simple simple python program
that simple python program we will call well we can just go program that it doesn't really matter.
Right here all this code a simple addition program.
Just give me one second.
It doesn't matter at the moment.
What am I doing.
But we will be also covering by the late Ron for example enter first number
will be for example and the second number and C will equal eight times B.
Now this is simple to understand we basically ask for an input for two numbers.
No just making an addition and storing it in C and then we will we can basically just print that number
at C number the result.
So we just type here result equals 2 and then plus string from C.
I hope this works it should probably work.
So we have here a program called program but by way it is a python program but you might notice that
if we tried to run that program and you'd do that by typing here dot and then slash and then the name
of the program you'll notice that it won't work.
It would say permission denied.
Now why is the permission denied.
Well if we use a command.
Let me just clear clear a screen right here we have a command that we covered previously do which is
Alice minus L. A we can see all the files in the current directory.
Also the hidden files and also our program.
But by now.
What interests us here.
Is this part right here.
Basically these are just the modes that are enabled for this file.
R stands for Reed now that stands for right and X stands for execute.
Now you might notice that in our program the PI we don't have an x which stands for execute.
Therefore we cannot really execute that program in order to make that program executable.
We want to type here c h mode plus X. And then the name of the program.
Now if I click here enter and type your Ellis L.A. again you can see now that the program changed its
color and not only the color.
It also added the x which stands for as I said executable.
You can see the difference from here and from here.
And that's how you can check if the program is executable or not.
So now let's clear the screen now.
If you wanted to you can run the program it Alaska center first number let's say three and through second
number four and it will say result equals 212.
Now it isn't.
This comment is important and you should learn it be used to make any program that is not executable
and executable so negative that that comment all the way I would just remove this book.
Well actually I believe it right here.
Maybe we'll use it for another comment such as cat.
Let's cover that comment right now.
Cat basically the comment cat stands for what not stands for it basically just prints out the contents
of the file on into our own terminal as an output.
So if you type your cat and then the name of our file for example if you just type a to just print out
the code that we just type as you can see right here it can be used.
So you don't really open the file in order to read this.
You can just print it out in the terminal with cat command and it will just print out all the contents
from the file.
Now that is not the use of this command.
Basically the menus of this command would probably be in some of the bigger files where you just want
to find a certain thing in that in order to demonstrate what I mean.
We will combine the cat command with the another command called grep.
Now basically what grep does is if you want to list for example a huge file with bunch of words and
from that huge file you want to know you want to put aside all the words that contain for example password
in the let me just demonstrate.
Maybe it's easier if they demonstrate it.
Now what you create in progress file another file with you which will be called of the extreme and here
will just type here a bunch of words and then one two three password one two three then a bunch of words.
And for example a b c password X for example and then a bunch of other random stuff.
Now if we save this file serial city are out to save enter to save under that name and see TRL X to
close.
We can see that right here we have that word that the c file.
Now in order to see the contents of that file as I said we can type just cat warns that the extreme
and we will see all of those words.
Now here we can basically with our own eyes find the all the words that contain password in them.
But let's say for example you wanted to let's say for example that this file was much bigger with millions
and millions of words you can possibly just go through all of those words and just fine by yourself.
All of those comments and not comments all of those words that contained passwords in them.
So what you want to do is combine the kept command with the grep command.
How do we do that.
Well basically we just thought of the same command cat words that the AKC and then we basically like
the grep comment how do we pipe.
Well basically this straight line to stop it right here and then you type here grep and then then the
word that you want to be contained in the other words.
So for example password in our case.
Now what this will do it will list all the words that contain the word password and then as we see it
on listed two words which is ABC password X and one two three password one two three so it is often
a very important mix of two comments which you will be using a lot at least I am using it a lot in my
case.
So let's continue with another comment which can be right now echo basically eco you can just use it
to add for example a word into another file without opening it.
For example I want to add John as a word into file words the text.
So you just do you just type echo John and then this arrow that points to right and then supports that.
And you can see the command worked.
And right now if we get the that that Steve it will only be John.
Now you might be asking where did the other words go.
Well if you use the echo command it will basically have they say that it will mean they will rewrite
the entire text file.
So from those bunch of words it both basically deleted all of them and just put John in there.
Now if we use another word let's say echo Jake into the sea and we can once again words like this in
order to see if we can see that John is no longer there it's only Jake so that we just type hear the
echo comment.
One more thing you want to know which I probably should've mentioned at the beginning and it is really
important is this command right here APD updates and one second APD upgrades.
Now this basically these referring to your lineage scanning and suppositories and it will basically
just check with the updates from there.
And in case there are some updates it will download them and you can install the updates with the app
upgrade command.
Now you want to run this command as you finish the installation of clinics but we will be doing that
command in a next video because the apps upgrade command will take after the installation I believe
about an hour in order to finish because it will download just a bunch of other files and upgrade them.
And I don't even know what not to just take a lot of time.
That's what I know.
So we'll be doing that command at the end.
So right now if you for example want to check out the history of all of the commands you typed previously
in this current session of the session of terminal you can just do that with the simple command which
says history and just print us right here all the commands they ran before.
So as you can see right here these are the commands that we ran before.
It's not that useful but you might need it sometime.
I don't use that much next command.
We want to do.
Let's say for example we want to copy the.
You want to copy the program that by file into another directory so just create directory another directory
in this program directory.
So we'll call it test directory for example.
And now you can see that we have the test directory which is blue and the green program that pipe file
which is an executable.
Now you want to for example copy this file into the Test directory.
We do that with the simple CPE command.
Well C.P. basically stands for copy and you just type here the file that you want to copy which in our
case is program the pie and then you type in type here the directory you want to copy it in and in our
case it is best.
So just press your enter and basically as you can see right now if we change directory to test we will
have also a program API there.
And they're basically identical so if we get this program back by internal directory then we go one
directory back can get here a program provider basically identical because we copy them.
So let me just put here S.P. comment.
We finish that comment.
But let's say for example you didn't want to copy the file that you just deleted from the text directory
you wanted to move it.
It is no longer here.
You want to move it from program programs directory into text directory.
You do that with the command which tends to move program the pie and then the directory where we want
to move it.
So test in uppercase you can see right now if we type here else in order to list all the files we can
see that the program the pie is no longer here it is now moved to the test directory.
So we type your Alice in the test directory and now it is only here.
Now this command can be used for two things in order to move files from one directory to another directory
and in order to rename files.
So for example if I type here Move program the pie and then I don't specify I directory where I want
to move it but they specify another name for the file.
So let's say another name the pie which is not a directory is a file it will rename the program that
pie into another name the pie as we can see right here there is no problem that by now the program is
called another name the pie.
And if we catch it right here we can see that it is the same program that we type before so it is also
important to know that it can be used for two things which is we name any more.
Just so you know.
And now we can basically right now we can cover some of the more basic comments such as men.
Now this comment basically is used for opening a manual for any other comments.
If we type here men.
Men cat it will open us a file which will basically give you all the options available for the cat comment
as you can see right here it can be used for any other comments of this type here.
MAN See it will open up a manual for the CPD command where you can see what else you can do with the
CB comment as it says right here.
Copy files and directories.
Now for example you can type here man.
History.
No I don't know if you can.
Yes it has the manual on the history based sex manual for all the other commands these manuals though
are already pre installed on linux.
You will have them with the installation of it so you can just check out if you forget what some command
does or something like that.
You can just type your land and then grep and it will basically open you up with manual and you can
just read right here and use the command.
So now the figure that the way you will be using manual a lot in the program slate from which you do
not know how they work so you will be opening up a lot of manuals in order to find out the command that
you need to use in order to run that program.
Also if we for example wanted to let's say locate some of the files you for example forgot where we
sent the file and we want to locate it.
We can do that with simple command code locate so let me just try here with another name.
Apply for example.
Yeah.
I don't think it will work like this.
I'm pretty sure why but for example you want to locate every file in the system which has word in it.
You can just type your locate and you will see that we have it will print up a bunch of these files
and they all have in some of the parts that they have worked in.
So let's see right here.
As you can see this file has than it right here.
So Kelly minus S word and then something else.
All of these files will have a word in it.
So let's say you want to locate everything that has more list.
It will also print out all the files that have what list net as you can see where this list were less
than were list dot list and so on and so on.
So we call that command as well.
Now this is about it for this story.
And in the next one we will cover some of the comments which are not new are more towards the system
that you're using so for example not that checks some of the system settings you will be running the
commands that will show you in the next video such as for example shut down.
Yes to name and restart reboot and so on and so on.
I have config and bunch of those network commands.
So you should learn this.
You should remember like these are some of the more important commands that you will be using all the
time.
And that's about it for this tutorial.
I hope I see you in the next one by.