Click the virtual machine below to start practicing
- Setting up virtual machine…
- Preparing lab files…
- Starting terminal services…
This lab machine has stopped
Your progress through the guide is saved. Start a fresh machine to keep practicing.
Click the virtual machine below to start practicing
Your progress through the guide is saved. Start a fresh machine to keep practicing.
The shell always has a current directory: the place commands act on when you don't give a full path. In this lab you'll check where you are with pwd and move around with cd.
Your working directory, ~/project, contains a small tree to explore:
project/
├── archive/2025/
└── projects/
├── scripts/
└── website/
├── css/
└── images/
pwd stands for print working directory. Run it:
pwd
/home/learner/project
This is an absolute path: it starts at the root / and names every directory on the way down. The prompt shows the same place in short form, ~/project, where ~ means your home directory (/home/learner).
cd (change directory) moves you somewhere else. Move into projects:
cd projects
pwd
/home/learner/project/projects
projects is a relative path: the shell looks for it inside the directory you're currently in. Notice the prompt changed too.
You can go down several levels in one move by joining names with /:
cd website/css
pwd
Remember .. from ls -a? It means "the parent directory". Use it to climb back up one level:
cd ..
pwd
/home/learner/project/projects/website
cd ../.. climbs two levels at once.
A path that starts with / is absolute, so it works the same from anywhere. Jump straight to the system log directory:
cd /var/log
pwd
/var/log
Relative paths are shorter for nearby places; absolute paths are unambiguous wherever you are.
Two shortcuts save a lot of typing:
cd - jumps back to the directory you were in before the last cd, and prints where it took you.cd on its own (or cd ~) takes you to your home directory.Try them in this order:
cd -
cd
pwd
/home/learner
You can now find your place in the filesystem and move anywhere in it.
pwd prints the absolute path of the current directory.cd name follows a relative path; cd /path follows an absolute one... is the parent directory, so cd .. goes up a level.cd - returns to the previous directory; cd alone goes home.