Directories and Files

Where am I? Reference
Where was I born? /
What town do I live in?
Where do I live? ~
Where am I now? .
Where was I just before where I am now? ..

*There’s no easy way to access your current mount point

What if you were a file?

Let’s say you are this file: /r4ds/do4ds/cohort1/chapter8.Rmd

File System Root Drive Home Folder Folder (Your Room) File
/ r4ds do4ds cohort1 chapter8.Rmd

Revisiting the “Where am I? table”

Where am I? Reference
Where was I born? /
What town do I live in? r4ds
Where do I live? do4ds
Where am I now? cohort1
Where was I just before where I am now? do4ds

What if you have a sudden urge to see the world?

The bash command to change directories is cd . In this case, you start at /r4ds/do4ds/cohort1 which is the directory for your (chapter8.Rmd) bedroom.

Quest Directions
Visiting your cousin in cohort2 cd ../cohort2
Visiting your second cousin in the advr/cohort1 bookclub cd ../../advr/cohort1
You’ve gotten lost and don’t know where you are and need directions to your second cousin in the advr/cohort1 bookclub cd /r4ds/advr/cohort1
Stopping by the hospital where you were born because they have great grilled cheese sandwiches in the cafeteria cd /
Going back to your room cd ~/cohort1

Any path with .. is a relative path and only works from your current directory.