0
0
Linux CLIscripting~20 mins

Command structure (command, options, arguments) in Linux CLI - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Command Structure Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
1:30remaining
What is the output of this command?
Consider the command: ls -l /tmp. What does the -l option do?
Linux CLI
ls -l /tmp
AChanges directory to /tmp
BLists only the names of files in /tmp without any details
CDeletes all files in /tmp directory
DLists files in /tmp with detailed information like permissions, owner, size, and modification date
Attempts:
2 left
💡 Hint
The -l option in ls stands for 'long listing format'.
💻 Command Output
intermediate
1:30remaining
What is the output of this command with arguments?
What will the command grep -i 'hello' file.txt do?
Linux CLI
grep -i 'hello' file.txt
ASearches for the word 'hello' in file.txt ignoring case and prints matching lines
BDeletes all lines containing 'hello' in file.txt
CSearches for 'hello' only if it is lowercase in file.txt
DPrints the number of lines in file.txt
Attempts:
2 left
💡 Hint
The -i option makes the search case-insensitive.
📝 Syntax
advanced
1:30remaining
Identify the syntax error in this command
Which option shows a command with a syntax error?
Amv file1.txt file2.txt
Brm -f
Ccp -r source_dir destination_dir
Dls -l /home/user
Attempts:
2 left
💡 Hint
The rm -f command requires at least one file or directory argument.
🚀 Application
advanced
2:00remaining
Which command correctly copies all .txt files from one directory to another?
You want to copy all files ending with .txt from /source to /backup. Which command does this correctly?
Acp /source/*.txt
Bcp /source/ /backup/*.txt
Ccp /source/*.txt /backup/
Dcp -r /source/*.txt /backup/
Attempts:
2 left
💡 Hint
The wildcard *.txt selects all text files in the source directory.
🧠 Conceptual
expert
1:30remaining
What is the role of options in command structure?
In the command structure command [options] [arguments], what is the main purpose of options?
ATo modify the behavior of the command without specifying the target files or data
BTo execute multiple commands at once
CTo specify the files or directories the command will act upon
DTo display the command's version information only
Attempts:
2 left
💡 Hint
Options usually start with a dash (-) and change how the command works.