Each directory, except /, is inside one other directory. That directory is its parent. The name .. means the parent of the current directory.
- /home
- learner← ../..
- shop← ..
- orders← current directory
- reports
- prices.txt
Go up with cd ..
text
learner@tidepool:~/shop/orders$ cd ..
learner@tidepool:~/shop$ cd ..
learner@tidepool:~$Put two together to go up two levels: cd ../...
Use .. in a relative path
.. is a name in a path, the same as any directory name. Go up, then go down again:
| Current directory | Path | Means |
|---|---|---|
/home/learner/shop/orders | .. | /home/learner/shop |
/home/learner/shop/orders | ../prices.txt | /home/learner/shop/prices.txt |
/home/learner/shop/orders | ../reports | /home/learner/shop/reports |
/home/learner/shop/orders | ../.. | /home/learner |
text
learner@tidepool:~/shop/orders$ cat ../prices.txt
tea 4.50
coffee 3.20The top of the tree
/ has no parent. At /, .. is / again. You cannot go above the root directory.