Exercise 5: Change Directory (cd)


#1
  • cd to the apple directory with one command.

I don’t know how to do this…


#2

I’m not sure the full context of the exercise–not sure what this book is from as I’m working through Python myself. From a search and a little experimenting, I can see that you can use cd ~ to get to your home directory.
If you’re trying to get to the root directory you can use cd /
You can also specify what directory to get to in a similar way to using mkdir, such as:

cd example\directory\tree\target

Hope this helps!


#3

The book is referring to the commands in the “Do This”. Look at the line that says
“cd temp/stuff/things/orange/apple/pear/grape”.
Starting in your home directory, how would you do this cd command to get to “apple” and not “grape”?

The next line in “Do More” asks you to “cd back to temp with one command”. Looking at the line in “Do This” where it has “cd …/…/…/…/…/…/…/” , how can you use this? If your in the “apple” directory, how many …/ 's do you need to use to get back to the temp directory and not your home directory?

I hope this helps, but ask again if you’re still not sure.