Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to sort the contents of a file named names.txt.
Linux CLI
sort [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using options like -r or -u without the filename.
Typing the filename incorrectly.
✗ Incorrect
The
sort command followed by the filename sorts the file contents alphabetically.2fill in blank
mediumComplete the code to show only lines that appear exactly once from names.txt after sorting.
Linux CLI
sort names.txt | uniq [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using
-d which shows only duplicate lines.Using
-c which counts duplicates but does not remove them.✗ Incorrect
The
uniq -u option shows only lines that appear exactly once.3fill in blank
hardFix the error in the command to sort data.txt in reverse order and remove duplicates.
Linux CLI
sort [1] data.txt | uniq Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Placing options after the filename.
Using
-u with sort which is invalid.✗ Incorrect
The
-r option sorts in reverse order. It must come before the filename.4fill in blank
hardFill both blanks to create a command that sorts list.txt ignoring case and shows only lines that appear exactly once.
Linux CLI
sort [1] list.txt | uniq [2]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using
-i with uniq which is invalid.Confusing
-c with -u in uniq.✗ Incorrect
The
-f option makes sort ignore case. The -u option makes uniq show only unique lines.5fill in blank
hardFill all three blanks to create a command that sorts words.txt numerically, removes duplicates, and counts occurrences.
Linux CLI
sort [1] words.txt | uniq [2] | sort [3]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using
-u with uniq when counting is needed.Forgetting to sort numerically.
✗ Incorrect
The first
-n sorts numerically. The -c option with uniq counts occurrences. The last -r sorts the counted lines in reverse order.