Skip to content

Monitor Linux CPU, Memory, Disk, and Process Activity

Admin
October 4, 2026
7 min read
Intermediate
💻 Target OS: Ubuntu 24.04+ / Debian 12+ / RHEL 9+

Before you begin

  • Applies to:Linux hosts where you can sample CPU, memory, devices, and processes with sysstat tools.
  • Where to start:Open a terminal on the affected host while the slowdown is happening.
  • What you need:Have an approved way to install sysstat if it is missing. Record the affected workload and when you start sampling.
Guide tools
Guide tools
0/0 Steps (0%)

When a Linux host feels slow, a single snapshot rarely explains why. A short, repeatable sample of CPU, memory, storage, and process activity can show whether a workload is CPU-bound, waiting on disk, or under memory pressure.

This tutorial uses the sysstat tools: iostat for device activity and pidstat for per-process resource use. The examples collect observations only. Package names and availability vary by distribution.


01

Install sysstat and Confirm the Commands

Setup

Install the distribution’s sysstat package if iostat or pidstat is missing. These examples cover Debian/Ubuntu and Fedora/RHEL family package managers; use your distribution’s approved repository and change process.

Terminal window
# Debian or Ubuntu
sudo apt update
sudo apt install sysstat
# Fedora, RHEL, or compatible distributions
sudo dnf install sysstat
command -v iostat pidstat
❯ Illustrative Output (Results Vary)
/usr/bin/iostat
/usr/bin/pidstat

02

Sample Run Queue, CPU, and Memory

System Snapshot

Record host uptime and memory first, then take five one-second samples with vmstat. In its CPU columns, high id means idle time; consistently low idle time can point to CPU pressure. Nonzero wa can indicate time waiting on I/O, while sustained swap activity deserves closer investigation. Interpret the whole sample rather than one interval.

What you should see · The interval reports show what CPU, memory, and queue activity looked like while the slowdown was happening.

If you see something else · If the sample missed the slowdown, repeat it during the symptom. If storage activity is suspected, continue to Step 3. If a particular process stands out, use Step 4 to inspect it.

Terminal window
uptime
free -h
vmstat 1 5
❯ Illustrative Output (Results Vary)
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
1 0 0 ... ... ... 0 0 2 8 ... ... 12 3 84 1 0

03

Review Per-Device I/O Statistics

Storage Activity

Run extended device statistics for five intervals. Compare devices over the same workload window. Queue depth, throughput, and await can help identify I/O pressure, but their meaning depends on device type and workload; high utilization alone does not prove a disk is the bottleneck.

Terminal window
iostat -xz 1 5
❯ Illustrative Output (Results Vary)
Device r/s w/s rkB/s wkB/s await aqu-sz %util
nvme0n1 ... ... ... ... ... ... ...

04

Attribute Resource Use to Processes

Process Detail

Sample per-process CPU, memory, and I/O counters during the same period as the system-wide checks. The -d option adds I/O statistics and -r adds memory statistics. Use sudo when you need visibility into processes owned by other users.

Terminal window
sudo pidstat -dur 1 5
❯ Illustrative Output (Results Vary)
Linux ...
# Time UID PID %usr %system %CPU Command
... ... ... ... ... ... service-name
Linux terminal showing vmstat, iostat, and pidstat live resource samples

Figure 1: Live CPU, memory, disk, and per-process samples collected with vmstat, iostat, and pidstat.


05

Relate the Metrics to the Symptom

Analysis

Repeat the same commands while the issue is happening and during a healthy period. Note the time, workload, host name, and unusual values. Compare the pattern: busy CPU with a long run queue suggests compute contention; growing swap use can point to memory pressure; elevated I/O wait together with device latency suggests storage needs attention. Confirm findings against application metrics and logs before changing configuration.

Terminal window
hostname
uptime
free -h
vmstat 1 5
iostat -xz 1 5
sudo pidstat -dur 1 5
❯ Illustrative Output (Results Vary)
Keep timestamped samples from comparable workload windows so trends can be compared.

Comments