Below the beautiful people.
And welcome to part two of navigating the Linux file system.
So in this video, we're going to build upon what we learned in the last video about using the P, e
and the LS commands.
But in this video you're going to learn how to use the C command to actually move around the file system.
You're going to learn the difference between absolute and relative file paths.
You can learn some awesome keyboard shortcuts that will make navigating the file system so quick and
so easy.
And you basically going to see how you can put together the PWT, the LS and the CD commands to elegantly
navigate the file system.
And by the end of this video you're going to know everything that you need to know about navigating
the Linux file system, using the command line, and you watch with a bit of practice.
You'll soon agree with me that doing it this way is a lot faster and a lot more effective than using
your pointy clicky graphical methods that you've been using probably all of your life so far.
So let's go ahead and jump right into this next part of your superhero training.
Okay.
So in the last video we saw that we could use the P.W DX command to see where we were on the file system.
And we saw that we could use the LZ command with a variety of different options to basically look around
and list what was in the directory that we're in.
But using just these two commands, we're kind of stuck in the one place, right?
How can we actually move from our home directory?
Well, the missing piece is the C DX command and the CD command stands for Change Directory.
So let's say that we used our RLS command and we saw that the downloads folder by noticing that it's
in blue, it's a folder we wanted to go into the downloads folder.
How would we do that?
Well, we could do it in a few ways.
Firstly, we could give the CD command the absolute path for where we want to go.
We could go starting at the base directory.
We'd go Slash, then home, then Ziad, then downloads, and we could type that in like that and that
would totally work.
Or if we didn't want to have to write out the entire path to our home directory, we could just replace
all that with the tilde.
And we say, okay, go change to our home directory and then downloads.
That's where you'd use the tilde and nice little shortcut.
Or what we could use is something known as a relative path.
Now a relative path is a path relative to where you currently are.
So because we're currently in the home folder, how do we get to the downloads folder?
Well, let's think about it.
If we open up the graphical the graphical menu, here we are, we're in the home folder from here.
What do we do to get to the downloads folder?
We literally all we have to do is just click downloads, right?
So that you can say that that's a relative path.
We're just going from here to the downloads.
That's all we've got to do.
So to change to the downloads folder, all we've got to do is type downloads.
So if we do that, if we just type CD and then downloads just like that and press enter, you can see
that we have changed directory and our shell prompt has changed as well.
Before it was just the tilde telling us that we were in our home directory.
Now it's saying we're in our home directory and the downloads folder inside that.
Okay, so this is this text in blue here shows us the path to where we currently are and if we use the
P command now, we can see that we get slash home, slash Z slash downloads, and we can also look around
by pressing the RLS command and we can see that there's actually nothing inside that folder.
Okay.
So now that we're in our downloads folder, here's a challenge for you.
Go ahead and pause the video and see if you can use the CD command to change back to our home directory.
So go ahead and pause the video and give it a shot and then come back to see how you did.
Did you manage it?
If so, really, really well done.
You learn super quickly.
Now, you could have done it using an absolute path like this.
You could type CD, then slash home, slash your username, whatever it would be.
In my case, Ziad Slash and that's it.
That would work.
Or you could have used a tilde to make it nice and easy.
Just use CD and then a tilde.
Now I kind of cheat it a little bit because there's another way that you could have done it, and this
is the way you're probably do it from now on.
But I haven't shown you this before now by default, if you don't give it any input, the CD command
will take you to your home folder.
So if we just type CD like from scratch to type CD and press enter, you can see by this looking at
the shell prompt that we've ended up back in our home directory, we can use PWT to confirm that and
it tells us that we are back in our home directory and that will work no matter where I was previously
on the file system.
I could have been anywhere on the file system and all I've got to do is type, CD and press enter and
I will end up back in the home directory.
Pretty cool, right?
Okay, great.
So now that we're back in the home folder, I want to show you a very useful option for the RLS command.
That's kind of like wearing x ray glasses.
And it's the A option.
Now, the A option is short for all and it allows you to see all of the files in a directory, even
the hidden files.
So if I type RLS and give it the a option now if I press enter, you'll notice that we see a whole lot
of stuff in here.
Print it out.
If I clear the screen and type you just the RLS option and then show you the RLS with the A option,
you'll see we get a lot more stuff with the option.
Now a lot of these files, you'll notice, have far names beginning with dots, and that means that
they're hidden files or even hidden directories.
Okay, now, if we look in the graphical editor, we may not be able to actually see them by default.
But if we click up here like we did in the last few videos and show hidden files, we can now see them
as well.
So you look you can see that we're getting exactly the same output.
So that's how you show hidden files using the using the the the RLS command.
And you may also notice in here that we've got our bash alias file that we made a few videos ago.
Now the reason that I mention this is because there's two very important hidden folders inside each
folder.
They are the dot and the double dot folders.
Now these are shortcuts that allow you to move around easier or refer to stuff on your file system a
whole lot easier.
Now the dot folder simply refers to the current directory.
So for example, if I go to the desktop folder and then we can print, my apologies if we can do print
work in directory and we can see that we have that we're in the desktop and if I list its contents,
there shouldn't really be anything on my desktop, but there always is this dot and double dot folders
which are only visible using the LS with the option.
If I just do normal ls it doesn't show up.
If I do ls a they show up.
Okay, now in here we've got the dot and the double dot folders.
If I try to do seed to the dot folder, bash is basically going to stay where it is.
The shell is going to stay exactly where it is.
So if I do that.
You can see that we're still in the desktop, but looking at the shell prompt because the DOT folder
refers to the current folder that we're in.
Okay.
It's just a way of saying this folder.
Okay.
Now, what if I went to the double dot?
Well, if I do CD doubled up.
Okay.
You notice that we did actually change and we're in fact back in our home folder.
The double dot folder means the parent folder or the folder above where we currently are.
Okay.
So if I go back to the desktop, you can see that we've got the double dot folder.
If I press CD Double Dot.
We've gone back up a folder, which brings us into the home directory.
So we're back in our home directory.
Let's clear the screen.
What if I kept going?
If I go CD, dot, dot, I'm now in the actual home folder, which is not my home folder, but it's
the folder above my home folder.
Okay, let's keep going.
CD, dot, dot.
And now we're actually just in the slash folder.
We're in the base directory for the whole system.
Okay, see if we can go any higher if we go CD, dot, dot, you can see that we can't go any higher
because the the dat, the slash folder is the highest point on the file system.
We can actually have a look around.
If I do an LZ, what's in our base directory?
We can see there's quite a lot of files here that you saw when we had a little bit of an explanation
of the file system.
You've got the bin folder, the boot folder, the dev folder, the ETSI folder, which is full of your
configuration files, the home folder, which is where we just were to get our home stuff, the libraries,
media, which is where you have your removable hard drives, your optional stuff, the root users home
folder and so on and so on.
The the variable files, temp files, user stuff and so on and so on.
Okay, these are the folders.
And the most important of these anyway are the ones that I gave you in that cheat sheet where we talked
about the file system.
And now let's see what happens now.
This is the root user's home folder, right?
This is the home folder for the administrator.
Let's try and see what happens if we try to enter it.
If we do CD root and press enter, you can see that we get permission denied.
So there's some folders that you're allowed into and some folders that you're not allowed into.
So we don't have enough privileges to be able to access the root users home directory or.
Well, what about the C folder?
The one with the configuration files.
Let's try that.
If we try cd etsi.
Aha.
We can get into that one.
Let's see what's in there if we press LHS.
Oh you can see there's a whole bunch of stuff in there.
Right, and there's some folders in here.
The blue ones are folders and the white ones are files and some of them have different types as well.
But you don't have to worry about that.
Mostly what you'll see are blue and white, blue ones folders, white one files, and you can enter
anything that you want in there.
For example, there's one here.
Where are we looking?
There's one here called HCP.
We could go into that folder, we could try CD, DHCP.
Now what's in there?
We could do ls and we could have a look around.
We can see there's other stuff in there.
There's another one there.
DD Client enter XD Let's try to go there.
DD Client dash enter dash hooks dot.
DD You can see that we're in there.
What's in there?
Two LS We can see there's other stuff in there.
The green ones here are programs.
But you can see here, right the way that we are moving around the file system using either CD to move
ls to see what's around us or d to confirm exactly where we are.
And it's this way that you will actually move around the entire system.
And it doesn't change no matter where you are.
As long as you've got the permissions to enter those folders, you can get there using just the CD command
and you can look around using the LS command and you can confirm where you are using the P command.
Now how do we get all the way back to our home folder?
Very easy.
Just press CD, press enter and we are back in our home folder.
So you can see that pretty much anything that you need to do in the Linux file system, anywhere in
the Linux file system that you want to move to as long as you have the required permissions, all you
need are the CD LS and DVD commands and you can get wherever you want.
And if you get lost, just use the CD command to check where you are.
Pretty epic, right?
So now that we're back in our home folder, there's one final thing that I want to teach you, and that's
called tab completion.
But for that goodness, as well as a summary of everything we've learned in the past few videos.
I'll see you in the next video.