Lesson 1 · Unit 01
Where am I
pwd, cd and ls: absolute and relative paths
What you practise
pwd,ls -la,cd, absolute vs relative paths,.,..,~, hidden files, the layout of/(/etc,/home,/var,/tmp,/usr/bin)
Try a question from this lesson
Pick one
A shell always stands in one folder. pwd prints it and cd changes it. The first pwd prints /home/ada. What does the second print?
mkdir projects
pwd
cd projects
pwdCorrect answer
/home/ada/projects
Why
cd projects has no leading slash, so it is looked up inside the folder you are in. pwd always prints the full path from the root /, which is why it is not just projects.
The ideas
Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.
Concept
Two kinds of path
A path that starts with / is absolute: it begins at the root of the tree and means the same thing wherever you are.
Anything else is relative: it begins in your current folder.
Three shortcuts: . is the current folder, .. is its parent, ~ is your home folder.
cd /var/log # absolute
cd .. # up one: now in /var
cd ./log # same as: cd log
cd ~ # home, from anywhereConcept
One tree, from /
Linux has no drive letters. Everything hangs off one root, /, and a few folders mean the same on every machine.
Programs live in /usr/bin, system settings in /etc, logs in /var/log, each user's own files under /home, and throwaway files in /tmp.
/
├── etc/ settings
├── home/
│ └── ada/ your files (~)
├── tmp/ scratch space
├── usr/
│ └── bin/ programs
└── var/
└── log/ logs9 more exercises in the app
- 3× type the answer
- 2× multiple choice
- 1× fill the blanks
- 1× true or false
- 1× match the pairs
- 1× order the lines
Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.