iotop Command

The iotop command is a free and open-source utility for Linux that provides a real-time overview of disk I/O activity. It displays a table of processes or threads along with their current disk read/write speeds, similar to how top monitors CPU usage.

Syntax

iotop [OPTIONS]

Description

iotop is particularly useful for identifying which processes are causing high disk load, which can help in diagnosing performance issues on a system. It requires root privileges to run effectively as it needs to access kernel I/O statistics.

Key features of iotop:

  • Real-time monitoring of disk I/O.
  • Displays I/O usage per process or thread.
  • Shows total disk read/write speeds.
  • Can filter output to show only active processes.
  • Provides a clear, interactive interface.

Common Options

Option Description
-o, --only Only show processes or threads actually doing I/O.
-b, --batch Non-interactive mode. Useful for scripting.
-n <num> Number of iterations before exiting (in batch mode).
-d <delay> Delay between updates in seconds (can be float).
-p <pid> Monitor specific process ID(s).
-u <user> Monitor I/O for processes owned by a specific user.
-a, --accumulated Show accumulated I/O instead of current I/O.

Examples

Monitor real-time disk I/O

sudo iotop

Starts iotop in interactive mode, showing all processes with their I/O usage.

Show only processes with I/O activity

sudo iotop -o

Filters the display to show only processes that are actively performing disk I/O.

Batch mode with 3 updates, 2 seconds apart

sudo iotop -b -n 3 -d 2

Runs iotop in non-interactive mode, taking 3 snapshots with a 2-second delay between them.

Show accumulated I/O for active processes

sudo iotop -ao

Displays the total accumulated I/O for processes that have performed I/O since iotop started.

Monitor I/O for a specific user

sudo iotop -u www-data

Monitors disk I/O activity for processes owned by the www-data user.

See also