Process Tree

cropped-tux.jpegHi Guys, It has been a long time I haven’t written a article but it’s time now. Today I will talk about pstree.

pstree(1) is a small tool which prints tree of processes. It gives nice picture of processes on system. Basically output of pstree is same as ps(1) but with nice view of tree with branches.

It is often useful to know, which is parent of given process, while debugging. This can be done with ps(1) but you need to keep track of ppid. With tree of processes it is much more easier to know that.

pstree starts with first process that is init with pid 1 unless otherwise specified. It has very good options to sort, show pids along with names, etc.

rahul@rahul-Aspire-4736Z:~$ pstree
init─┬─NetworkManager─┬─dnsmasq
     │                ├─pppd
     │                └─3*[{NetworkManager}]
     ├─accounts-daemon───2*[{accounts-daemon}]
     ├─acpid
     ├─avahi-daemon───avahi-daemon
     ├─bluetoothd
     ├─colord───2*[{colord}]
     ├─cron
     ├─cups-browsed
     ├─cupsd
     ├─dbus-daemon
     ├─6*
     ├─gnome-keyring-d───5*[{gnome-keyring-d}]
     ├─lightdm─┬─Xorg───2*[{Xorg}]
     │         ├─lightdm─┬─init─┬─at-spi-bus-laun─┬─dbus-daemon
     │         │         │      │                 └─3*[{at-spi-bus-laun}]
     │         │         │      ├─at-spi2-registr───{at-spi2-registr}
     │         │         │      ├─bamfdaemon───3*[{bamfdaemon}]
     │         │         │      ├─dbus-daemon
     │         │         │      ├─dconf-service───2*[{dconf-service}]
     │         │         │      ├─evolution-calen───4*[{evolution-calen}]
     │         │         │      ├─evolution-sourc───2*[{evolution-sourc}]
     │         │         │      ├─firefox───42*[{firefox}]
     │         │         │      ├─gconfd-2
     │         │         │      ├─gnome-screensav───3*[{gnome-screensav}]
     │         │         │      ├─gnome-session─┬─compiz─┬─sh───gtk-window-deco───2*[{gtk-window-deco}]
     │         │         │      │               │        ├─sh───gnome-terminal─┬─bash───pstree
     │         │         │      │               │        │                     ├─gnome-pty-helpe
     │         │         │      │               │        │                     └─3*[{gnome-terminal}]
     │         │         │      │               │        └─3*[{compiz}]
     │         │         │      │               ├─deja-dup-monito───2*[{deja-dup-monito}]
     │         │         │      │               ├─gnome-fallback-───2*[{gnome-fallback-}]
     │         │         │      │               ├─nautilus───3*[{nautilus}]
     │         │         │      │               ├─nm-applet───2*[{nm-applet}]
     │         │         │      │               ├─polkit-gnome-au───2*[{polkit-gnome-au}]
     │         │         │      │               ├─telepathy-indic───2*[{telepathy-indic}]
     │         │         │      │               ├─update-notifier───3*[{update-notifier}]
     │         │         │      │               ├─zeitgeist-datah───4*[{zeitgeist-datah}]
     │         │         │      │               └─3*[{gnome-session}]
     │         │         │      ├─gnome-settings-─┬─syndaemon
     │         │         │      │                 └─3*[{gnome-settings-}]
     │         │         │      ├─gvfs-afc-volume───2*[{gvfs-afc-volume}]
     │         │         │      ├─gvfs-gphoto2-vo───{gvfs-gphoto2-vo}
     │         │         │      ├─gvfs-mtp-volume───{gvfs-mtp-volume}
     │         │         │      ├─gvfs-udisks2-vo───2*[{gvfs-udisks2-vo}]
     │         │         │      ├─gvfsd───{gvfsd}
     │         │         │      ├─gvfsd-burn───2*[{gvfsd-burn}]
     │         │         │      ├─gvfsd-fuse───4*[{gvfsd-fuse}]
     │         │         │      ├─gvfsd-trash───3*[{gvfsd-trash}]
     │         │         │      ├─hud-service───2*[{hud-service}]
     │         │         │      ├─ibus-daemon─┬─ibus-dconf───3*[{ibus-dconf}]
     │         │         │      │             ├─ibus-engine-sim───2*[{ibus-engine-sim}]
     │         │         │      │             ├─ibus-ui-gtk3───3*[{ibus-ui-gtk3}]
     │         │         │      │             └─2*[{ibus-daemon}]
     │         │         │      ├─ibus-x11───3*[{ibus-x11}]
     │         │         │      ├─indicator-appli───{indicator-appli}
     │         │         │      ├─indicator-bluet───2*[{indicator-bluet}]
     │         │         │      ├─indicator-datet───4*[{indicator-datet}]
     │         │         │      ├─indicator-keybo───2*[{indicator-keybo}]
     │         │         │      ├─indicator-messa───3*[{indicator-messa}]
     │         │         │      ├─indicator-power───2*[{indicator-power}]
     │         │         │      ├─indicator-print───2*[{indicator-print}]
     │         │         │      ├─indicator-sessi───2*[{indicator-sessi}]
     │         │         │      ├─indicator-sound───2*[{indicator-sound}]
     │         │         │      ├─indicator-sync-───{indicator-sync-}
     │         │         │      ├─notify-osd───2*[{notify-osd}]
     │         │         │      ├─pulseaudio───2*[{pulseaudio}]
     │         │         │      ├─ssh-agent
     │         │         │      ├─unity-panel-ser───2*[{unity-panel-ser}]
     │         │         │      ├─unity-webapps-s───2*[{unity-webapps-s}]
     │         │         │      ├─2*[upstart-dbus-br]
     │         │         │      ├─upstart-event-b
     │         │         │      ├─upstart-file-br
     │         │         │      ├─window-stack-br
     │         │         │      ├─zeitgeist-daemo───{zeitgeist-daemo}
     │         │         │      └─zeitgeist-fts─┬─cat
     │         │         │                      └─{zeitgeist-fts}
     │         │         └─{lightdm}
     │         └─2*[{lightdm}]
     ├─master─┬─pickup
     │        └─qmgr
     ├─modem-manager
     ├─polkitd───2*[{polkitd}]
     ├─rsyslogd───3*[{rsyslogd}]
     ├─rtkit-daemon───2*[{rtkit-daemon}]
     ├─sh───initctl
     ├─systemd-logind
     ├─systemd-udevd
     ├─udisksd───4*[{udisksd}]
     ├─upowerd───2*[{upowerd}]
     ├─upstart-file-br
     ├─upstart-socket-
     ├─upstart-udev-br
     └─whoopsie───2*[{whoopsie}]

For more info see man page!

And last but not least – “have a fun !” as big penguin says.

Enjoy!

Post a Comment

You must be logged in to post a comment.
%d bloggers like this: