sudo iotop -o shows you, in real time, which process is doing disk I/O right now and how much. It is top for the disk: a live table sorted by I/O rate, with a read column and a write column per process. This page covers iotop's flags, batch logging and accumulated mode, plus pidstat for a sampled, scriptable per-process trace of CPU, memory, and I/O, and nvtop for the same live view on NVIDIA, AMD, and Intel GPUs.
The -o flag is the one you actually want, because it hides every thread that is not currently doing any I/O, so the screen shows only the culprits instead of a wall of idle kernel threads. And iotop needs root: it reads per-task I/O accounting out of the kernel's taskstats interface over a netlink socket, and that data is privileged, so a plain iotop as a normal user fails with a permission error. Run it with sudo. Everything else is filtering and formatting: collapsing threads into processes, logging to a file instead of a live screen, and showing accumulated totals instead of an instantaneous rate. When you want numbers over time for one known process, or you do not have root, pidstat is the better tool. When the busy device is a graphics card, nvtop does the same job for the GPU.
The one-liner
sudo iotop -oThat opens the interactive view and lists only processes with active disk I/O, refreshing once a second. The columns that matter are DISK READ and DISK WRITE (the current per-process rate, displayed as B/s, K/s, or M/s) and IO> (the percentage of time the process spent waiting on I/O). The two summary lines at the top show Total DISK READ / Total DISK WRITE (actual disk traffic) and Actual DISK READ / Actual DISK WRITE. Those two pairs differ because of the page cache and writeback: a process can "write" into cache faster than the kernel flushes it to the platter, so the totals and the actuals rarely line up exactly.
Inside the live view, press o to toggle the --only filter, r to reverse the sort, a to switch to accumulated mode, and q to quit. left/right arrows move the sort column.
Why -o is the flag you reach for first
Without -o, iotop lists every thread on the system, including the dozens of idle kernel worker threads. On a busy box that is several screens of noise with the one process you care about buried in it.
sudo iotop -o -P-P (--processes) collapses threads into their parent process, so you see one row per process instead of one row per thread. Combined with -o, that is the view I keep open when something is thrashing the disk: only active processes, one line each, sorted by I/O. If you need the thread-level breakdown (say, one thread of a multithreaded daemon is the problem), drop -P and iotop goes back to per-thread rows.
Logging I/O instead of watching it: batch mode
The interactive view is fine when you are at the keyboard. When you want to capture I/O over time, for a slow nightly job or an intermittent spike, use batch mode and redirect to a file.
sudo iotop -boP -d 5 -n 12 > /tmp/io.logThat reads as: -b batch (non-interactive, plain text, no curses), -o only active, -P per-process, -d 5 a five-second delay between samples, -n 12 stop after 12 samples. Twelve samples at five seconds each is one minute of logging, then iotop exits on its own. Add -t to prefix every line with a timestamp, which you want in any log you are going to read later:
sudo iotop -btoP -d 5 -n 12 > /tmp/io.logBatch mode is also how you feed iotop output into anything else: grep for a process name, awk the write column, or pipe it into a quick chart. The curses view cannot do any of that. For recurring capture, drop a bounded batch run into a scheduled cron job (a short -n run appended to a dated log) rather than leaving an interactive session open.
Accumulated totals vs the instantaneous rate
By default each refresh shows the rate over the last interval. Sometimes you do not care about the rate, you care about who has written the most in total since iotop started. That is -a (--accumulated):
sudo iotop -aoPNow the DISK READ and DISK WRITE columns count total bytes since iotop launched, not a per-second rate. This is the mode for catching a process that writes in short bursts: a per-second rate flickers and is easy to miss, but the accumulated total just keeps climbing for the offender and stays flat for everything else. Press a in the interactive view to toggle it live.
A worked example: tracking down a runaway writer
Suppose iostat or a monitoring alert says the disk is pinned at 100% utilization but you do not know which process is responsible. Open the live view:
sudo iotop -oPTotal DISK READ: 0.00 B/s | Total DISK WRITE: 118.42 M/s
Actual DISK READ: 0.00 B/s | Actual DISK WRITE: 121.06 M/s
PID PRIO USER DISK READ DISK WRITE SWAPIN IO> COMMAND
31847 be/4 postgres 0.00 B/s 117.30 M/s 0.00 % 92.14 % postgres: autovacuum worker
2210 be/4 root 0.00 B/s 1.12 M/s 0.00 % 3.01 % rsyslogd
The autovacuum worker is doing 117 MB/s of writes and spending 92% of its time blocked on I/O. That is the answer. The IO> column is the tell: a high percentage there means the process is genuinely I/O-bound, not just incidentally touching the disk. To confirm it is sustained and not a one-second blip, switch to accumulated mode (a) and watch the write total for that PID climb.
Per-process CPU, memory and I/O with pidstat
pidstat reports CPU, memory, and disk I/O broken down by individual process, sampled at a fixed interval: pidstat -u 2 prints per-process CPU every two seconds, pidstat -r 2 memory, pidstat -d 2 disk I/O. It ships in the sysstat package alongside sar, iostat, and mpstat, and it is the tool I reach for when top (or iotop) shows me that the box is busy and I want a clean numeric trace of one process over time.
The reason it beats eyeballing a live view is the interval sampling. Each line is an average over the sampling window, not a single instantaneous reading, so a process that spikes for 200ms every few seconds shows up cleanly instead of flickering past. Unlike iotop it runs without sudo, so the commands below are run as a normal user. CPU and memory figures (-u, -r) come from world-readable /proc files and cover every process; the per-process I/O counters behind -d live in /proc/PID/io, which the kernel guards with a ptrace access check, so without root you only get I/O numbers for your own processes.
Install sysstat
# Debian / Ubuntu
sudo apt install sysstat
# RHEL / Rocky / Alma / Fedora
sudo dnf install sysstat
# Alpine
sudo apk add sysstatpidstat with no arguments prints one block: the CPU usage of every active task since system boot. That is rarely what you want. The interval is what makes the tool. On Debian and Ubuntu the sysstat collector service (sar history) is disabled by default after install; that does not affect pidstat sampling, which works immediately, but sar has no history to show until you enable it in /etc/default/sysstat.
Per-process disk I/O: pidstat -d
pidstat -d 2-d reports I/O statistics (kernels 2.6.20 and later):
07:18:44 UID PID kB_rd/s kB_wr/s kB_ccwr/s iodelay Command
07:18:46 0 338 0.00 1840.00 0.00 7 jbd2/sda1-8
07:18:46 1000 4821 0.00 512.00 0.00 2 node
kB_rd/s and kB_wr/s are read and write throughput per second. iodelay is the time the task was blocked waiting on I/O, measured in clock ticks, and it is the column that tells you whether a process is bottlenecked on disk versus merely doing a lot of I/O comfortably, the same signal as iotop's IO> column. This is the per-process answer that iostat cannot give you: iostat shows the device is busy, pidstat -d shows who is making it busy.
Per-process CPU: pidstat -u
pidstat -u 2-u reports CPU utilization; the 2 is the interval in seconds:
07:14:32 UID PID %usr %system %guest %wait %CPU CPU Command
07:14:34 1000 4821 38.50 2.00 0.00 0.50 40.50 3 node
07:14:34 0 912 0.50 1.50 0.00 0.00 2.00 1 containerd
%usr is time in user space, %system is time in the kernel on this process's behalf, %CPU is the total. The CPU column is which logical core the process was last seen on. %wait is time the task spent runnable but waiting for a core, which is your signal that the box is CPU-saturated rather than the process being slow on its own.
To bound the run, add a count after the interval: pidstat -u 2 5 samples every two seconds, five times, then exits and prints an Average: line summarizing the whole run. Without the count it runs until you press Ctrl+C.
Memory and page faults: pidstat -r
pidstat -r 207:16:10 UID PID minflt/s majflt/s VSZ RSS %MEM Command
07:16:12 1000 4821 142.00 0.00 1284560 398204 4.91 node
RSS (resident set size, in kB) is the real memory the process holds in RAM and is usually the number you care about. VSZ is the virtual size, almost always larger and far less meaningful. majflt/s is major faults per second, meaning the kernel had to hit disk to satisfy the page. A nonzero majflt/s that stays up is a process thrashing against a memory shortfall, and it correlates with the box swapping, which is often why a disk looks busy in iotop in the first place.
Watch one process or one thread: -p and -t
pidstat -u -r -d -p 4821 1That traces CPU, memory, and I/O for PID 4821, once per second, until you stop it. By default, combining the activity flags prints a separate report block for each activity (CPU, then memory, then I/O) at every interval. Add -h (pidstat -h -u -r -d -p 4821 1) to put all three on a single line per sample, which gives you a unified per-second view of one process across all three resources. This is what I leave running in a second terminal while I reproduce a performance problem.
-p takes a comma-separated list (-p 4821,4822), the keyword ALL for every task, or SELF for the pidstat process itself. -p ALL is noisy on a busy host; filter by command name with -C instead, which is treated as a regular expression:
pidstat -u -C nginx 2
pidstat -u -C 'nginx|php-fpm' 2By default pidstat aggregates a process across its threads. To find the one hot thread inside a multithreaded process, add -t:
pidstat -t -u -p 4821 1-t adds TGID (the thread group, i.e. the process) and TID (the individual thread) columns. A row with a TGID and a dash for TID is the process total; rows with a TID are its threads.
pidstat flags at a glance
| Flag | What it reports |
|---|---|
-u | CPU utilization (%usr, %system, %wait, %CPU) |
-r | Memory and page faults (RSS, VSZ, minflt/s, majflt/s) |
-d | Disk I/O (kB_rd/s, kB_wr/s, iodelay) |
-w | Context-switch rate (voluntary and involuntary) |
-p PID | Scope to a PID list, or ALL / SELF |
-t | Break processes down into their threads |
-C comm | Filter to tasks whose command name matches comm (regex) |
-l | Show the full command line, not just the process name |
-h | One line per sample, no Average: block (parser-friendly) |
-h prints everything horizontally with no averages, the form to pipe into awk or a log when you want to chart the output later. pidstat is a sampler, so it is excellent for "watch this process over the next minute" and poor for "what happened five minutes ago"; for after-the-fact analysis use sar (also from sysstat), which records to disk on a schedule and lets you replay any window.
Monitor GPU usage with nvtop
iotop and pidstat stop at the disk and the CPU. When the busy resource is a graphics card, nvtop is the same idea for GPUs: an htop-style ncurses view with a utilization and memory bar per GPU, rolling line plots, and a sortable list of the processes using the GPU. It reads NVIDIA through the proprietary driver, AMD through amdgpu, and Intel through i915/Xe from the same binary, so it answers "what is on the GPU right now" regardless of vendor, where nvidia-smi covers NVIDIA only.
nvtop is read-mostly. It shows live state and lets you sort and signal processes, but it does not change clocks, fan curves, or power limits.
Install and read the nvtop screen
# Debian / Ubuntu (20.04+)
sudo apt install nvtop
# Fedora (36+)
sudo dnf install nvtop
# Arch
sudo pacman -S nvtopOn older Ubuntu where the repo version lags, the maintainer's PPA has newer builds (sudo add-apt-repository ppa:quentiumyt/nvtop, then sudo apt install nvtop). No NVIDIA-specific setup is needed beyond having the driver installed; nvtop links against the driver libraries it finds at runtime, so a box with both an AMD and an NVIDIA card shows both in one view. Run it bare with nvtop. The layout, top to bottom:
- Device header per GPU: name, the utilization bar, the memory bar (VRAM used vs total), temperature, power draw, and fan speed where the driver exposes them. ENC and DEC meters appear only while the video encoder or decoder is in use, then auto-hide.
- Line plots: a rolling history of utilization or memory per GPU, so a spike is visible as a spike.
- Process list: PID, user, the GPU it is on, the type (Graphics or Compute), GPU memory used by that process, and the command.
Memory sizes are in multiples of 1024, matching how the drivers report VRAM, so the totals line up with nvidia-smi.
Sort GPU processes and kill the heaviest one
| Key | Action |
|---|---|
| Up / Down | Move the highlight through the process list |
| Left / Right | Scroll a long command line horizontally |
F6 | Choose the column to sort by (memory, GPU%, PID, …) |
+ / - | Sort ascending / descending |
F9 | Send a signal to the highlighted process |
F2 | Open the setup window |
F12 | Save the current interface options to disk |
F10, q, or Esc | Quit |
When a GPU is saturated: press F6, pick GPU memory or utilization, press - to put the heaviest consumer at the top, highlight it, then F9. F9 opens a signal picker rather than blindly sending SIGKILL, so you can send SIGTERM first and let a training job finish its checkpoint.
nvtop refresh rate and flags
The delay flag is -d (--delay), and the unit is tenths of a second, not seconds:
nvtop -d 5 # refresh every 0.5s
nvtop -d 20 # refresh every 2s
nvtop -C # monochrome, for terminals with a broken palette
nvtop -p # collapse to a single bar plot (max across all GPUs)
nvtop -f # show temperature in Fahrenheit
nvtop -E -1 # keep the ENC/DEC meters always visibleSo -d 10 is one update per second. -E sets the encode/decode auto-hide timer in seconds (default 30); a negative value pins those meters on. Settings changed in the F2 window persist with F12, which writes a config file under ~/.config/nvtop/.
nvtop vs nvidia-smi and the vendor tools
| Tool | Vendors | Live TUI | Per-process | Notes |
|---|---|---|---|---|
nvtop | NVIDIA, AMD, Intel (also Apple, Qualcomm, Huawei, others) | Yes | Yes | One binary across vendors; read-mostly |
nvidia-smi | NVIDIA only | No (snapshot; -l loops) | Yes | Ships with the driver; also sets clocks/power |
nvidia-smi dmon | NVIDIA only | Scrolling text | No | Good for logging to a file |
radeontop | AMD only | Yes | No | No process list |
intel_gpu_top | Intel only | Yes | Partial | Part of intel-gpu-tools |
nvitop | NVIDIA only | Yes | Yes | Richer NVIDIA-only TUI, can also send signals |
I keep nvtop open in a pane next to iotop and use nvidia-smi for scripting and tuning. Caveats worth knowing:
- N/A fields are the driver, not nvtop. Pre-Kepler NVIDIA cards and AMD on old kernels expose fewer metrics.
- Driver coverage varies. NVIDIA needs
libnvml.sofrom the proprietary driver (nouveau is not supported). On AMD the legacyradeondriver exposes far fewer metrics thanamdgpu, and the per-process list needs thefdinfointerface from kernel 5.14; Intel gets it from kernel 5.19 (i915/Xe). On older kernels the process list can come up empty. - It does not log or tune. There is no CSV export; for history, use DCGM exporter into Prometheus or
nvidia-smi --query-gpu=... --format=csv -l. For clocks, fans and power, usenvidia-smi,nvidia-settings, or the AMD equivalents. - Linux-first. Apple Silicon support is limited and there is no native Windows build. On a headless server, run it over SSH inside
tmuxso the view survives a dropped connection.
iotop vs pidstat vs iostat
These three tools overlap but answer different questions. Pick by what you actually need to know.
| Tool | Granularity | Answers | Needs root |
|---|---|---|---|
iotop | per process / per thread | "Which process is doing the I/O right now?" | Yes |
pidstat -d | per process | "Which process, sampled over time, scriptable?" | No for your own processes; yes for other users' I/O |
iostat -x | per device | "Which disk is busy, and how saturated?" | No |
Reach for iotop when you want a live, sorted, interactive view and you are sitting at the terminal. Reach for pidstat -d when you want the same per-process I/O numbers in a clean, columnar, easily-parsed form for a script or a log, or when you do not have root, since pidstat reports I/O for your own processes without it (pidstat section above). Reach for iostat -x when the question is about the device, not the process: queue depth, await time, and utilization per disk.
Caveats and distro differences
It is not installed by default. iotop ships in a package you usually have to add: apt install iotop on Debian and Ubuntu, dnf install iotop on Fedora and RHEL-family systems. Some recent distributions ship iotop-c (a C rewrite of the original Python tool) under the same iotop command name; the common flags shown here behave the same.
It needs a kernel built with task I/O accounting. iotop relies on CONFIG_TASK_DELAY_ACCT, CONFIG_TASKSTATS, and CONFIG_TASK_IO_ACCOUNTING being enabled in the kernel. Every mainstream desktop and server distro enables these, but a stripped-down or embedded kernel might not, in which case iotop starts and shows zeroes for everything. On some kernels delay accounting is off until you enable it with sysctl kernel.task_delayacct=1.
Containers and VMs see only their own view. Inside an unprivileged container iotop may fail on the netlink socket entirely, or only report processes in its own namespace. If you need the host's full I/O picture, run iotop on the host, not inside the container.
The page cache hides the truth, briefly. The gap between Total DISK WRITE and Actual DISK WRITE is the writeback delay. A process can appear to write huge amounts that have not hit the disk yet, or appear idle while the kernel flushes its earlier writes. For the real device-level number, cross-check with iostat -x.
See also
- Find the largest files on a disk: once iotop tells you a process is filling the disk, this is how you find the files it left behind
- duf, a friendlier df: the at-a-glance view of how full each filesystem actually is, for when the I/O culprit is also eating your free space
- nload: live network bandwidth in the terminal and iftop: bandwidth by connection: the network-traffic equivalents, for when a slow transfer turns out to be the wire and not the disk, which neither iotop nor pidstat can see.
FAQ
iotop reads per-task I/O statistics from the kernel's taskstats interface over a netlink socket, and that data is privileged: the kernel requires either root or the CAP_NET_ADMIN capability (the restriction dates to CVE-2011-2494, a cross-user data leak). A normal user without it gets Netlink error: Operation not permitted (1). The normal fix is to run it with sudo iotop. If you genuinely need a non-root invocation, grant the capability on the binary with sudo setcap 'cap_net_admin+eip' $(which iotop), but understand that this then lets any local user read every process's I/O, so sudo is the safer default. The related tool pidstat reports your own processes without any of this.
Plain iotop lists every thread on the system, including the many idle kernel threads, which buries the process you care about. -o (the --only flag) shows only threads and processes that are actually doing disk I/O at that moment, so the screen shows just the active ones. Add -P to collapse threads into one row per process. You can also toggle the only-active filter live by pressing o inside the interactive view.
Use batch mode with -b, which prints plain text instead of the curses screen, and redirect it: sudo iotop -btoP -d 5 -n 12 > /tmp/io.log. There -t adds a timestamp to each line, -o shows only active processes, -P is per-process, -d 5 samples every five seconds, and -n 12 stops after twelve samples. Batch mode is also the only way to pipe iotop into grep, awk, or another tool.
Total DISK WRITE is the rate at which processes are issuing writes, which can land in the page cache rather than on the platter immediately. Actual DISK WRITE is the rate the kernel is actually flushing to the physical device. They differ because of the page cache and writeback: a process can write into cache faster than the disk drains it, so the two numbers rarely match exactly. For the true device-level figure, cross-check with iostat -x.
iotop is not part of the base install on most distributions, so a fresh box prints command not found until you add the package. Install it with sudo apt install iotop on Debian and Ubuntu, or sudo dnf install iotop on Fedora and RHEL-family systems. On several current distros the package name iotop actually pulls in iotop-c, the maintained C rewrite of the original Python tool; the flags on this page (-o, -b, -a, -P, -d) behave the same either way. There is no native iotop on macOS, where sudo fs_usage and Activity Monitor's Disk tab cover the same ground.
Usually the kernel is missing or has disabled I/O accounting. iotop needs CONFIG_TASKSTATS and CONFIG_TASK_IO_ACCOUNTING compiled in, which mainstream distros have, but stripped-down or embedded kernels may not. On some kernels delay accounting is off by default; enable it with sudo sysctl kernel.task_delayacct=1. Inside an unprivileged container iotop may also only see its own namespace, so run it on the host for the full picture.
Use -p with the PID and combine the activity flags. pidstat -u -r -d -p 4821 1 traces CPU, memory, and I/O for PID 4821 once per second until you press Ctrl+C. The -p flag also accepts a comma-separated PID list, the keyword ALL for every task, or SELF for the pidstat process itself. Add -t to break the process into its threads.
pidstat is not part of coreutils, so a minimal install often does not have it. It ships in the sysstat package: sudo apt install sysstat on Debian or Ubuntu, sudo dnf install sysstat on RHEL, Rocky, Alma, or Fedora, and sudo apk add sysstat on Alpine. The same package installs sar, iostat, and mpstat.
Each pidstat line is an average over the whole sampling interval, while top shows the most recent refresh. A short interval like pidstat -u 1 tracks top closely; a longer interval smooths out spikes, so a bursty process can look lower in pidstat because its idle stretches are averaged in. Neither is wrong; they answer slightly different questions.
Highlight the process with the Up and Down arrows, then press F9. nvtop opens a signal picker so you can choose SIGTERM (let it clean up) or SIGKILL (force) rather than blindly killing. To find the offender first, press F6 to choose the sort column (GPU memory or utilization) and - to sort descending.
Tenths of a second, not seconds. nvtop -d 10 updates once per second, nvtop -d 5 twice per second, and nvtop -d 50 every five seconds. Note that iotop's -d is in seconds, so the same number means different things in the two tools.
nvtop reads NVIDIA cards through libnvml.so from the proprietary driver, so nouveau is not supported. On AMD, the legacy radeon driver works but reports far fewer metrics than amdgpu, and the per-process list needs the kernel 5.14 fdinfo interface, so on an old kernel that list can be empty.
Sources
Authoritative references this article was fact-checked against.
- iotop(8) - Linux manual page (man7.org)man7.org
- iotop-c - the maintained C rewrite (GitHub)github.com
- Per-task statistics interface (taskstats) - kernel.org documentationkernel.org
- Why does iotop/taskstats now only work for the root user (Red Hat Customer Portal)access.redhat.com
- pidstat(1) - Linux manual page (man7.org)man7.org
- proc_pid_io(5) - Linux manual page (man7.org)man7.org
- sysstat - the project that ships pidstat (GitHub)github.com
- nvtop - official GitHub repository (supported vendors, install, build)github.com
- nvtop(1) man page source - command-line options and interactive commandsraw.githubusercontent.com





