All Snippets

Linux Performance Triage in 60 Seconds

The first 10 commands to run when a Linux server is slow — CPU, memory, disk, network, and process diagnostics in under a minute.

When a server is on fire, you need a fast, repeatable triage checklist. These 10 commands give you a full picture of CPU, memory, disk I/O, network, and process health in under 60 seconds. Based on Brendan Gregg's USE Method.

The 60-Second Checklist

1. System Load Overview

uptime — are things getting worse?bash
1
uptime

Look at the three load averages (1, 5, 15 minutes). If the 1-minute average is higher than the 15-minute, things are getting worse. Compare to your CPU count (nproc).

2. Kernel Messages

dmesg — hardware or kernel problems?bash
1
dmesg -T | tail -20

Look for OOM kills, disk errors, or hardware faults. The -T flag gives human-readable timestamps.

3. Overall System Stats

vmstat — CPU, memory, I/O at a glancebash
1
vmstat 1 5

Key columns to watch:

ColumnMeaningRed Flag
rProcesses waiting for CPUGreater than CPU count
bProcesses blocked on I/OAny non-zero value
si / soSwap in/outAny non-zero means swapping
usUser CPU %High = app is busy
sySystem CPU %High = kernel overhead
waI/O wait %High = disk bottleneck
stSteal time %High = noisy neighbor (VM/cloud)

4. CPU Usage Per Core

mpstat — is one core pegged?bash
1
mpstat -P ALL 1 3

A single core at 100% while others are idle usually means a single-threaded bottleneck in your app.

5. Top Processes

pidstat — what's eating CPU?bash
1
pidstat 1 3

Use pidstat -d 1 3 for per-process disk I/O, and pidstat -r 1 3 for per-process memory usage.

6. Disk I/O

iostat — which disk is busy?bash
1
iostat -xz 1 3
ColumnRed Flag
%utilAbove 80% means the disk is saturated
awaitAverage I/O latency in ms — high means slow disk
r/s / w/sRead/write operations per second

7. Memory

free — how much memory is actually free?bash
1
free -h
  • available is the real number — it includes reclaimable cache
  • If available is near zero and swap is in use, you're memory-starved

8. Network Connections

ss — connection states and countsbash
1
ss -s

For detailed per-connection info: ss -tunapl. The flags stand for TCP, UDP, numeric, all states, processes, listening — easier to remember as "tuna please".

9. Disk Space

df — any filesystems full?bash
1
df -h

A 100% full / filesystem can cause cascading failures — logs can't write, temp files fail, databases crash. Set up monitoring alerts at 80%.

10. Top (Interactive)

htop — the full picturebash
1
htop
  • Sort by CPU: P, by Memory: M
  • Filter by user: u
  • Tree view: F5

Quick One-Liner for Incident Response

Paste this into the server for a rapid dump:

All-in-one triage scriptbash
1
uptime; echo "---"; dmesg -T | tail -5; echo "---"; vmstat 1 3; echo "---"; free -h; echo "---"; df -h; echo "---"; ss -s

Install Missing Tools

Most of these are pre-installed. If not:

Install sysstat (provides vmstat, mpstat, pidstat, iostat)bash
1
# Debian/Ubuntu
2
sudo apt install -y sysstat
3
 
4
# RHEL/CentOS
5
sudo yum install -y sysstat

For deeper performance analysis, check out Brendan Gregg's Linux Performance Tools — the definitive reference for Linux observability.