On 02/26/2015 06:16 AM, m ridzon wrote:
> cd /home
> The directory will change to HOME and then LIST the sole sub-directory
> as MATT. So far, so good.
> I then issue:
> cd /Matt
> It fails then. The output says something like (my paraphrase)
> “bash…the directory /Matt does not exist.”
> I’m clueless. Why doesn’t it Change Directory to /Matt? …]
This is a matter of a relative path or an absolute path.
When you are in /home directory, "$ cd Matt " (a relative path; relative
to /home) gets you to your own home directory, /home/Matt; you can have
other directories under /home, like “Joe”, particularly if you share the
computer with other people. But this is at present beyond your skill or
need. Anyway, you can use a absolute path, “$ cd /home/Matt”, too.
“$ cd ./Matt” does the same. In this case “./” a shorthand for the
directory you are currently in, namely, /home. If you are in
/home/Matt/Documents, “$ cd ./MyLoveLetters (or simply MyLoveLetters)”
gets you to the subdirectory containing intimate letters, namely,
$ cd ~/Documents
gets me to /home/taki/Documents from anywhere in my filesystem. For you,
“~/” is a shorthand for “/home/Matt/”. So, if you issue “$ cd
~/Documents”, you will be in /home/Matt/Documents.
To get to your own home directory,
$ cd /home/Matt (this is an absolute path)
from anywhere in the file system, say, even from /usr/bin.
does the same; it’s a shortcut for “$ cd /home/Matt” on your system (for
me, "$ cd /home/taki).
When you issue
$ cd /Matt (an absolute path)
the system takes it to mean that you want to go to a top-tier directory,
/Matt in your case, in the file system, like /bin/, /home, /usr (others
are: boot dev etc lib lib64 mnt opt proc root run sbin selinux srv sys
tmp usr var; many of these are off-limit to you as a regular user). And
there is no such a directory as /Matt (/home/Matt exists, of course).