| name | process-monitor |
| description | Monitor system processes for resource usage using process-tree watch mode. Use when tracking CPU or memory usage over time, finding resource hogs, or watching a specific process. Triggers include "monitor processes", "watch cpu usage", "process monitor", "top processes", "resource usage", "ptree watch". |
process-monitor
Guide to monitoring processes with process-tree's watch mode and resource filters.
Watching Resource Usage
ptree watch
ptree watch --min-cpu 10
ptree watch --name node
ptree watch --interval 1
Press q or Ctrl-C to stop watching.
Finding Resource Hogs
ptree --sort cpu
ptree --sort mem
ptree --min-cpu 5
ptree --min-mem 500
Reading the Output
Resource columns:
- CPU%: percentage of one CPU core (can exceed 100% on multi-core)
- MEM: resident set size in MB
In watch mode, CPU values are current snapshots. High CPU over multiple refreshes indicates sustained load.
The tree structure shows which parent started which process. A high-CPU child process is often spawned by a parent that started a task.
Common Monitoring Tasks
ptree --port 3000
ptree --name node
ptree --name postgres
ptree watch --root 8421
ptree --user deploy
Killing Resource Hogs
ptree kill 8421
ptree kill 8421 --subtree
ptree kill 8421 --signal SIGKILL --yes
Compact Mode for Busy Systems
On systems with many processes, use --compact to collapse groups of identical-named worker processes into a single line with a count:
ptree --compact
ptree watch --compact
This shows node x12 instead of 12 individual node rows.