Bird
Raised Fist0
Linux CLIscripting~20 mins

Why file system navigation is the first skill in Linux CLI - Challenge Your Understanding

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
File System Navigator
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Why is file system navigation essential before scripting?
Imagine you want to automate a task that involves files on your computer. Why must you first learn how to move around the file system using commands like cd and ls?
ABecause navigation commands automatically fix file permission errors.
BBecause file system navigation commands speed up the computer's processor.
CBecause scripts need to know where files are to read or write them.
DBecause navigation commands create new files needed for scripting.
Attempts:
2 left
💡 Hint
Think about how a script finds the files it needs to work with.
💻 Command Output
intermediate
1:00remaining
What is the output of this navigation command?
You run these commands in order:
cd /usr
cd local
pwd
What will be the output?
Linux CLI
cd /usr
cd local
pwd
A/local
B/usr/local
C/usr
D/home/user
Attempts:
2 left
💡 Hint
Each cd moves you into a folder inside the current one.
📝 Syntax
advanced
0:45remaining
Which command correctly lists all files including hidden ones?
You want to see all files in the current folder, even those starting with a dot (hidden files). Which command is correct?
Als -a
Bls -l
Cls --hidden
Dls -h
Attempts:
2 left
💡 Hint
The option to show hidden files is a single letter.
🔧 Debug
advanced
1:30remaining
Why does this navigation command fail?
You run:
cd /home/user/Documents
Then:
cd Projects
But get an error: bash: cd: Projects: No such file or directory
Why?
ABecause the 'Projects' folder does not exist inside Documents.
BBecause you must use absolute paths only.
CBecause 'cd' cannot be used twice in a row.
DBecause you need to use 'cd ./Projects' instead.
Attempts:
2 left
💡 Hint
Check if the folder you want to enter is really inside the current folder.
🚀 Application
expert
2:00remaining
How many files will this script list?
Consider this script snippet:
cd /var/log
files=$(ls -a | grep -v '^\.')
echo "$files" | wc -l
What does the final command output?
Linux CLI
cd /var/log
files=$(ls -a | grep -v '^\.')
echo "$files" | wc -l
AThe total number of files including hidden ones in /var/log
BThe number of hidden files only in /var/log
CAlways 0 because of incorrect command syntax
DThe number of non-hidden files and folders in /var/log
Attempts:
2 left
💡 Hint
The grep command removes lines starting with a dot.

Practice

(1/5)
1. Why is file system navigation considered the first skill to learn in Linux command line?
easy
A. Because it automatically fixes file errors.
B. Because it allows you to install software.
C. Because it lets you change system settings directly.
D. Because it helps you find and manage files easily.

Solution

  1. Step 1: Understand the purpose of navigation commands

    Commands like cd, ls, and pwd help you move around and see files and folders.
  2. Step 2: Recognize the importance of managing files

    Being able to find and organize files is essential before doing other tasks like installing software or changing settings.
  3. Final Answer:

    Because it helps you find and manage files easily. -> Option D
  4. Quick Check:

    Navigation = Manage files easily [OK]
Hint: Remember: navigation = finding and managing files [OK]
Common Mistakes:
  • Thinking navigation installs software
  • Confusing navigation with system settings
  • Believing navigation fixes file errors automatically
2. Which of the following is the correct command to change directory to the home folder in Linux?
easy
A. cd /home
B. ls ~
C. cd ~
D. pwd ~

Solution

  1. Step 1: Identify the command to change directory

    The command to change directory is cd.
  2. Step 2: Recognize the shortcut for home directory

    The tilde ~ represents the home directory, so cd ~ moves you there.
  3. Final Answer:

    cd ~ -> Option C
  4. Quick Check:

    cd ~ changes to home [OK]
Hint: Use cd ~ to go home quickly [OK]
Common Mistakes:
  • Using ls ~ which lists files, not changes directory
  • Using pwd ~ which is invalid syntax
  • Using cd /home which may not be the user's home
3. What will be the output of the following commands sequence?
cd /tmp
pwd
cd ..
pwd
medium
A. /tmp /
B. /tmp /tmp
C. / /tmp
D. / /

Solution

  1. Step 1: Execute cd /tmp and pwd

    Changing directory to /tmp and printing working directory shows /tmp.
  2. Step 2: Execute cd .. and pwd

    Moving up one directory from /tmp goes to /. Printing working directory now shows /.
  3. Final Answer:

    /tmp / -> Option A
  4. Quick Check:

    cd /tmp then cd .. moves to root [OK]
Hint: Remember: cd .. moves up one folder [OK]
Common Mistakes:
  • Thinking cd .. stays in the same folder
  • Confusing output order
  • Assuming pwd shows previous directory
4. You run the command cd documents but get an error: bash: cd: documents: No such file or directory. What is the most likely cause?
medium
A. The folder 'documents' does not exist in the current directory.
B. The 'cd' command is misspelled.
C. You need to use 'ls' before 'cd'.
D. You are already in the documents folder.

Solution

  1. Step 1: Understand the error message

    The error says the folder 'documents' does not exist in the current directory.
  2. Step 2: Check the folder existence

    If the folder is not there, cd documents will fail with this error.
  3. Final Answer:

    The folder 'documents' does not exist in the current directory. -> Option A
  4. Quick Check:

    Error means folder missing [OK]
Hint: Check folder exists before cd [OK]
Common Mistakes:
  • Assuming 'cd' is misspelled
  • Thinking 'ls' must run before 'cd'
  • Believing you are already inside the folder
5. You want to write a script that lists all files in your home directory, then moves into the Documents folder inside home, and finally prints the current directory path. Which sequence of commands is correct?
hard
A. cd ~/Documents ls ~ pwd
B. ls ~ cd ~/Documents pwd
C. pwd cd ~ ls Documents
D. ls Documents cd ~ pwd

Solution

  1. Step 1: List files in home directory

    The command ls ~ lists files in the home directory.
  2. Step 2: Change directory to Documents inside home

    cd ~/Documents moves into the Documents folder inside home.
  3. Step 3: Print current directory path

    pwd shows the current directory, which should now be Documents.
  4. Final Answer:

    ls ~ cd ~/Documents pwd -> Option B
  5. Quick Check:

    List home, cd Documents, print path [OK]
Hint: List home first, then cd Documents, then pwd [OK]
Common Mistakes:
  • Changing directory before listing home files
  • Listing wrong folder
  • Printing path before changing directory
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard