Loading...

Show process tree of a dedicated process

:heavy_exclamation_mark: This post is older than a year. Consider some information might not be accurate anymore. :heavy_exclamation_mark:

I always wonder if I could display the a certain process with pstree and not the whole process tree itself. It is possible. See below the results after reading the man page and trying out the options.

Example process with subprocess

tan@omega:~> ps -Af | grep '[f]ile-watchdog.sh start'
tan 11165 1 0 09:53 pts/1 00:00:00 bash bin/file-watchdog.sh start
tan 11167 11165 0 09:53 pts/1 00:00:00 bash bin/file-watchdog.sh start

Display process tree of one process

tan@omega:~> pstree 11165
bash─┬─bash
└─inotifywait

Display process tree in Unicode

tan@omega:~> pstree -U 11165
bash─┬─bash
└─inotifywait

Display process tree in Unicode, compact and with process id

tan@omega:~> pstree -U -c -p 11165
bash(11165)─┬─bash(11167)
└─inotifywait(11166)

Display process tree compact, process id in ASCII characters

tan@omega:~> pstree -c -p -A 11165
bash(11165)-+-bash(11167)
`-inotifywait(11166)
Please remember the terms for blog comments.