Alias's What are those aliases.
Well in in real life.
Illyas is like a short name or easy name or something easy to remember.
So I'm sure everybody has like a nickname when you were growing up.
And just like other people who are very famous Just look at 50 cents.
He has his real name is Curtis James.
And there's another one like.
Another example would be Pit-Bull.
His real name is our Mondo parades.
So those are the real names but they are Elissa's.
Sure.
So the short words in your name they have is because it's easier for people to remember them just the
same way Ellis's his work in Linux too.
So they are very long commands that you run almost every day but you need a shorter word off it.
And how do you create sure origin or a short word for it is by creating aliases.
So again this is a very popular command that is used to cut down on lengthy and repetitive commands.
And some of those examples that I have listed here we will cover those example one by one in our Linux
machines that say you exactly know what Elissa's work.
So let's go to our machine and we'll go into our Oracle washing machine console terminal and we will
try.
This is his command one by one.
So the first command I have in Elissa's is ls.
So often time if you want to know all the files of a minus L and a optional listing or a for to also
show the hidden files we will run the command LS minus l 8 or a L and you will see all of the listing
of the files and directories we have in our home directory.
And this is our home directory side we run the command.
Oftentimes you'll get the option.
So what we you do will create an alias will create alias and instead of just LS I'll create l equal
coat LS minus a hell got close and just hit enter.
Once you hit enter and you get an error message back it means the use is created.
Now how do you verify if it's created by simply running an alias.
But l l was r.
Yes let's run it.
And there you go.
We got the output as if you were on the whole command.
Let's create another alias the other alias what it will do.
It will do the PWT D for you and also do ls for you.
So to come at in one shot that you would you don't have to run twice.
So do p l p l i picked the word just for print working directory and LS equal code.
PETER BEATTIE And you separate each command with semicolon and l s and code close.
You hit enter and now I'm going to type p l i should get PWT and ls command running.
So first let's clear the screen and I'm going right people.
And there you go.
So the first command it ran was PWT next command ran.
LS So every time I log into the system I'll just do so and it will run those two commands for me.
Let's keep going on and let's try our third one which has three commands.
Who are my hostname and PWT.
So I want to create the Illyas on your own.
I'm going to go on to the next one.
Next one is it will list all the directories inside of my home directory.
I could run a command LS minus L and acrobat and the cap right here that you see which is on top of
number 6 that it's telling the grep grep everything that starts with D.
So run that and you'll see it grepped everything in the output that starts with D.
So of course anything that starts with D is what is a directory.
So that's what it's getting so I'm going to create an alias for it and I'm going to call a D are equal
coat balas minus L and I'm going to grow that the D and clear the screen and let's see if it's working
by typing d or.
And yes it is working.
Then I'm going to try the last command in my list.
So what.
Last command is doing.
Sorry I just have to move this a little more.
And resizes to see the last command.
So one last command is doing is of course it's doing D F minus H let's run D minus age which will output
your partition information the size where is it mounted and how much is used and the next command it's
doing the man's age is printing it's all in the last column I believe he has Dobber 6 close and you
will see it is showing you let me make this smaller to so it's listing or everything that is in the
last column which is a column six.
Now I want to get in that output.
I want to get only the first four characters of this output so I'm going to run the command again and
I'm going to do cut my A.C. one through four and enter.
And there you go.
This is what it's telling me that the last column These are the partitions that I have in my Linux distribution.
Sometimes you do one or two and that command just to find out what position you have you don't want
to look at other the information that deifies gives you.
So I'm going to create an alias for that.
So I'll just hit up arrow key of course to bring the command back.
I'll go back all the way to the beginning of the line by hitting the left arrow key type.
Oh yes and I'm going to name this alias as just d equal.
Of course I have to put quotation here.
Double code.
And there is one little thing you have to change here is you see here dollar sign in Lenox dollar sign
has what meaning if you guys remember dollar sign it is actually outputs a variable whatever that you
have variable inside that you Taschen scripting.
It actually puts it in there so it will think that it's a variable too.
So we don't want to tell it's variable.
So how we could change that or how we could tell Linux not to think it is as a Elyas.
So sorry has a variable some put backslash after putting the backslash.
Move all the way to the end and hit quotation close and enter.
And it created my alias.
Now if I do it again that's the screen I'm going to do it again.
And there you go it's doing exactly the same thing we wanted to do except what with all that long tedious
command you don't have to run it all the time.
So it's much easier every time you log into a system you type D and you get your information.
Isn't that cool.
It is very cool because that's why most of the time people use aliases so it will be easier to remember
and do the tedious work in a very short amount of time.
Now where are those areas is created once you type aliases without any running.
Creating a new command just type will use this hit enter.
You will see it here it will give you all the aliases that I have created you Pinos right here.
This is want to another one right here.
And then there is another one right here.
And the last one.
No this was other ones that are already created.
It's already there by the system by default.
It's already there for us.
So I don't have to touch it.
Now what if I wanted to remove that alias from the list of Elysa that simply there is a command to do
it as an alias and you type the alias name.
So if you notice the first alias we have we have an alias name just the latest ID.
It an earliest.
Let's see if it still exists.
You just type it.
Yes.
And see if the alias exists there or not.
It does not.
It's gone.
There's another alias DJR.
I'm going on Hell yes as well.
The are.
And then I'm going to try to check if it's there.
Nope it's gone.
So it's just that simple is masking something it's telling it's creating a shortcut key for you to run
in Linux environment.