Operations 7 min read

Master Linux Performance Monitoring with iostat: Installation, Usage, and Advanced Tips

This guide explains how to install the iostat tool on various Linux distributions, demonstrates basic and advanced commands for monitoring disk I/O and CPU usage, interprets its output columns, and shows how to customize, redirect, and remotely collect performance data.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Master Linux Performance Monitoring with iostat: Installation, Usage, and Advanced Tips

Installation

Most Linux distributions include iostat via the sysstat package; if it is missing, install it with the appropriate package manager.

sudo apt-get install sysstat
sudo yum install sysstat

Basic Usage

1 View overall disk and CPU statistics

Run iostat to display average CPU utilization and per‑disk I/O activity.

iostat

2 Specify interval and count

Use -t to set the reporting interval in seconds and -c to set the number of reports.

iostat -t 2 5

Understanding iostat output

The output contains several columns, including:

avg-cpu : average CPU usage statistics (user, system, idle).

Device : name of the disk device.

tps : transfers per second, i.e., number of I/O operations per second.

kB_read/s : kilobytes read per second.

kB_wrtn/s : kilobytes written per second.

%util : percentage of time the device was busy.

Example Commands

1 Monitor disk I/O

iostat -d -t 2 10

This displays disk I/O statistics every 2 seconds, for a total of 10 reports.

2 Monitor CPU utilization

iostat -c -t 2 10

This shows CPU utilization every 2 seconds, for 10 reports.

Advanced Usage

1 Monitor specific partition

iostat -p /dev/sda1 -t 2 10

Monitors the I/O of the /dev/sda1 partition every 2 seconds, 10 times.

2 Custom output format (CSV)

iostat -c -o CSV -t 2 10

Outputs CPU statistics in comma‑separated values.

3 Redirect output to a file

iostat -d -t 2 10 > iostat_output.txt

Saves the disk I/O statistics to iostat_output.txt for later analysis.

4 Monitor network devices

iostat -n -t 2 10

Shows network interface statistics every 2 seconds, 10 times.

5 Remote monitoring

iostat -d -t -h remote_host

Connects to remote_host and monitors its disk I/O.

6 Show block devices

iostat -k -t 2 10

Displays I/O statistics for block devices every 2 seconds, 10 times.

7 Select specific columns

iostat -x -t 2 10

Shows only the chosen columns (e.g., device, transfer rate, utilization) every 2 seconds, 10 times.

Conclusion

iostat is a powerful utility for tracking disk I/O and CPU performance, making it valuable for troubleshooting, performance tuning, and overall system health monitoring.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

linuxcommand-lineiostat
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.