Capstone · 10 min read · Beginner
Linux Capstone: Log Analyzer Script
Combine strict Bash, pipes, grep, awk, and functions to summarize server access logs.
What you'll learn
- Parse structured log lines using awk and sort | uniq -c
- Write a reusable Bash function with local variables
- Prepare for the Linux CLI Final Exam and Certificate
In this capstone, you will write a compact Linux Log Analyzer that counts HTTP status codes from access logs using awk, sort, and uniq -c.
Fill-in-the-Blank Capstone
Count Unique Status Codes
Sort status codes and count occurrences with uniq -c.
awk '{print $2}' access.log | | -cCapstone Bash Lab
Bashlog_analyzer.sh
Expected OutputClick “Run Live” to compile with GNU Bash
Status summary: HTTP 200: 3 req(s) HTTP 404: 2 req(s)
Check Your Understanding
Score: 0 / 1
1. Why must you pipe through sort before running uniq -c?
Study Workspace
Finished this lesson?
Your progress is saved locally in your browser, no account needed.