Linux command
iotop 命令
安全
权限或系统影响较大,执行前请核对目标。
常用示例
Start iotop
sudo iotop
Show only processes doing I/O
sudo iotop -o
Show accumulated I/O
sudo iotop -a
Don't show threads
sudo iotop -P
Non-interactive mode
sudo iotop -b -n [10]
Monitor specific process
sudo iotop -p [PID]
Monitor specific user
sudo iotop -u [username]
Update every N seconds
sudo iotop -d [2]
说明
iotop is a top-like utility for monitoring disk I/O usage by processes in real-time. It displays a live view of read/write operations per process, helping identify which applications are causing disk activity. The display shows columns for thread/process ID, priority, user, disk read rate, disk write rate, swap-in percentage, I/O percentage, and command. The I/O percentage indicates time spent waiting for I/O operations. Accumulated mode (-a) is useful for finding processes that perform sporadic but significant I/O. Instead of showing instantaneous bandwidth, it shows total bytes read/written since iotop started, revealing processes that did heavy I/O even briefly. The tool requires root privileges to access I/O accounting data from the kernel's taskstats interface. The kernel must have CONFIG_TASK_IO_ACCOUNTING enabled (most distributions include this). Batch mode enables logging I/O activity over time. Combined with -t for timestamps, it can diagnose intermittent I/O issues by capturing activity during problem periods.
参数
- -o, --only
- Show only processes actually doing I/O.
- -a, --accumulated
- Show accumulated I/O instead of bandwidth.
- -P, --processes
- Show processes only, not threads.
- -b, --batch
- Non-interactive batch mode (for logging).
- -n _NUM_
- Number of iterations before exiting.
- -d _SEC_
- Delay between updates in seconds.
- -p _PID_
- Monitor specific process(es).
- -u _USER_
- Monitor processes for specific user(s).
- -k, --kilobytes
- Use kilobytes instead of human-readable.
- -t, --time
- Add timestamp to each line (batch mode).
- -q, --quiet
- Suppress header lines (batch mode). Use twice to suppress column names too.
- --no-help
- Suppress interactive help line.
FAQ
What is the iotop command used for?
iotop is a top-like utility for monitoring disk I/O usage by processes in real-time. It displays a live view of read/write operations per process, helping identify which applications are causing disk activity. The display shows columns for thread/process ID, priority, user, disk read rate, disk write rate, swap-in percentage, I/O percentage, and command. The I/O percentage indicates time spent waiting for I/O operations. Accumulated mode (-a) is useful for finding processes that perform sporadic but significant I/O. Instead of showing instantaneous bandwidth, it shows total bytes read/written since iotop started, revealing processes that did heavy I/O even briefly. The tool requires root privileges to access I/O accounting data from the kernel's taskstats interface. The kernel must have CONFIG_TASK_IO_ACCOUNTING enabled (most distributions include this). Batch mode enables logging I/O activity over time. Combined with -t for timestamps, it can diagnose intermittent I/O issues by capturing activity during problem periods.
How do I run a basic iotop example?
Run `sudo iotop` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -o, --only do in iotop?
Show only processes actually doing I/O.