Showing your processes in a hierarchical list is very useful for confirming the relationship between every process running on your system. Today I’d like to show you how you can get tree-like processes lists using various commands.
Showing processes tree with ptree
In Solaris, there’s quite a few commands which make the life of any system administrator much easier, they’re the process commands (p-commands). One of them which I particularly like is the ptree command which shows you a list of processes.
As you run the command, you get a hierarchical list of all the processes running on your Solaris system, along with process IDs (PIDs). To me, this is a very useful command, because it shows you how exactly each process relates to others in your system.
Here’s a fragment of the ptree output:
Processes tree with pstree
In most Linux distributions, you can find a pstree command, very similar to ptree.
That’s how you may use it (-p is an option to show PIDs and -l uses long output format):
Showing processes tree with ps –forest
ps command found in Linux has a –forest option, which shows you a tree structure of processes.
The best in my experience is to use it like this:
This output is for demonstration purpose only, and so I’ve taken the first lines of the output out because they weren’t serving the purpose of this example very well.
For thins fragment of the output you can see how you get all the vital information about each process. I really like this way of running the ps command.
That’s it for today! Do you know any other neat way of looking at processes tree? Let me know!