Moving around · Absolute paths and cd -
Absolute paths start at /
All the folders on the disk form one big tree. Its very top is called the root, written /. An absolute path starts with / and spells out the whole way down from the root, like /home/learner/Downloads.
Why: an absolute path means the same place no matter where you are. A relative path like projects/website only works from the right starting folder.
How to type it: cd /home/learner/Downloads. pwd always prints absolute paths, so you can copy one from there.
Worked example
learner@shellstreak:~/projects/website$ cd /home/learner/DownloadsWhat happened
- No output; the prompt now shows
~/Downloads. The prompt shortens/home/learnerto~, but it's the same place. - You got there directly from
~/projects/website, with no..steps.
Common mistakes
- Forgetting the first
/:cd home/learnerlooks for a folder calledhomeinside the folder you're in. - Mixing up
/and~:/is the top of the whole disk,~is your home folder,/home/learner.
Tap Run to jump straight from projects/website to Downloads.
Try it:
cd /home/learner/Downloadslearner@shellstreak: ~
Starting your practice shell…
You can also type in the terminal yourself. Try anything: you can't break it.
Go deeper: Basic terminal commands for beginners