Port text review
Read, sort, and count a training port list.
Understand the pattern
Admin work often includes tiny text inventories.
cat- Read one or more files to standard output without editing their contents.
Reading a source file should precede changing it; avoid printing real secrets.
sort- Order lines before comparing or grouping them; -n compares numerically and -r reverses order.
Alphabetical sorting is not numeric sorting.
uniq- Collapse adjacent duplicate lines; use sort first when duplicates are not already together.
uniq does not find every duplicate in an unsorted stream.
wc- Count input. -l counts newline characters, -w counts whitespace-delimited words, and -c counts bytes.
Text without a final newline may have fewer counted lines than visible rows.
tail- Show the end of an input; -n selects the number of lines.
This browser lab snapshots output; it does not keep a live tail -f stream.
Worked example and expected result
$ cat data/ports.txt | sort | uniq22 23 443 80
Exit status: 0. The command completed successfully in the training fixture.
$ wc -l data/ports.txt5 data/ports.txt
Exit status: 0. The command completed successfully in the training fixture.
$ tail -n 3 data/ports.txt443 23 22
Exit status: 0. The command completed successfully in the training fixture.
Explain it
Apply it elsewhere
Keep the momentum.
Complete the lab, then explain and apply the pattern.
Next: Config text compareTry an incident drillAnonymous lesson and mastery progress lasts for this session. Sign in to keep synced lesson XP between sessions; mastery stays device-local. No speed bonus, lost lives, or hint penalties.