Checking processes in linux

ps -exf

Will show you all processes in a form of tree: parent processes and child processes aligned to the right. Here is sample output:

26633 pts/8    S      0:56  |   \_ /usr/local/java/jre/bin/exe/java -
26649 pts/8    S      0:00  |       \_ /usr/local/java/jre/bin/exe/ja
26650 pts/8    S      0:00  |           \_ /usr/local/java/jre/bin/ex
26651 pts/8    S      0:00  |           \_ /usr/local/java/jre/bin/ex
26652 pts/8    S      0:00  |           \_ /usr/local/java/jre/bin/ex
26655 pts/8    S      0:00  |           \_ /usr/local/java/jre/bin/ex
26656 pts/8    S      0:00  |           \_ /usr/local/java/jre/bin/ex

It is good to use this options with ps when viewing multi-threaded java applications running on linux. As java while running on Linux uses separate process for each thread (note, it depends on JVM and Thread library / implementation JVM is using, some implementations will show only main process for java app and threads will not be displayed as children processes ). You will see main process and children of that process (threads) structured as ASCII tree… Nice huh? :)

Leave a Reply