Question 280
A Linux administrator faces this situation: A list of hostnames contains repeated lines and an operator needs accurate occurrence counts. Which action best resolves the specific issue while preserving correct system behavior?
Explanation
Correct Answer
Run sort on the list before uniq -c to count identical hostname occurrences. This corrects the case-specific failure. First verify: Inspect whether duplicate entries are adjacent and whether the input is sorted. Then demonstrate success: All occurrences of each hostname contribute to one correct count in the output.
Incorrect Answers
Use tr '[:upper:]' '[:lower:]' in the supported locale for a text stream. That would matter when a stream includes mixed-case letters but downstream comparison requires lowercase text. The relevant distinction in this case is: Run sort on the list before uniq -c to count identical hostname occurrences.
Extract the third field with cut -d: -f3 on the correctly delimited stream. That would matter when an import file has colon-separated fields and only its third field is needed for reporting. It does not address this case's requirement: A list of hostnames contains repeated lines and an operator needs accurate occurrence counts.
Use tail -n 10 on the intended file and tail -f only when live following is required. That would matter when an administrator needs to inspect just the newest ten lines of a growing plain-text log. That separate mechanism does not verify the needed Linux administration outcome in this case.