2

I'm a total newbie to Ubuntu and Linux and I'm struggling to even navigate to folders. The below often happens -

brian2@ubuntu:~$ cd /home/
brian2@ubuntu:/home$ cd /brian2
bash: cd: /brian2: No such file or directory
brian2@ubuntu:/home$ l
brian/  brian2/  fslyne/  testuser/

As you can see from the above I'm trying to go to the folder brian2 but Ubuntu tells me No such file or directory but the directory list command tells me it is there.

5

Welcome to Ubuntu.

From home to enter brian2 from /home/, type in terminal

cd ./brian2

or simply,

cd brian2

When to say cd /brian2, it tries to navigate the folder at / but there is no folder brian2


Further Clarification as you asked in your comment

Christian Mann aptly said it, tilde ~ refers the same thing as /home/brian2 in your case.

~ refers to home for any user. For example,

For brian ~ refers to /home/brian

For brian1 ~ refers to /home/brian1 so on.

If brian1 enters to brian's home (have to have permission) he will see at prompt

brian1@ubuntu:/home/brian$

In Linux always you can modify things. There is a special shell variable PS1 which can modify the shell prompt in different ways as you wish.

  • 1
    Just to clarify, the point is that / refers to the very top of the hierarchy of your system. home is a top-level directory under / so /home refers to the home directory at the top of the hierarchy and /home/brian2 refers to the brian2 directory inside the home directory, whereas /brian2 refers to the non-existent brian2 directory at the top of the hierarchy. cd can also check the current directory, so if you are in /home already, it will go to /home/brian2 if you type cd brian2. cd /home/brian2 does the same thing. – yuttadhammo Nov 26 '13 at 3:54
  • Hi, thanks for your answer, Souravc. I entered the following: – brian Nov 26 '13 at 3:54
  • brian2@ubuntu:~$ cd /home ....... brian2@ubuntu:/home$ cd brian2 ........ brian2@ubuntu:~$ – brian Nov 26 '13 at 3:56
  • I would have thought it would have brought me to ...... brian2@ubuntu:/home/brian2$ ?? Thanks for your patience! Brian – brian Nov 26 '13 at 3:58
  • 1
    @brian If this answer has answered your question please accept it to help keep our site clean and orderly. Thanks! – Seth Nov 26 '13 at 4:46
5

/brian2 doesn't exist. /home/brian2 does exist. If you are already inside /home then you simply need to run cd brian2 to get into that directory. If you are already that user, then cd will switch to your home directory, when you run it without arguments.

  • Thanks for your answer Dobey. I tried that (as per my message to Souravc below) but got back brian2@ubuntu:-$ Any idea why it wouldn't say brian2@ubuntu:/home/brian2 ? Maybe Souravc will answer so I don't want to bother both of you. Thanks again, Brian – brian Nov 26 '13 at 4:01
  • 1
    See that tilde? ~ means the same thing as /home/brian2. It's a convenient shortcut when you want to go to your home directory quickly, i.e. cd ~. – Christian Mann Nov 26 '13 at 5:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.