cd: Moving Around
Changing folder.
Looking into folders from outside is useful, but usually you want to go inside them. The CD command does that. It stands for change directory.

- Go inside a folder
- cd does it
- Change directory
Into a folder, and back
CD Documents moves us into the Documents folder. Look at the prompt. It now says tilde slash Documents. LS shows the files in here, without naming the folder. Then CD dot dot takes us up one level, back to home.
cd Documents ls cv.txt report.txt cd .. pwd /home/sam
Going deeper, and straight home
You can go several folders deep in one step, by joining them with slashes. And CD on its own, with nothing after it, always takes you straight back home, wherever you are. It's the quickest way to stop feeling lost.
cd /var/log pwd /var/log cd pwd /home/sam
When cd fails
If you misspell a folder name, CD just says, no such file or directory, and you stay where you were. Remember, names are case sensitive. Documents with a small d is a different name, so it fails. Tab completion helps you avoid these mistakes.
| key | value |
|---|---|
| cd documents | no such file or directory |
| Why | names are case sensitive |
| You stay | where you were |
| Fix | use tab completion |
Summary
CD moves into a folder, CD dot dot goes up, and CD on its own goes home. Next, the two kinds of path. Absolute, and relative.
Key takeaways- cd <folder>
- cd ..
- cd goes home