nvidia-htop is a lightweight Bash utility that provides an htop-style overview of GPU processes, showing the GPU index, PID, username, and command name for each active NVIDIA process — followed by the standard nvidia-smi summary.
It’s designed for users without root access and integrates cleanly into your shell environment.
- Displays a clean ASCII table of GPU → PID → USER → COMMAND mappings.
- Works with both CUDA compute and graphics (PMON) processes.
- Shows command name.
- Automatically falls back if
/procor NVML info is missing. - No sudo required.
- Works perfectly with
watchfor live monitoring.
Example:
+-----+----------+--------------+------------------------------------------------------------+
| GPU | PID | USER | COMMAND |
+-----+----------+--------------+------------------------------------------------------------+
| 1 | 3273371 | s539y | python train.py --cfg configs/exp1.yaml --epochs 50 |
| 3 | 3204386 | s539y | torchrun --nproc_per_node=2 main.py --exp nnunetv2 |
+-----+----------+--------------+------------------------------------------------------------+
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 580.82.07 Driver Version: 580.82.07 CUDA Version: 13.0 |
|===============================+======================+======================|
| 1 NVIDIA A100-SXM4-40GB | 55C | P0 | 309W / 400W | 20241MiB / 40960MiB | 87% |
| 3 NVIDIA A100-SXM4-40GB | 54C | P0 | 291W / 400W | 20243MiB / 40960MiB | 89% |
+-----------------------------------------------------------------------------+
-
Create your personal bin folder
mkdir -p ~/.local/bin -
Add it to your PATH Append this line to
~/.profile(so it works for all sessions):echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.profile source ~/.profile
To verify:
echo $PATH | tr ':' '\n' | grep local/bin
You should see:
/home/<youruser>/.local/bin -
Create the script
nano ~/.local/bin/nvidia-htopPaste the the content from nvidia-htop into the file.
-
Make it executable
chmod +x ~/.local/bin/nvidia-htop -
Test it
nvidia-htop
You should see the table and
nvidia-smioutput.
You can refresh the view every 0.1 seconds:
watch -n 0.1 nvidia-htopwatch now works because ~/.local/bin is in your PATH.
You can even use:
watch -d -n 0.1 nvidia-htopto highlight changes dynamically (like htop).
| Issue | Solution |
|---|---|
watch says “command not found” |
Add export PATH="$HOME/.local/bin:$PATH" to ~/.profile and reload |
| Table shows only Python but not full args | Check /proc/$pid/cmdline permissions — hidepid in /proc may restrict this for other users |
| Command truncates | Increase max=60 inside the script |
| Slow output | The 1-second delay is from nvidia-smi utilization sampling (normal) |
- Works on any Linux system with
nvidia-smiavailable. - Fully user-space: no root privileges needed.
- Compatible with
bash≥ 4.0 andzsh. - Perfect for cluster users who want a quick overview of who’s using which GPU.
Author: Karol Gotkowski License: MIT Tested on: Ubuntu 22.04, CentOS 8, and RHEL 9 with CUDA ≥ 11.8