dstat
Monitor system resource statistics
TLDR
Display CPU, disk, net, paging and system statistics
Display statistics every 5 seconds and 4 updates only
Display CPU and memory statistics only
List all available dstat plugins
Display the process using the most memory and most CPU
Display battery percentage and remaining battery time
SYNOPSIS
dstat [options] [delay [count]]
PARAMETERS
delay
The delay in seconds between each update. If not specified, defaults to 1 second. Can be a float (e.g., 0.5).
count
The number of updates to display before dstat exits. If not specified, dstat runs indefinitely until interrupted.
-c
Enables CPU statistics (user, system, idle, wait, steal, guest).
-d
Enables disk I/O statistics (read/write, requests).
-n
Enables network statistics (receive/send).
-g
Enables page statistics (page-in/page-out).
-l
Enables load average statistics.
-m
Enables memory statistics (used, buffer, cache, free).
-p
Enables process statistics (running, blocked, new processes).
-s
Enables swap statistics (used, free).
-t
Shows time/date column.
-f
Shows full detail for disk and network, instead of aggregated totals.
-D <device>[,<device>...]
Includes specific disk devices in the output (e.g., -D sda,sdb).
-N <interface>[,<interface>...]
Includes specific network interfaces in the output (e.g., -N eth0,lo).
--output <file>
Writes all output to a CSV or JSON file instead of the console. The format is determined by the file extension (.csv or .json).
--list
Lists all available plugins that can be used with dstat.
--plugin <plugin_name>
Activates a specific plugin (e.g., --plugin tcp,socket).
DESCRIPTION
dstat is a powerful and versatile command-line tool designed for generating real-time system resource statistics. It uniquely consolidates information typically provided by disparate tools like vmstat, iostat, netstat, and ifstat into a single, comprehensive output stream. This integrated approach eliminates the need to run multiple commands simultaneously, significantly simplifying system monitoring and analysis.
dstat provides immediate insights into critical metrics such as CPU utilization, disk I/O, network traffic, memory usage, paging activity, and various other system statistics. Its columnar output is highly readable and extensively configurable, empowering users to tailor the displayed information precisely to their specific needs. Written in Python, it boasts a flexible plugin architecture, allowing for easy extensibility to monitor custom or application-specific metrics. It is an invaluable tool for performance analysis, troubleshooting bottlenecks, and gaining a deeper understanding of system behavior under various loads.
CAVEATS
While powerful, dstat can consume system resources itself, especially if many plugins are enabled or the update frequency is very high. Its output, when not filtered, can be overwhelming due to the sheer volume of metrics. dstat relies on Linux kernel interfaces (primarily /proc and sysfs), making it largely Linux-specific and not directly portable to other Unix-like systems without compatibility layers. For comprehensive system-wide monitoring, it often requires root privileges or execution with sudo to access all necessary statistics, particularly for network and process details.
<I>PLUGIN ARCHITECTURE</I>
The true power of dstat lies in its sophisticated Python-based plugin system. This architecture allows users to easily extend dstat's capabilities by writing custom plugins. These plugins can monitor specific applications, databases, custom hardware metrics, or any other data source not covered by default. This makes dstat incredibly adaptable and flexible for diverse and highly specialized monitoring scenarios, moving beyond generic system metrics.
<I>OUTPUT FORMATS</I>
Beyond its default human-readable terminal output, dstat offers robust options for exporting data. It can write all collected statistics directly to comma-separated values (CSV) or JavaScript Object Notation (JSON) files. This functionality is invaluable for scripting automation, performing offline data analysis, and integrating dstat's rich dataset with other monitoring dashboards, graphing tools, or log management systems for long-term trending and historical analysis.
<I>TYPICAL USE CASES</I>
dstat is commonly employed during system troubleshooting to quickly identify bottlenecks (e.g., high CPU wait times, excessive disk I/O, network saturation, memory leaks). It's also widely used during performance testing to observe real-time resource consumption patterns and validate system behavior under stress. Furthermore, it serves as an excellent tool for quick system health checks and for gaining an immediate, comprehensive overview of an active Linux system's state, making it indispensable for interactive diagnostics.
HISTORY
dstat was created by Dag Wieƫrs, primarily to overcome limitations and combine features of existing system monitoring tools like vmstat, iostat, and netstat. The motivation was to provide a more comprehensive, human-readable, and flexible real-time monitoring solution within a single command. Its development began in the early 2000s, with a strong emphasis on ease of use and extensibility through its Python-based plugin system. It quickly gained popularity among Linux administrators and performance engineers due to its consolidated output and user-friendly interface, becoming a staple troubleshooting tool. Continuous development ensures it adapts to evolving Linux kernel metrics and system architectures, maintaining its relevance in modern system diagnostics.
SEE ALSO
vmstat(8): Report virtual memory statistics., iostat(1): Report CPU utilization and I/O statistics for devices., netstat(8): Print network connections, routing tables, interface statistics. (Often superseded by ss(8) or ip(8)), sar(1): Collect, report, or save system activity information., mpstat(1): Report per-processor or per-CPU utilization., top(1): Display Linux processes., htop(1): Interactive process viewer.