Catch ghost processes hanging around in your shell sessions

Process & Resource Monitoring (Top/Htop/Ps/Systemd)

Catch ghost processes hanging around in your shell sessions

🧩 The Challenge

Ever notice your load average is creeping up but top shows absolutely nothing eating CPU? I spent three hours last week hunting a dead terminal process that was still chewing cycles because it didn’t get killed correctly.

💡 The Fix

Use pstree with the proper flags to map out the process tree visually, which reveals those orphaned child processes hiding under a parent that should have cleaned them up. It makes spotting a runaway script or a zombie-spawning daemon instant.

pstree -aps $(pgrep -u your_username)

⚙️ Why It Works

Adding the -a flag shows the full command line arguments, while -p displays the PIDs, giving you the context you need to distinguish a legitimate worker from a hanging ghost. You’ll instantly see the parent-child relationship that typical flat process lists obscure.

🚀 Pro-Tip: Pipe it into grep if you are dealing with a massive tree so you don’t have to scroll through miles of kernel threads.

Linux Tips & Tricks | © ngelinux.com | 11/17/2026

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted