0
0
Linux CLIscripting~10 mins

sort and uniq in Linux CLI - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete 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'
Anames.txt
B-r
C-u
Dnames
Attempts:
3 left
💡 Hint
Common Mistakes
Using options like -r or -u without the filename.
Typing the filename incorrectly.
2fill in blank
medium

Complete 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'
A-r
B-d
C-c
D-u
Attempts:
3 left
💡 Hint
Common Mistakes
Using -d which shows only duplicate lines.
Using -c which counts duplicates but does not remove them.
3fill in blank
hard

Fix 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'
A-d
B-u
C-r
D-c
Attempts:
3 left
💡 Hint
Common Mistakes
Placing options after the filename.
Using -u with sort which is invalid.
4fill in blank
hard

Fill 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'
A-f
B-c
C-i
D-u
Attempts:
3 left
💡 Hint
Common Mistakes
Using -i with uniq which is invalid.
Confusing -c with -u in uniq.
5fill in blank
hard

Fill 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'
A-n
B-c
C-r
D-u
Attempts:
3 left
💡 Hint
Common Mistakes
Using -u with uniq when counting is needed.
Forgetting to sort numerically.