Tuesday 31 July 2012

View process tree

One way to get the current process tree is to use the PS command, like this:
ps faux
Another way is to use the command pstree which will give you a nicer output, like this:
pstree -l -a
the -l option enables the "long lines", by default lines will be truncated and the -a option is for pstree to show the command line arguments of each process. There are other options that you can use, like the -p which will display the IDs of each process.

If you want to see the tree of a particular process you can pass the process PID to pstree:
pstree -l -a 5567
If you don't know the PID of the process you want you can use the following method:
pstree -l -a $(pidof cron)
This will display cron and all of it's children.

You may also see the process tree of a particular user:
pstree -l -a root

Possibly Related Posts

Can't start listener for XE :permission denied

I just reinstalled Oracle XE for Debian / Ubuntu and when I was about to start the listner, I got an error message about missing permissions.

Doing:
cd /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin
strace ./lsnrctl start
I found that it was trying to access /var/tmp/.oracle but this directory is owned by root, so:
chown -R oracle:dba /var/tmp/.oracle
chown -R oracle:dba /var/run/.oracle

And now it works correctly.

Possibly Related Posts