0
0
Linux CLIscripting~20 mins

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

Choose your learning style9 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.