Cannot CD or change directory into a directory, meaning when you're trying to run the command CD and
you're trying to go to another directory, that's where you are having an issue or you getting an error
message.
So why is that?
And that is what we're going to troubleshoot today in this in this lecture.
So there are few steps that we could take to actually isolate these type of issues.
And then you can now get into a directory.
Of course, there are a few things you need to check, a few things to keep in mind.
And those are the things I want to list today.
The first thing, first directory does not exist.
It's just that simple.
So you are trying to CD into a directory or a folder, but you cannot.
And the error message that you're getting is directory does not exist.
Try to read that message, the output, the error.
What it is saying to you, it's saying that directly does not exist.
So either you are not you you actually have incorrect spelling of the directory.
You finger type, you fat fingered it or it simply just does not exist, or somehow it does not exist
in the right directory where you are.
So first thing is how we could tell if the drug did not exist.
So let me log into my machine.
I have a machine right here now.
I am logged in as as myself root sorry.
I am in which directory I do.
I am in directory here in this directory I will create a new directory and I will call it Steinfels.
OK, so now when I do this minus LTA, I will see the directory, it is created with the name Seinfeld.
Now if I'm trying to KDDI into that directory, Seinfeld.
Huh?
Why am I getting this no such file, a directory that is the most common issue people see and they get
confused.
Oh my God, why?
Where did the directory go?
But you need to understand, relax and see what the problem is.
If you notice, I typed up a case where as the directory that I created is with lower cases now in Linux
or Unix environment, upper case and lower case matters a lot.
So keep that in mind.
So the sign filled with uppercase directory does not exist.
That is why you are having issues with logging in our CD into this system, into the directory.
Now next thing is absolute worst is relative path.
When you trying to CD into a directory, many times you have a path given and you put the Patin, but
it doesn't work or you are trying to CD into through a relative path.
You need to know where therefore there is.
Let's get into my Linux machine again.
Let's clear the screen.
So we do have a directory that we created which is Sinovel.
Now I want to CD into this foresightful directory all hit enter.
There's nothing in that direction because it's empty.
InDesign actually I will create another directory called Cherry and I'll create another directory called
Kramer.
So now inside of Sinovel I have two directories, Jerry and Kramer.
And if I go into Jerry directory and I'll do P d, you will see the entire part of this territory is
a root slash Seinfeld slash Jerry.
So that is one of the things that you will experience when you try to CD into a directory when you are
missing a subfolder or subdirectory end the absolute path.
This entire path.
If you're trying to CD into this entire path, it will work.
It is going in.
But if you are missing, let's say if you're missing one directory, that's a root.
And Jerry, you know that you created Jerry, but you just couldn't keep track of where that directory
go.
You had entrances, no such file or directory.
Now you are back to the equation.
One where we would talk about directory does not exist.
You need to relax.
You need to see where that direct he was created anyway.
So make sure your absolute path is correct when you come to relative path.
Relative path is when you CD in let's say if I'm in CD slash and when I do you will see I am in slash
directly.
I could go straight to Jerry directory the way I did it before.
We just CD slash rude slash Seinfeld and slash Jerry and I will go straight into the directory.
But if you cannot get in and you're trying to troubleshoot where that directory exists, then I will
recommend you that you go one step at a time like you are climbing up the stairs.
Don't just try to jump three stairs up, go one step at a time.
So for that you will do a CD slash route.
Now here you need to do X minus L and see if there is a folder or a directory in the listing that says
Jerry does it now.
Right.
So it means it's not there.
So try to see where that directory is.
Then you will go into another folder that is called Sinovel.
You are in the Seinfeld do list minus L again.
And now there it is, the directory called Jerry or Kramer, wherever you want to go.
And that's how you are ending up with the directory.
Jerry, another common mistake people make, which is going through the relative path, but specifying
absolute path.
What does it mean?
Let's check.
So if I'm KDDI into Slash, this is my main primary, the route very first directory of the system.
Now, I wanted to go into slash route directly.
OK, I am in slash through directory.
It says I am and slash route and I'll do X minus L.
And I do see there is a directory called Seinfeld.
I wanted to code into this directory, but many times the mistakes that people make is they do CD slash
Seidenfeld.
And when you hit enter, you get the same message, no such file or directory.
Why is that?
Because you are telling Linux operating system that this Seidenfeld is actually located at the root
level, meaning at this level, it is not located at the root level.
It is located under the root directory.
So if you're going to specify slash, then the system is going to think that you are trying to find
that sign file directory in this slash root.
And when you do X minus L, you'll see there is no sign, Bill, to make sure you need to know where
you are using Slash and where you are not.
So that is why that's a common mistake people make when they do absolu path versus relative path.
Next one, we have permissions.
Of course, this is also very common when you are trying to CD into a directory and you cannot because
you do not have permissions.
Let me explain you permissions first if you have not.
If you do not have quite a bit understanding of permissions, that is fine.
I'm here to help you, so I'm going to explain to you the permission part in detail.
The permission of a file or a directory is divided into three different groups, one that you see on
the left hand side, which has four bits.
By the way, these dashes are referred as bets.
Then this is a section which is divided for group and this is the section for other.
Now, the first bit is actually the one that defines what type of file it is, whether it is a file,
it is a directory, it's a link, it's a socket file.
Anything, any type of file or it's what's the function of a file.
It's all defined with the first attribute.
If you see a D here on the first one that it means it's a directory, then only then you could go in
second bit is above read.
So if you have read permission on the directory then can you get in now.
Read permission on a directory means you can still get in if you have executable, but you cannot write
anything.
So this is the read sector but is about the right and the third one is about execute.
Same way it goes for the, the sorry.
The first part that I just explained to you is about the U.
The second is for the group.
The first one is you, meaning as yourself that you are the owner of that directory.
Now don't confuse this you with the last.
Oh, because a lot of people confuse you as a user but always owner.
Now all it stands for others anyway.
So the second set of permissions again read, write, execute, then the third one is for everyone else
to read, write, execute.
These are the permissions about every file or directory that we create.
So let's go into our machine and you will see here I'm going to go into slash root ls minus l tr to
see my side full directory and you notice InDesign folder victory.
We had these permissions.
If you have, if you do not have D in front of a directory, it means it's not a directory.
No matter how many times you try to code into it, it's not going to work.
Then you're going to see is read, write and execute these three bits.
It means the user who is route can have a read and write and execute permission.
When you say read, it means the user can read the content inside of the directory.
Then you have write.
It means the user can actually write or create files inside of this folder.
And when you have X, it means the user can actually go into the directory.
Now, this is very important.
You need to know this.
If you do not have this little bit right here execute, then you can not see it into a directory.
So make sure whichever group you are, whichever whoever the user you are, you should have executable
permissions to copy into the directory sometime people can.
Use that with the read, permission read and execute is not the same read allows you to look into a
directory where as this ah allows you to read the content.
If you do not have ah then you can still go into a directory.
But when you're going to run URLs minus L is going to say you don't have permission to view the content
of the directory.
So you got it.
Hopefully you do.
Then the second step is from here are dash x.
This is for everybody else.
Meaning not.
Sorry everybody, this is for group right now.
The users route, the group is route.
These are the two column who owns and who actually uh which group they are in.
So the group permissions, you could actually read the content, you could KDDI into the directory but
you cannot create any file or directory.
The last one is the same for everyone else.
You could read the content and you could KDDI into the directory, but you cannot create anything in
it.
So make sure you do not.
You have the permissions.
So if I'm going to take the permission of others of Zionsville.
So now what I'm saying is only route and its group can get into Seidenfeld, everybody else cannot.
And you do this myself, TIAR, you will see that little that little X is gone.
Now, if I become myself, which is I afsal now if I try to go to route permission denied.
Oh even rude doesn't have permission for me to come in.
So let me go to Slash and I'll do less minus l tr en route.
Which route right here, you see at the root level, I'm not allowed to come in.
Forget the sign for level, so make sure this executable exist.
So let's go back as route.
So this time I'm going to give permission.
For everyone to have to contribute now, I'm in now.
This one has a full chief, Seinfeld and I have taken out executable.
Now I'm going to give it back to executable.
By the way, this is a command change mod, I am hoping and I'm assuming everybody knows this is the
command to assign or remove the permission of a file or directory.
So now I'll do it myself.
And you see the permissions are granted to KDDI into it.
I still cannot create any file.
What if I remove or change mod others remove or Sinovel?
Now, when you do this myself, tiar you notice I do not have read permission.
So now if I go into the side file directory and you see I could view the content of Jerry and Kramer
because I'm route.
What if I become I have TSOL and now I go to CD into Cheroot.
And I'll do this myself.
I cannot view the contents of route to wire because at the root level right here, see right here,
no one other than Route or this group is allowed to come in, create or read the content.
That's why you're getting the permission denied or you are seeing cannot open directory.
You could still see into it why you couldn't into it.
Because we have given the executable, if you remember right here.
Um, let's go see Slash.
Well, shoot.
This is route, if you notice, we have given the permission to come in.
Anybody could come in to route, but they cannot view the content because they don't have a read permissions
anyway.
So that's another reason why you cannot read into the directory.
Next reason file type.
This is I already talked about it.
If a file or direct it does not have a D in front of it, then then it's not a file.
Sorry, then it's not a directory.
So if I am and in my home directory home I have solved and I create a file called Touch Elain.
So if I try to CD Alayne, what will happen.
It will say it's not a directory Y because when you do X mysel tr you'll see there is no D in front
of it.
So that's the file type I'm talking about.
Make sure the file type is correct.
The next one is parent directory permission.
We've already covered that when you do not have a correct permissions, let's say on the root, no matter
how many permissions you have after the slash route, it does not matter.
It's just a front main door is locked so you cannot go to the bedroom door.
So that's why I make sure the parent directory has a proper permission.
And the last one is the hidden directories.
Many times people also make a mistake of a hidden directories, meaning you create a file or directory
mkdir.
And I will make, um, directory dot sim sun and I do ls minus Lety or and you notice there is no Simpson
but someone tells you, hey, go to the directory and they actually miss out the dot because the dot
is something that makes it hidden.
So you have to do X minus L A to show all hidden files and in the head and file you'll see there is
a Simpson directory.
Now you could do into KDDI, Dot Simpson and then now you in to make sure the directory you're trying
to come into is not hidden.
So these are the few pointers I want you to keep in mind, if you go through every step of these troubleshooting
steps, you I'm pretty sure you will be able to resolve the issue.