File system pats here.
We will talk about how we could navigate the file system through to the absolute path or relative path.
So so basically there are two paths to navigate a file system.
The first one is the absolute path, and the second one is the relative path.
An absolute path always begins with a slash.
This indicates that the path starts at the root directory.
An example of an absolute path is if you are going to go into the Zomba directory, which is in var
log directory, it has two directories above it.
So you could start with CD slash waas, slash log and slash samba will take you directly to a samba
folder.
By the way, this is just an example that I picked up for to make you understand about the absolute
path.
Then we have the relative path, which does not begin with Slash.
It identifies a location relative to your current position.
An example of a relative path is you CD into slash war.
Once you are already in war, you could just do CD logs.
Now, if you notice, we are not using slash log because we are already in war directory and we could
just simply go into CD log and then from there we could CD into samba.
Again, here we are not using slash log or slash samba because they do not begin with slash.
They are within the slash ward directory.
So let's look at the example.
So first thing you have to do is become root user as you dash.
You put in a password.
Now, if you wanted to go directly to the samba folder, you could just go KD slash wah slash log slash
samba.
Where are you?
You are in Suat Lok Sabha.
If you notice, if you go through the relative path, which means.
Let's go to Slash.
We are in root directory slash directory and if you want to go to the war directory, you could simply
do war.
Or you could also do war.
Once you in this directory and if you try to do at this point, if you try to do a CD slash log, it's
not going to find it.
Because what you're trying to tell the operating system that there is a log directory within the slash
directory, which is not the case.
So how are we going to get into the log is by simply CD log.
And if you do you will see you are in war log.
Now if you want to go into one more directory, which is samba, what command would you run?
CD slash samba or CD samba.
Well, you will run CD Samba and it will take you to the samba directory.
When you do PWT it will tell you you are in your slash log slash samba directory.
So this is the main difference between the absolute path and the relative path.
And the reason you use these two different paths is because if you already know the directory where
you want to go in, you don't have to go into one directory.
Then the second, third or fourth, you could directly go into the the path of the directory in our
case, which is again war slash, log slash samba.
And there you are.
And for example, if you want to go to another directory, let's say we're going to CD at C SES Config
and network.
Scripps.
You could just do that and it will take you there.
By the way, if you hit tab, it will autocomplete your directory.
If it exists in there now which directory you are in, you can access config network scripts if you
want to get out of from one directory you do.
CDK dot where are you?
You are in else's config.
You want to go one step back.
You do cdot and you are in ETSI.
If you want to go one more directory out.
You do cdot dot and you do.
And you are in to slash directory again, the root directory, the main parent directory.
So that's the that's what this lecture is about to tell you, the difference between the absolute path
and relative path.