When I try to access directories in my home directory, I end up back at the root prompt. Here is a link to a snapshot of what happens:
-
2I think you have provided the wrong snapshot..please check again.– heemaylFeb 8, 2015 at 18:14
-
You are right. That is the wrong snapshot. Here is the correct one <i.imgur.com/sEfn6eR.png>.– jdh19Feb 8, 2015 at 18:25
-
Should I be able to do the following: cd /home/john/documents/...?– jdh19Feb 8, 2015 at 18:34
-
No. it is Documents not documents. Mind the capital D.– RinzwindFeb 8, 2015 at 18:49
-
2Newbie gets it now.– jdh19Feb 8, 2015 at 18:51
1 Answer
Lets break it down:
At first i am at the home directory of the logged in user (indicated by ~
sign), the name of the user is someuser
. If you do a pwd
you will see the full location where you currently at:
someuser@someuser-home:~$pwd
/home/someuser
Now i want to go back a directory i.e. to the /home
directory, as you have typed:
someuser@someuser-home:~$ cd /home
someuser@someuser-home:/home$ pwd
/home
Thats right, i am currently at /home
. Now again if i do cd /home/someuser
i will go back to where i was previously i.e. /home/someuser
:
someuser@someuser-home:/home$ cd /home/someuser
someuser@someuser-home:~$ pwd
/home/someuser
If you want to go some other directory that /home/someuser
while you are at /home
you need to cd
into that directory (given you are permitted to do so). You can do ls
to find the subdirectories of /home
and then choose our desired one.
someuser@someuser-home:/home$ pwd
/home
someuser@someuser-home:/home$ ls -l
drwxr-xr-x 4 dir dir 4096 Jun 28 2014 dir
drwxr-xr-x 2 someuser someuser 4096 Jan 10 2014 someuser
someuser@someuser-home:/home$ cd dir
someuser@someuser-home:/home/dir$ pwd
/home/dir
EDIT:
Now in accordance to what you have said in the comment, you want to check what is inside the directory /home/john/documents/linux-unix
. To list a directory i.e. to check what is inside a directory you need ls
command, not cd
. cd
will take you to the destination directory but ls
will list the files or directories inside that directory. So to list a directory:
`ls /home/john/documents/linux-unix`
Now as per your Rinzwind's comments i think you are mistaking the case sensitivity of Ubuntu. Ubuntu is case sensitive i.e. Documents
and documents
are not same. So you can have a directory named Documents
and a directory named documents
at the same time in you home directory.
someuser@someuser-home:~$ pwd
/home/someuser
someuser@someuser-home:~$ ls -l
drwxr-xr-x 2 someuser someuser 4096 Nov 22 2014 documents
drwxr-xr-x 2 someuser someuser 4096 Sep 29 2013 Documents
Normally /home/someuser/Documents
is created during installation. So, as your directory linux-unix
was inside /home/john/Documents
you need to do:
cd /home/john/Documents/linux-unix
or to list the contents:
ls /home/john/Documents/linux-unix
-
I understand that. What I don't understand is why I cannot follow a path in my home directory. Why can't I do this, cd /home/john/documents/linux-unix and see the file in linux-unix?– jdh19Feb 8, 2015 at 18:48
-
-
-
-