I am doing an assignment that requires me to change in to my home directory from my current directory which is ~/sample_dir1/sample_dir/cambridge.

It asks me to change to my home directory using a relative pathname and not using cd by itself with no arguments.

I have tried numerous combinations of cd ~/ and cd .. etc and nothing seems to work.

  • 1
    One of your classmates asked a very similar question 10 days ago... – don_crissti Feb 23 '16 at 22:39
  • and there was no answer? – user157961 Feb 23 '16 at 22:42
  • are you looking for cd ../../.. ? – Liam Feb 23 '16 at 22:45
  • i'll add it as an answer – Liam Feb 23 '16 at 22:46
  • Tell us what you have tried (you did this), and what the result was. I suspect that if you were to add this to you question, then you would not press submit, as you could figure it out. – ctrl-alt-delor Feb 23 '16 at 23:14

in your directory, if you do ls -a it will list all subdirectories, including the two special directories: . and ..

. refers to the current directory.

.. refers to the parent of the current directory.

Therefore cd .. brings you up one level.

cd ../../.. brings you up 3 levels, which should take you to home.


below two will point to home directory only.

cd ~



Relative path movement can be done using

cd ../../..

you can move to previous directory using

cd -
  • Ive tried both "cd ~" and "cd" is not allowed – user157961 Feb 23 '16 at 22:41
  • if it is relative path, you can use cd ../../.. etc – Raju Feb 23 '16 at 22:47
  • @user157961, I suggest you to select Liam answer. – Raju Feb 23 '16 at 22:50
  • @Liam, you beat me bro – Raju Feb 23 '16 at 22:50

Your Answer

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