Count occurrences of adjacent duplicate lines.
Section: sort and uniq
Count duplicate lines
bash
bash
sort access.log | uniq -cExplanation
Remember that `uniq` only collapses adjacent duplicates, so sorting first is common.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing sort and uniq