Back to commands

Cybersecurity Triage

Read-only

Build a Recent Apt Patch Timeline

You need to prove what package changes happened recently and which command triggered them.

Command

awk '/^(Start-Date|Commandline|Upgrade|End-Date)/ {print}' /var/log/apt/history.log

Before you run this

System impact: Read-only. Low when scoped to the shown target.

When not to use it: Do not assume rotated logs are included; inspect compressed history files if you need older activity.

Expected output

Start dates, command lines, upgrade rows, and end dates from apt history.

System impact

Read-only. Nothing changes. awk filters apt history to the fields useful for patch timelines.

May require elevated permissions on protected paths or service-owned files.

Recovery / rollback: no state is changed.

When to use it

Use during incident response, audit follow-up, or post-maintenance validation.

When not to use it

Do not assume rotated logs are included; inspect compressed history files if you need older activity.

next steps

Related commands

Cybersecurity Triage Read-only

Spot Request Bursts by Minute

Traffic spikes are easier to read when you bucket them by time.

awk '{minute=substr($4,2,17); count[minute]++} END {for (m in count) print count[m], m}' /var/log/nginx/access.log | sort -nr | head
Cybersecurity Triage Read-only

Find the IPs Creating the Most 4xx Noise

One address can turn a normal access log into a wall of failed requests.

awk '$9 ~ /^4/ {count[$1]++} END {for (ip in count) print count[ip], ip}' /var/log/nginx/access.log | sort -nr | head
Cybersecurity Triage Read-only

Find Clients Repeating the Same Path

The suspicious pattern is sometimes one client hammering one URL.

awk '{key=$1 " " $7; count[key]++} END {for (k in count) if (count[k] >= 5) print count[k], k}' /var/log/nginx/access.log | sort -nr | head
Cybersecurity Triage Read-only

Find Paths Repeatedly Returning 404

One missing URL is normal. A repeated missing URL is a signal.

awk '$9==404 {count[$7]++} END {for (path in count) if (count[path] >= 3) print count[path], path}' /var/log/nginx/access.log | sort -nr | head
Cybersecurity Triage Read-only

Count the Most Common User Agents

A strange traffic spike often has a strange user agent.

awk -F'"' '{print $6}' /var/log/nginx/access.log | sort | uniq -c | sort -nr | head
Study mapping

Use this as independent command practice: read the notes, predict the output, then compare it with the example before using a real shell.

  • LPIC-1 style command-line practice
  • LFCS style performance-task practice
  • Linux+ style troubleshooting review

Independent study support only. No affiliation, endorsement, exam dumps, or real exam questions.