0
0
Linux CLIscripting~20 mins

First Linux commands in Linux CLI - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Linux Command Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
What is the output of the ls command?
You run the ls command in a directory containing three files: file1.txt, file2.txt, and script.sh. What will the command output?
Linux CLI
ls
A
file1.txt
file2.txt
script.sh
BNo output
Cfile1.txt,file2.txt,script.sh
Dfile1.txt file2.txt script.sh
Attempts:
2 left
💡 Hint
The ls command lists files separated by spaces in multi-column format by default.
💻 Command Output
intermediate
2:00remaining
What does the pwd command output?
You are currently inside the directory /home/user/documents. What will the pwd command output?
Linux CLI
pwd
A/home/user/documents
Bdocuments
Cuser/documents
D/home/user
Attempts:
2 left
💡 Hint
The pwd command shows the full path of the current directory.
💻 Command Output
advanced
2:00remaining
What is the output of the echo $HOME command?
Assuming your home directory is /home/alex, what will the command echo $HOME output?
Linux CLI
echo $HOME
A$HOME
Bhome/alex
C/home/alex
DError: variable not found
Attempts:
2 left
💡 Hint
The $HOME variable stores the path to your home directory.
💻 Command Output
advanced
2:00remaining
What error does this command produce?
You run the command cd /nonexistentfolder. What error message will you see?
Linux CLI
cd /nonexistentfolder
Abash: cd: /nonexistentfolder: No such file or directory
Bcd: command not found
CPermission denied
DNo output, command succeeds
Attempts:
2 left
💡 Hint
The folder does not exist, so cd cannot change to it.
💻 Command Output
expert
3:00remaining
How many files are listed by this command?
You run ls -l | grep '^-' | wc -l in a directory. What does this command count?
Linux CLI
ls -l | grep '^-' | wc -l
AThe number of directories in the directory
BThe number of regular files in the directory
CThe total number of files and directories
DThe number of symbolic links
Attempts:
2 left
💡 Hint
The ls -l output starts lines with - for files and d for directories.