0
0
Linux CLIscripting~20 mins

Absolute vs relative paths in Linux CLI - Practice Questions

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Path Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
What is the output of this command?
Assume you are currently in the directory /home/user/docs. What will be the output of pwd after running this command?

cd ../pictures
pwd
Linux CLI
cd ../pictures
pwd
A/home/user/pictures
B/home/user/docs/pictures
C/pictures
D/home/pictures
Attempts:
2 left
💡 Hint
Remember that .. means the parent directory.
💻 Command Output
intermediate
2:00remaining
What does this absolute path command do?
What directory will you be in after running this command?

cd /var/log
pwd
Linux CLI
cd /var/log
pwd
A/home/user/var/log
B/var/log
C/log
D/var
Attempts:
2 left
💡 Hint
Absolute paths start from the root directory /.
📝 Syntax
advanced
2:00remaining
Which command correctly changes to the parent directory using a relative path?
You want to move to the parent directory of your current location. Which command is correct?
Acd .
Bcd ../..
Ccd ./..
Dcd ..
Attempts:
2 left
💡 Hint
The parent directory is represented by ...
🔧 Debug
advanced
2:00remaining
Why does this relative path command fail?
You are in /home/user. You run:

cd documents/reports

But you get an error: bash: cd: documents/reports: No such file or directory.

What is the most likely reason?
Linux CLI
cd documents/reports
AYou must use 'cd ./documents/reports' instead.
BYou need to use an absolute path starting with '/'.
CThe directory 'documents' does not exist in '/home/user'.
DThe command should be 'cd ../documents/reports'.
Attempts:
2 left
💡 Hint
Check if the directory exists in your current location.
🚀 Application
expert
3:00remaining
How many directories are in the path after this sequence?
Starting in /home/user, you run these commands:

cd ../var
cd log
cd ../../etc

After these commands, how many directories deep is your current location from the root /?
Linux CLI
cd ../var
cd log
cd ../../etc
A2
B4
C1
D3
Attempts:
2 left
💡 Hint
Track each step carefully from the root directory.