Challenge - 5 Problems
Linux Text Processing Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
What is the output of this command pipeline?
Consider the following Linux command pipeline that processes a text file named
What does this command output?
data.txt:cat data.txt | grep -i 'error' | sort | uniq -cWhat does this command output?
Linux CLI
cat data.txt | grep -i 'error' | sort | uniq -cAttempts:
2 left
💡 Hint
Think about what each command in the pipeline does:
grep filters lines, sort orders them, and uniq -c counts duplicates.✗ Incorrect
The pipeline first filters lines containing 'error' ignoring case, then sorts them alphabetically, and finally counts how many times each unique line appears.
🧠 Conceptual
intermediate1:30remaining
Why is text processing considered Linux's superpower?
Which of the following best explains why text processing tools are considered a superpower in Linux?
Attempts:
2 left
💡 Hint
Think about how Linux uses text files in daily system tasks.
✗ Incorrect
Linux relies heavily on text files for configs, logs, and inter-process communication, so powerful text processing tools enable efficient automation and problem-solving.
🔧 Debug
advanced2:00remaining
Identify the error in this text processing command
The user wants to extract all lines containing the word 'fail' (case-insensitive) from
But the output file
log.txt and save unique lines sorted by frequency descending. They run:grep 'fail' log.txt | sort | uniq -c | sort -nr > result.txtBut the output file
result.txt is empty. What is the most likely reason?Linux CLI
grep 'fail' log.txt | sort | uniq -c | sort -nr > result.txtAttempts:
2 left
💡 Hint
Check if the grep command matches all case variations of 'fail'.
✗ Incorrect
The grep command without -i is case-sensitive, so it misses lines with uppercase letters, resulting in no matches and an empty output file.
📝 Syntax
advanced1:30remaining
Which command correctly extracts the third column from a CSV file?
Given a CSV file
data.csv with comma-separated values, which command correctly extracts the third column?Attempts:
2 left
💡 Hint
Remember to specify the correct delimiter for CSV files.
✗ Incorrect
The cut command needs the delimiter specified as comma (-d ',') to extract the third field (-f 3). Without -d or with wrong delimiter, it won't work correctly.
🚀 Application
expert3:00remaining
Create a one-liner to find the top 3 most common words in a text file
Which of the following Linux command pipelines correctly finds the top 3 most common words in
file.txt, ignoring case and punctuation?Attempts:
2 left
💡 Hint
Consider how to split words, normalize case, and count frequencies.
✗ Incorrect
Option A uses tr to replace non-letters with newlines, converts uppercase to lowercase, sorts, counts unique words, sorts numerically descending, and shows top 3. This correctly handles punctuation and case.