📖 Scenario: You are learning to move around folders on your computer using the command line. This helps you find files and organize your work easily.
🎯 Goal: Learn to use the cd command to change directories step-by-step.
📋 What You'll Learn
Use the cd command to move into specific folders
Use relative and absolute paths with cd
Use cd .. to move up one directory
Use pwd to check your current directory
💡 Why This Matters
🌍 Real World
Navigating folders quickly in the terminal helps you manage files and run programs efficiently.
💼 Career
Many tech jobs require using the command line to access and organize files on servers or development machines.
Progress0 / 4 steps
1
Start in the Home Directory
Type cd ~ to go to your home directory.
Linux CLI
Hint
The tilde ~ means your home folder.
2
Move into the Documents Folder
Type cd Documents to move into the Documents folder inside your home directory.
Linux CLI
Hint
Use the folder name directly because Documents is inside your home folder.
3
Go Up One Directory
Type cd .. to move up one directory from Documents back to your home directory.
Linux CLI
Hint
.. means the folder above your current one.
4
Check Your Current Directory
Type pwd to print your current directory path and confirm you are back in your home directory.
Linux CLI
Hint
The output should show a path ending with your username, which means you are in your home folder.
Practice
(1/5)
1. What does the command cd .. do in a Linux terminal?
easy
A. Moves you to your home directory
B. Moves you up one directory level
C. Moves you to the root directory
D. Lists files in the current directory
Solution
Step 1: Understand the meaning of .. in directory paths
The .. symbol means the parent directory, which is one level up from the current directory.
Step 2: Apply cd .. command
Using cd .. changes the current directory to its parent directory, effectively moving you up one level.
Final Answer:
Moves you up one directory level -> Option B
Quick Check:
cd .. = move up one folder [OK]
Hint: Remember: '..' means parent folder, so cd .. goes up [OK]
Common Mistakes:
Thinking cd .. moves to home directory
Confusing cd .. with cd / (root)
Using cd .. to list files
2. Which of the following is the correct syntax to change to your home directory?
easy
A. cd ~
B. cd ..
C. cd /home
D. cd -
Solution
Step 1: Identify the symbol for home directory
The tilde ~ is a shortcut for the current user's home directory in Linux.
Step 2: Check the command syntax
cd ~ correctly changes the directory to the home folder. Other options either go up one level, to root, or previous directory.
Final Answer:
cd ~ -> Option A
Quick Check:
cd ~ = go home [OK]
Hint: Use ~ to quickly jump to home directory [OK]
Common Mistakes:
Using cd .. to go home instead of up one level
Using cd /home which may not be correct for all users
Using cd - which goes to previous directory
3. If your current directory is /home/user/docs and you run cd ../pictures, what will be your new directory?
medium
A. /home/pictures
B. /home/user/docs/pictures
C. /home/user/pictures
D. /pictures
Solution
Step 1: Understand the starting directory and command
Current directory is /home/user/docs. The command cd ../pictures means go up one level to /home/user then into pictures.
Step 2: Calculate the new directory path
Going up one level from /home/user/docs is /home/user. Adding pictures gives /home/user/pictures.
Final Answer:
/home/user/pictures -> Option C
Quick Check:
cd ../pictures = up one + pictures folder [OK]
Hint: cd ../folder means go up then into folder [OK]
Common Mistakes:
Appending pictures inside current directory instead of parent
Going to root or home by mistake
Ignoring the .. and staying in same folder
4. You try to run cd myfolder but get an error: bash: cd: myfolder: No such file or directory. What is the most likely cause?
medium
A. You are already in 'myfolder' and can't cd into it again
B. You must use absolute path to change directory
C. You need to use 'cd ./myfolder' instead
D. The folder 'myfolder' does not exist in the current directory
Solution
Step 1: Understand the error message
The error says 'No such file or directory', meaning the folder named 'myfolder' is not found in the current directory.
Step 2: Check the folder existence and path
Since 'myfolder' is not present, the command fails. Using relative or absolute path won't help unless the folder exists.
Final Answer:
The folder 'myfolder' does not exist in the current directory -> Option D
Quick Check:
Error means folder missing, so cd fails [OK]
Hint: Check folder exists before cd to avoid errors [OK]
Common Mistakes:
Assuming cd ./myfolder fixes missing folder error
Thinking you can't cd into current folder
Believing absolute path is always required
5. You want to write a script that always starts in your home directory, then moves into a folder named projects inside it. Which sequence of commands is correct?
hard
A. cd ~\ncd projects
B. cd projects\ncd ~
C. cd /projects\ncd ~
D. cd ..\ncd projects
Solution
Step 1: Start in home directory
Using cd ~ moves the shell to the user's home directory regardless of current location.
Step 2: Move into 'projects' folder inside home
After being in home, cd projects moves into the 'projects' folder located there.
Final Answer:
cd ~\ncd projects -> Option A
Quick Check:
Home then projects folder = cd ~ then cd projects [OK]
Hint: Always cd ~ first to ensure starting at home [OK]
Common Mistakes:
Changing to projects before home, causing errors
Using absolute path /projects which may not exist
Using cd .. which goes up instead of home
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.