How to Monitor System Resources Using the dstat Command in Linux

When a massive Linux database server suddenly crawls to a halt, isolating the specific bottleneck is highly complex. If you run vmstat, you only see memory data. If you run iostat, you only see hard drive metrics. If you run ifstat, you only see network traffic. Juggling three different tools simultaneously across multiple terminal windows is impossible during a critical outage. To unify all of this system data into a single, perfectly synchronized, real-time dashboard, you must use the dstat command.

Installing the dstat Package

The dstat tool is essentially a modern, highly advanced replacement for all legacy stat commands combined into one Python script.

To install it on Ubuntu or Debian, run the following command:

sudo apt install dstat

Running a Complete System Diagnostic

To launch a full-spectrum diagnostic scan, simply type the command and press Enter:

dstat

The terminal will instantly begin outputting a continuous, color-coded stream of data, adding a new row every single second. The output is cleanly divided into distinct columns, allowing you to cross-reference multiple hardware subsystems simultaneously:

  • CPU: Displays exactly how much processor power is being consumed by user apps versus the underlying kernel logic.
  • Disk: Displays exactly how many megabytes per second are currently being read from and written to the physical hard drives.
  • Net: Displays the total inbound and outbound network traffic.
  • Paging & System: Displays deep kernel-level data, including how often the server is forced to swap memory to the hard drive, and how many system interrupts are occurring per second.

Because all of this data is perfectly synchronized on a single row, diagnosing bottlenecks is trivial. If you see a massive spike in Network Receive traffic at the exact same second the Disk Write speed flatlines, you instantly know the server’s hard drive is too slow to handle the incoming data stream.

Filtering the Output

If the default dashboard is too chaotic, you can forcefully restrict dstat to only output the specific metrics you care about.

For example, to monitor only the memory consumption and the network traffic, while completely ignoring the CPU and hard drives, run:

dstat -m -n

The -m flag isolates the RAM metrics, and the -n flag isolates the network interfaces, providing a highly focused, distraction-free monitoring environment.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.