The
1 | <a href="http://www.bellevuelinux.org/pstree.html">pstree command</a> |
shows the ancestral relationships between processes running on a machine. What does that mean? It means you can see an awesome tree of what’s running on your box, instead of the boring output of ps. Check it:
It compresses multiple descendants into a single entry, with the number of descendents (like for apache2 and mysqld here). You can also have it search by user, pid, and more. See the man page for exact details.
Other nice features are being able to highlight certain processes and show command line arguments. So if you wanted to see how the latest apache2 process was called, you could run
pgrep -n apache2 | xargs -I mystr pstree -apH mystr
and get back:
This isn’t a particularly interesting example, but if you knew one of a number of scripts might be causing MySQL to act up, for instance, you could call their names in the pgrep search, and quickly see who called it.
No related posts.
Related posts brought to you by Yet Another Related Posts Plugin.









