[No audio]
File system paths. Here we will talk about how we
could navigate the file system through 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
samba directory, which is in /var/log directory, it
has two directories above it. So you could start
with cd /var/log/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 relative
path is you cd into /var. Once you are
already in var, you could just do cd logs. Now,
you notice we are now using slash log because we
are already in var 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 var
directory. So let's look at the example okay. So,
first thing you have to do is become root user. su dash,
[No audio]
you put it in password. Now, if you
wanted to go directly to the samba folder, you
could just go cd slash var slash log slash samba.
[No audio]
Where are you? You are in var log samba. Now if
you notice, if you go through the relative path,
which means let's got to slash, we are in root
directory, slash directory, and if you want to go
to the var directory, you could simply do var, or
you could also do var. Once you in this directory,
and if you try to do at this point, if you try to
do 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 pwd, you will see you are in var log.
Now if you wanted to go into one more directory,
which is samba, what command would you run, cd
slash samba, or cd samba.
[No audio]
Well, you will run cd
samba, and it will take you to the samba
directory, and you do pwd, it will tell you you
are in var 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 path of the directory, in our case, which
is again, var 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 etc
sysconfig and network-scripts, 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 you which
directory you are in? You're in etc sysconfig
network-scripts. If you want to get out of from
one directory you do cd dot dot. Where are you?
You are in etc sysconfig. You want to go one
step back, you do cd dot dot, and you are an etc.
If you want to go one more directory out, you
do cd dot dot, and you do, and you are into slash
directory, again, the root directory, the main
parent directory.
So that's what this lecture is about, to
tell you the difference between the
absolute path and relative path.
[No audio]