iotop
Monitor disk I/O usage by process
TLDR
Start top-like I/O monitor
Show only processes or threads actually doing I/O
Show I/O usage in non-interactive mode
Show only I/O usage of processes (default is to show all threads)
Show I/O usage of given PID(s)
Show I/O usage of a given user
Show accumulated I/O instead of bandwidth
SYNOPSIS
iotop [OPTIONS]
PARAMETERS
-o, --only
Only show processes or threads that are actually doing I/O, instead of all processes/threads.
-b, --batch
Non-interactive mode. Print the output and exit. Useful for scripting or logging.
-n NUM, --iter=NUM
Number of iterations to print in batch mode before exiting. Requires -b.
-d SEC, --delay=SEC
Delay between updates in seconds (can be a float).
-p PID, --pid=PID
Monitor specific process ID(s). Multiple PIDs can be comma-separated.
-u USER, --user=USER
Monitor I/O for processes owned by specific user(s). Multiple users can be comma-separated.
-P, --processes
Show only processes, not all threads. This aggregates I/O for all threads of a process.
-a, --accumulated
Show accumulated I/O since iotop started, rather than current rates.
-k, --kilobytes
Use kilobytes as the unit for I/O rates instead of automatically chosen units (e.g., KB, MB, GB).
-t, --time
Add a timestamp to each line in batch mode output.
-q, --quiet
Suppress some header lines in batch mode. Can be specified up to three times (e.g., -qqq) for increasingly quiet output.
-B, --background
Run iotop in the background. Requires -n.
-r, --raw
Use raw bytes for I/O rates (disables automatic unit scaling).
-c, --comm
Show the command name (executable path) instead of the process command line.
-m, --merged
Merge I/O for multiple devices to a single value per process.
--version
Show program's version number and exit.
-h, --help
Show a help message and exit.
DESCRIPTION
iotop is a free top-like utility for monitoring disk I/O activity on Linux systems. It provides a real-time, interactive view of which processes or threads are actively performing disk reads and writes, and at what rates. By utilizing the Linux kernel's taskstats interface and netlink protocol, iotop collects and displays per-process I/O statistics, including total disk read/write bandwidth usage, and individual read/write rates for each process or thread.
This tool is invaluable for system administrators and developers alike to identify I/O bottlenecks, diagnose slow system performance caused by excessive disk activity, or pinpoint specific applications or users consuming disproportionate I/O resources. It can operate in interactive mode, similar to top, updating regularly, or in batch mode for logging purposes. It typically requires root privileges to access the necessary kernel information.
CAVEATS
iotop primarily relies on the Linux kernel's taskstats interface, which means it requires a relatively recent kernel version (2.6.20 or newer, though better support is in 2.6.32+). It typically requires root privileges or the CAP_SYS_ADMIN capability to access the necessary kernel data. The I/O reported is primarily disk I/O, not network I/O. While iotop can identify processes causing high I/O, it does not detail which specific files are being accessed, requiring other tools like lsof for that information.
INTERACTIVE KEYS
When running in interactive mode (default), iotop responds to several key presses:
r: Toggle reverse sort order.
o: Toggle --only (show only processes with I/O).
p: Toggle --processes (show processes only, not threads).
a: Toggle --accumulated (show accumulated I/O).
k: Toggle --kilobytes (use kilobytes as units).
i: Change I/O priority for a selected process (requires root and ionice support).
q: Quit iotop.
OUTPUT COLUMNS EXPLAINED
iotop's default interactive display includes several key columns:
TID/PID: The thread or process ID.
USER: The user owning the process.
DISK READ: The current disk read rate for the process.
DISK WRITE: The current disk write rate for the process.
SWAPIN: The percentage of time spent swapping in.
IO%: The percentage of time the process spent doing I/O.
COMMAND: The command line or name of the process.
HISTORY
iotop was developed by Guillaume Chazarain, inspired by the popular top command. It emerged around 2008 as a specialized tool to address the need for real-time, per-process disk I/O monitoring on Linux systems. Its core functionality is built upon the taskstats interface, a Netlink-based API in the Linux kernel that provides aggregated per-task statistics, including disk I/O. This allowed iotop to fill a crucial gap in system monitoring, quickly becoming a go-to utility for diagnosing performance issues related to disk activity.