A modern, high-performance Rust implementation of iotop - a tool to monitor I/O usage of processes on Linux.
Install directly from crates.io:
cargo install iotopClone and build from source:
git clone https://github.com/AndPuQing/iotop.git
cd iotop
cargo build --releaseThe binary will be available at ./target/release/iotop.
cargo build --release
sudo cp target/release/iotop /usr/local/bin/
sudo cp doc/iotop.8 /usr/share/man/man8/
sudo mandb # Update man page databasecargo install --path . --root /usr/local
sudo cp doc/iotop.8 /usr/share/man/man8/
sudo mandbiotop requires root privileges to access the kernel's taskstats interface. You have two options:
sudo iotop# Allow iotop to run without sudo by granting the required capability
sudo setcap cap_net_admin+eip /usr/local/bin/iotop
# Now you can run without sudo
iotopFor full functionality (SWAPIN and IO columns), enable kernel delay accounting:
# Temporary (until reboot)
sudo sysctl -w kernel.task_delayacct=1
# Permanent (survives reboot)
echo "kernel.task_delayacct = 1" | sudo tee -a /etc/sysctl.conf
sudo sysctl -pRun interactively:
sudo iotopShow only processes doing I/O:
sudo iotop -oRun in batch mode (5 iterations, 2 second delay):
sudo iotop -b -n 5 -d 2Monitor specific process:
sudo iotop -p 1234Monitor user's processes:
sudo iotop -u www-dataFilter by command-line regex:
sudo iotop -c bash
sudo iotop -c '^sshd' -c 'nginx.*worker'Batch mode with timestamps:
sudo iotop -t -b -n 10 > iotop.logMachine-readable output for scripts / monitoring (JSON and CSV both imply --batch):
One JSON object per iteration, with the total/actual disk I/O and the process list:
sudo iotop -b --json -n 1CSV rows (header printed unless -q; add a leading time column with -t):
sudo iotop -b --csv -n 5
sudo iotop -b --csv -t -q -n 5| Option | Long Form | Description |
|---|---|---|
-o |
--only |
Only show processes or threads actually doing I/O |
-P |
--processes |
Show processes instead of all threads |
-a |
--accumulated |
Show accumulated I/O instead of bandwidth |
-d |
--delay |
Delay between iterations in seconds [default: 1.0] |
-n |
--iterations |
Number of iterations before ending (infinite if not specified) |
-b |
--batch |
Batch mode (non-interactive) |
-p |
--pid |
Monitor specific processes/threads (can be repeated) |
-u |
--user |
Monitor processes by username or UID (can be repeated) |
-c |
--command |
Only show processes whose command line matches the regex (can be repeated) |
-t |
--time |
Add timestamp on each line (implies --batch) |
-q |
--quiet |
Suppress column names and headers (implies --batch) |
-k |
--kilobytes |
Use kilobytes instead of human-friendly units |
--json |
Output one JSON object per iteration (implies --batch) |
|
--csv |
Output CSV rows (implies --batch) |
When running in interactive mode (default), you can use the following keyboard shortcuts:
| Key | Action |
|---|---|
q / Q / Ctrl+C |
Quit the program |
o / O |
Toggle showing only processes doing I/O |
a / A |
Toggle between bandwidth and accumulated I/O |
p / P |
Toggle between showing processes and threads |
r / R |
Reverse the current sort order |
k / K |
Toggle KB units (also enabled by -k at startup) |
c / C |
Enter/exit column-selection mode (see below) |
Space |
Pause/resume display updates (toggle column in column mode) |
Left / Right |
Cycle through sort columns (move cursor in column mode) |
Up / Down |
Scroll through process list |
PageUp / PageDown |
Scroll by 10 rows |
Home |
Jump to first sort column (or first row with Ctrl) |
End |
Jump to last sort column (or last row with Ctrl) |
Mouse wheel scrolling is also supported for navigating the process list.
Press c to enter column-selection mode. The top bar shows every available column;
Left / Right move the cursor, Space toggles the selected column on/off, and
Esc or c exits. Hidden columns are shown dimmed with ~ markers. The last
remaining visible column cannot be hidden.
This implementation uses:
- Netlink Taskstats: Interfaces with the Linux kernel's taskstats interface via netlink sockets
- Procfs: Reads process information from
/procfilesystem - Async/Await: Tokio-based async runtime for concurrent data collection
- TUI Framework: Crossterm + Ratatui for terminal rendering
Run the project in development mode:
# Build and run
cargo run -- [options]
# Build in release mode
cargo build --release
# Run tests
cargo test
# Check for issues
cargo clippy
# Format code
cargo fmt
# Run with custom options
cargo run -- -o -d 2MIT License - See LICENSE file for details.
- Original Python implementation: http://guichaz.free.fr/iotop/
- C version by Tomas M: https://github.com/Tomas-M/iotop
- Linux Taskstats documentation: https://www.kernel.org/doc/Documentation/accounting/taskstats.txt
Contributions are welcome! This is an ongoing migration project. Areas for contribution include:
- Additional test coverage
- Performance optimizations
- Documentation improvements
- Bug fixes and feature requests
Please open an issue or pull request on GitHub.
