$
학습 Linux 안내서
ko
XP:0
퀘스트 112Log-Analyst
+260 XP

Advanced Counting & Numeric Sorting (uniq -c & sort -nr)

이 퀘스트를 위한 인터랙티브 터미널 시작→설치 불필요 • 브라우저에서 바로 실행

개념 및 개요

When troubleshooting DDoS attacks, brute force login attempts, or high-traffic API endpoints, sysadmins rely on one classic pipeline composed of sort, uniq -c, and sort -nr.

1. sort access.log: Groups identical lines together (a mandatory prerequisite for uniq).
2. uniq -c: Counts the number of duplicate occurrences for each unique line, prefixing each line with its tally count.
3. sort -nr: Sorts the tally lines numerically (-n) and in reverse (-r) order so the most frequent occurrences appear at the top.
4. head -n 5: Isolates the top 5 most frequent entries.

Analyze access.log to identify top IP traffic. Run the complete pipeline: sort access.log | uniq -c | sort -nr | head -n 5.

명령어 구문 참조

Command / SyntaxDescription
sort access.log | uniq -c | sort -nr | head -n 5Count frequency and sort top 5 occurrences

검증 목표

  • ○
    Run frequency pipeline "sort access.log | uniq -c | sort -nr | head -n 5"

퀘스트를 완료할 준비가 되셨나요? 112?