terminal.cab
No.
25
Date
Learning goal
Terminal Start, lesson 11
Level
3 of 3

Command of the day No. 25: sort | uniq -c | sort -rn

Purpose: Counts how often each line occurs, most common first.

Syntax: sort file | uniq -c | sort -rn

Example:

sort visitors.txt | uniq -c | sort -rn
      3 anna
      2 ben
      1 carla

Output from the simulator, as on a real Linux.

Options:

Try it in the terminal Share image

Fills in the command. Nothing runs until you press Enter.

Command of the day No. 25: sort | uniq -c | sort -rn. Purpose: Counts how often each line occurs, most common first. Example: sort visitors.txt | uniq -c | sort -rn. Remember: uniq only sees neighbors, so always sort first.
The same card as an image, 1080 x 1350 pixels.

Today's card ยท All cards so far