Process & Resource Monitoring (Top/Htop/Ps/Systemd)
Quit digging through process trees to find why your app is slow
đź§© The Challenge
You know that feeling when a web server is crawling, but top just shows a blur of PIDs that shift every half-second? Trying to track down the specific thread or child process actually hogging the CPU in a multi-threaded app is a total nightmare.
đź’ˇ The Fix
Use pstree to visualize the hierarchy and map that mess of PIDs back to the parent service. It makes the “who spawned this disaster” answer obvious in a glance.
pstree -p <pid> | grep <string>
⚙️ Why It Works
By passing the PID of the main process, you get a clean branch view of all child threads and sub-processes currently attached to it. Adding the -p flag lets you see the individual thread IDs so you can actually target the right one with a kill or renice command.
🚀 Pro-Tip: Pipe it into less -S if you’re dealing with a massive process tree that wraps your terminal.
Linux Tips & Tricks | © ngelinux.com | 11/30/2026
