It's time again for another quick exercise this time you'll get some practice with the basic command
line commands like touch and CD and Ls and the other ones that we've talked about in the last few videos
.
As always I'll do a quick intro to the assignment and then you should post the video and do this one
on your own.
So here's the assignment using only the command line.
So no right clicking no file new file only the command line make a new folder called animals and then
inside of the animals folder add two more directories.
Awesome animals and sketchy animals.
And then inside of the awesome animals directory I want you to add three different files Kappy Barakat
J.S. arctic fox does Tim owl and tree frog TXI.
And then instead of the sketchy animals folder add to other files brown recluse that all very sketchy
spider and bullet and Dot.
Yes.
Next inside of the sketchy animals directory create a new directory called snakes inside of that snakes
directory create two files COBRA to see assess and articulate it Python.
Then you decide that bullet ants are actually not sketchy.
They're totally misunderstood and you want to clear their name.
So you're going to remove the bullet and Dot G-S file and then the very last thing is that unfortunately
all animal life goes extinct and you have to delete the entire animal's directory and everything inside
of it.
So just to reiterate this is all with only the command line.
So you shouldn't use your mouse at all just typing commands right here.
You should be able to do all of this.
And then there's a bonus at the end which is to see if you can do the whole thing without ever using
the cd command.
All right so it's a video.
Definitely give this one a shot in your own.
It's really really important that you get comfortable with the command line.
As soon as possible.
And then when you're ready unposed video and I'll be here with a quick solution already.
Let's go ahead and go over the solution.
So the first thing is that we need to make a new folder named animals and I didn't specify where you
needed to do this so it doesn't actually matter.
I'm going to do it right where I am inside of Intro to command line to make a new folder named animals
.
It's M-K KTAR animals and then Rigaud type.
LS You can see animals instead of animals.
Add to directory's awesome animals and sketchy animals.
So CD instead of animals.
And then we'll add a directory.
So M-K DA are awesome animals and Cadia are sketchy animals.
For the record we could have combined those onto one line and just said M-K DA are awesome animals space
sketchy animals and that would make two for us instead of awesome animals.
Add three files.
Let's go inside of Manimal so CD awesome.
There we go.
And butts touch Kappy Bara dot.
I always wanted to touch one of those touch and arctic fox that HMO and touch tree frog Dot T S T.
And again just like with make directory we could have combined those into one line by saying touch carefully
Barcott J.S. space arctic fox space tree frog and that would create three files.
Let's just double check.
Type ls.
There are three files recreated.
Now we need to go inside of the sketchy animals and add brown recluse that aged him l and bullet anti-Jesus
so well back out.
The dot dot.
Now we're inside of animals and we're gonna go instead of sketchy animals and it's totally empty so
we're going to touch two files brown recluse that HMO and bullet ant.
Yes and I'm going to do them this time on the same line.
So just touch brown recluse that H.T. male space pull it and touch us if we type LS he can see both
of them were created for us.
Now the next part is inside of sketchy animals create a snake's directory so that M KTAR make directory
snakes
and then instead of the snakes directory create the following files.
Cobra does the SS and reticulated python p y.
So we'll go into the snake's directory just like that and will make co-productions us so touch.
Cobra does S. S. S..
Hope I never have to touch COBRA and reticulated python P Y which is python Yes it's a very funny joke
and we'll hit Enter now we type.
There we go.
We have our two files created.
We touched both COBRA and a python.
Then we have a change of heart and decide that bullet ants are no longer sketchy.
So we want to delete that file.
So I'm going to back out of the snake's directory.
Now I'm inside of the sketchy animal directory and I'm going to delete brown recluse that aged him l
with R M R M and then use tab completion brown recluse said time I'll hit enter.
It's now gone then will CD back and then unfortunately all animal life has gone extinct.
And now we need to delete the entire animal directory.
So I'm going to back out so that now I see the animals directory.
I'm inside of.
INTRO TO command line and to delete that I need to use r.m dash R.F. animals and there we go type ls
and animals is completely gone.
Now let's quickly discuss the bonus which was to do all of the commands without ever changing directories
so never using the CD command.
It's actually not difficult to do it the same exact commands but we have to reference different paths
.
So let me show you what I mean to make a new directory called animals.
That's exactly the same to make directory animals but rather than seeing into animals to make awesome
animals and sketchy animals we can do a make directory animals slash awesome animals just like that
and make directory animals slash sketchy animals.
Now if I just type LS here all we see is animals but I could type.
LS animals.
And now we see awesome animals and sketchy animals so inside of awesome animals we're going to add these
three phials coffee bar.
Arctic fox and tree frog.
So without leaving this directory we're going to do a touch animals slash awesome animals.
We can use tab completion slash Caffre Bara dot J us and then do the same thing animals slash awesome
animals.
Except this time Arctic fox.
H m l.
And then one more time and I'm hitting the up arrow here.
Just like in the javascript Council we can hit the up arrow to retrieve the most recent commands and
we can keep hitting it to cycle through everything in our history.
So using that just to save some time and we're going to create a tree frog that TXI me again if I just
type ls.
All I see is animals.
So if I do ls animals
animals slash awesome animals I now have those three files.
Next up is instead of sketchy animals and brown recluse and bullet ants.
So will do touch animals slash sketchy animals slash brown recluse dot T.M. and the same thing except
for a bullet ant that genius.
And then to verify that we can do an ls animals slash sketchy animals and we see both the files there
without ever leaving our insured to command line directory.
We're still right here.
All right.
Now onto my least favorite part.
We have to create the snake's directory.
There so sketchy they need their own directory here so we're going to make directory animals slash sketchy
animals slash snakes and that will make us a directory and you can see that here instead of sketchy
animals we now have a sneaky directory.
Now instead of that snake's directory we need to make Cobra does s.c.s and reticulated python Python
.
So we're going to do a touch animals slash Sketchley animals slash snakes slash Cobra C Ss and the same
thing except reticulated python I don't think it could have picked a longer animal name there.
Now we can verify that with an us animals sketchy animals snakes and we get those two files.
Next up we're going to delete the bullet and Jacque's file.
So we still use r.m but we have do the full path.
So animals slash sketchy animals slash bullet and thought genius.
Now if I do ls animals slash Sketchley animals you can see that it's gone now.
The easy part is to delete the entire animal's directory.
You don't have to do anything fancy.
All we need to do is r.m dash R.F. animals and we've now wiped out all animal life on this planet.
You monster.
All right so that's it for the exercise.
Hopefully that was some good practice for you if at any point you struggled to recall or to use any
of the commands that we talked about.
I highly highly recommend that case.
I cannot recommend it enough that you take some time away from this video.
Don't move on just yet and practice.
So whether that means watching the video again doing this exercise again making up your own exercise
but those basic commands.
Those six that we talked about so that's ls and CD touch and make directory an arm in arm dash RF are
really important for basically everything we're going to do from here on out.