Monday, November 26, 2007

HowTo: Display a Tree of Linux Processes

Everybody knows the benefit of having an overall idea and infrastructure connectivity of your own local network by looking at our own network diagram.

In linux world, being aware and knowing what processes are currently running at all times is one good practice of managing your linux box. This practice involves monitoring of your memory usage on high and low peak hours of one production day. Looking at processes, this gives you a virtual connectivity of daemon services related to other linux process. A virtual map allowing you to be familiarized with other currently running processes.

Here's one linux command to visually display linux process in a tree map.

PSTree shows running processes as a tree. The tree is rooted at either pid or init if pid is omitted. If a user name is specified, all process trees rooted at processes owned by that user are shown.

PSTree can take a user name as an argument and display all running processes of that specific user. PSTree is part of psmisc rpm package and is installed by default on Fedora 8 with X.


PSTree usage:

Basic tree process
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# pstree
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Tree process of specific user
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# pstree root
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Tree process with numerical sorting
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# pstree -n
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Tree process showing ASCII characters to draw the process tree
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# pstree -A
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Tree process displaying PIDS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# pstree -p
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

A sample process tree screenshot:





HTH

0 comments:

Sign up for PayPal and start accepting credit card payments instantly.
ILoveTux - howtos and news | About | Contact | TOS | Policy