What does cd do?
cd (change directory) moves you into another folder. cd alone or cd ~ goes to your home folder, cd .. goes one level up and cd - returns to the previous folder.
cd [path]
Most useful options
| Option | What it does |
|---|---|
| ~ | your home folder |
| .. | the parent folder |
| - | the previous folder |
| / | the root of the file system |
cd examples
In security work
Paths like ../../ ("path traversal") are how attackers escape a folder in vulnerable web apps.
Questions about cd
What is the difference between absolute and relative paths?
An absolute path starts with / and works from anywhere (/var/log). A relative path starts from your current folder (logs/app.log).