Process list with hierarhy: ps re-discovered
Sun, 20 Feb 2011 23:55:41 +0000
Want to easily track list of processes with hierarchy on your linux box? Nothing easiest unless you don't know about few very useful "ps" command line switches. Here they are:
- "x": show also processes without TTY attached (running in background)
- "f": ascii-art process hierarchy
And a sample from my box that builds some interesting (at least for me) stuff (lines shortened slightly):
$ ps xf PID TTY STAT TIME COMMAND 21618 ? S 0:00 su - dccb 21621 ? S 0:00 \_ -su 4460 ? R+ 0:00 \_ ps xf 28962 ? S 0:00 sh daemon-dev.sh 28963 ? S 0:00 \_ sh ../utils/create_mw_ui_rootfs_drop.sh full daemon-dev.sh 7465 ? S 0:00 \_ make 28756 ? S 0:00 \_ /bin/sh -c cd src/libs/dtvservice/ && make -f Makefile 28757 ? S 0:00 \_ make -f Makefile 3895 ? S 0:00 \_ sh4-oe-linux-g++ -c -pipe -isystem /usr/local/dcc-0.9/sh4/v 3896 ? R 0:00 \_ /usr/local/dcc-0.9/sh4/vip1960/bin/../libexec/gcc/sh4-o 3920 ? S 0:00 \_ /usr/local/dcc-0.9/sh4/vip1960/bin/../lib/gcc/sh4-oe-li 17341 ? S 0:00 sh daemon-RELEASE_0.9_branch.sh 16644 ? S 0:00 \_ sleep 5m 15554 ? S 0:00 sh daemon-RELEASE_0.10_branch.sh 16743 ? S 0:00 \_ sleep 5m 13448 ? S 0:00 sh daemon-master.sh 31613 ? S 0:00 \_ sh ../build.sh full daemon-master.sh ns4012uc 411 ? S 0:00 \_ make 637 ? S 0:00 \_ /bin/sh -c . /usr/local/dcc/mipsel/ns4012uc/env.sh; make -C api all 638 ? S 0:00 \_ make -C api all 2839 ? S 0:00 \_ make -C src/hal 7442 ? S 0:00 \_ make -C hal 4159 ? S 0:00 \_ mipsel-oe-linux-uclibc-g++ -MMD -fPIC -DPIC -isyste 4162 ? R 0:00 \_ /opt/toolchains/crosstools_hf-linux-2.6.18.0_gc 4165 ? S 0:00 \_ /opt/toolchains/crosstools_hf-linux-2.6.18.0_gc 5414 ? S 0:00 sh daemon-int-0.11.sh 8067 ? S 0:00 \_ sh ../utils/create_mw_ui_rootfs_drop.sh full daemon-int-0.11.sh /home/dccb/ 21950 ? S 0:00 \_ make 1309 ? S 0:00 \_ /bin/sh -c cd CoreApplications/ && make -f Makefile 1310 ? S 0:00 \_ make -f Makefile 4396 ? S 0:00 \_ /bin/sh -c cd PVRPlayback/ && make -f Makefile 4433 ? S 0:00 \_ make -f Makefile